Add new form field in OrangeHRM New Candidate

Hello

OrangeHRM is best tool for HR Management

If you want to add 3 field in new candidate form follow these steps


First add all threee field in #_job_candidate table 

Open 3 files

1. orangehrm\symfony\plugins\orangehrmRecruitmentPlugin\lib\form\AddCandidateForm .php
2.orangehrm\symfony\plugins\orangehrmRecruitmentPlugin\modules\recruitment\templates\addCandidateSuccess.php
3.orangehrm\symfony\lib\model\doctrine\orangehrmRecruitmentPlugin\base\BaseJobCandidate.class.php

now we are editing files one by one

first fie
  1.  Add these lines
                             'location' => new sfWidgetFormInputText(),
                              'source' => new sfWidgetFormInputText(),
                              'salexpected' => new sfWidgetFormInputText(),           at line no .133  in creating widget
  2                      
                            $this->setDefault('location', $candidate->getLocation());
                            $this->setDefault('source', $candidate->getSource());                                        
                            $this->setDefault('salexpected', $candidate->getSalexpected());

                           add these line in setDefaultValues()   function

3                         $candidate->location= $this->getValue('location');
                           $candidate->source= $this->getValue('source');
                          $candidate->salexpected= $this->getValue('salexpected');
                         add  these line in _getNewlySavedCandidateId()  function
             
           
  Second File

                 <li>
                                 <?php echo $form['location']->renderLabel(__('Location') . ' '); ?>
                                <?php echo $form['location']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
                      </li>
                      <li>
                              <?php echo $form['source']->renderLabel(__('Source') . ' '); ?>
                                <?php echo $form['source']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
                       </li>
                       <li>
                               <?php echo $form['salexpected']->renderLabel(__('Salery Expected') . ' '); ?>
                                <?php echo $form['salexpected']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
                         </li>


   at line no 94 or where you want to add

Third file ::


                Add line at line no 15
  * @property string $location
 * @property string $source
 * @property string $salexpecte


   line no 39

                     * @method string                 getlocation()          Returns the current record's "location" value
 * @method string                 getsource()          Returns the current record's "source" value
 * @method string                 getsalexpected()          Returns the current record's "salexpected" value

line no 112
       
 $this->hasColumn('location as location', 'string', 30, array(
             'type' => 'string',
             'length' => 30,
             ));           
         $this->hasColumn('source as source', 'string', 30, array(
             'type' => 'string',
             'length' => 30,
             ));       
         $this->hasColumn('salexpected as salexpected', 'string', 30, array(
             'type' => 'string',
             'length' => 30,
             ));                     
       

Most of part done but result as follow
Error :   It is not saving in database


one more thing  add validation at line 149 in first file "Thanks to Tony"

'source' => new sfValidatorString(array('required' => false)),
'location' => new sfValidatorString(array('required' => false)),
'salexpected' => new sfValidatorString(array('required' => false)),








4 comments:

  1. hello i'm about to remove some sub menu from orangehrm which is unnecessary so can you help me please

    ReplyDelete
  2. You just saved my life ! great article sir! thank you so much!!!

    ReplyDelete
  3. Hi, I followed all the procedures here. Its not working, i guess it doesn't apply to the latest version. I need your help please.

    ReplyDelete

Pages