/**
	 *    Assign custom values for canvas (for example into this->tpl to be used by templates)
	 *
	 *    @param	string	&$action    Type of action
	 *    @param	string	$id			Id of object
	 *    @param	string	$ref		Ref of object
	 *    @return	void
	 */
	function assign_values(&$action, $id=0, $ref='')
	{
		global $conf, $langs;
		global $form, $formcompany;

		$ret = $this->getObject($id,$ref);

		parent::assign_values($action);

        $this->tpl['title'] = load_fiche_titre($this->getTitle($action));

		if ($action == 'create' || $action == 'edit')
		{
			$this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civilite_id'));
		}
		else
		{
			// Confirm delete third party
			if ($action == 'delete' || $conf->use_javascript_ajax)
			{
				$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
			}
		}
	}
	/**
	 *    Assign custom values for canvas
	 *    @param      action     Type of action
	 */
	function assign_values($action='')
	{
		global $conf, $langs;
		global $form, $formcompany;

		parent::assign_values($action);

		if ($action == 'create' || $action == 'edit')
		{
			$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
		}
		else
		{
			// Confirm delete third party
			if ($_GET["action"] == 'delete' || $conf->use_javascript_ajax)
			{
				$this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$this->object->id,$langs->trans("DeleteAnIndividual"),$langs->trans("ConfirmDeleteIndividual"),"confirm_delete",'',0,"1,action-delete");
			}
		}
	}
 /**
  *    Assign custom values for canvas (for example into this->tpl to be used by templates)
  *
  *    @param	string	$action    Type of action
  *    @param	integer	$id			Id of object
  *    @param	string	$ref		Ref of object
  *    @return	void
  */
 function assign_values(&$action, $id = 0, $ref = '')
 {
     global $conf, $langs, $user, $mysoc;
     global $form, $formadmin, $formcompany;
     $ret = $this->getObject($id, $ref);
     parent::assign_values($action);
     $this->tpl['title'] = load_fiche_titre($this->getTitle($action));
     $this->tpl['profid1'] = $this->object->idprof1;
     $this->tpl['profid2'] = $this->object->idprof2;
     $this->tpl['profid3'] = $this->object->idprof3;
     $this->tpl['profid4'] = $this->object->idprof4;
     if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) {
         $js = "\n";
         $js .= '<script language="JavaScript" type="text/javascript">';
         $js .= "function CheckVAT(a) {\n";
         $js .= "newpopup('" . DOL_URL_ROOT . "/societe/checkvat/checkVatPopup.php?vatNumber='+a,'" . dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")) . "',500,230);\n";
         $js .= "}\n";
         $js .= '</script>';
         $js .= "\n";
         $this->tpl['js_checkVatPopup'] = $js;
     }
     if ($action == 'create' || $action == 'edit') {
         for ($i = 1; $i <= 4; $i++) {
             $this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code);
             $this->tpl['showprofid' . $i] = $formcompany->get_input_id_prof($i, 'idprof' . $i, $this->tpl['profid' . $i], $this->object->country_code);
         }
         // Type
         $this->tpl['select_companytype'] = $form->selectarray("typent_id", $formcompany->typent_array(0), $this->object->typent_id);
         // Juridical Status
         $this->tpl['select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code);
         // Workforce
         $this->tpl['select_workforce'] = $form->selectarray("effectif_id", $formcompany->effectif_array(0), $this->object->effectif_id);
         // VAT intra
         $s = '<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">';
         if (empty($conf->global->MAIN_DISABLEVATCHECK)) {
             $s .= ' ';
             if ($conf->use_javascript_ajax) {
                 $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>';
                 $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
             } else {
                 $this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>';
             }
         } else {
             $this->tpl['tva_intra'] = $s;
         }
     } else {
         // Confirm delete third party
         if ($action == 'delete') {
             $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . $this->object->id, $langs->trans("DeleteACompany"), $langs->trans("ConfirmDeleteCompany"), "confirm_delete", '', 0, "1,action-delete");
         }
         for ($i = 1; $i <= 4; $i++) {
             $this->tpl['langprofid' . $i] = $langs->transcountry('ProfId' . $i, $this->object->country_code);
             $this->tpl['checkprofid' . $i] = $this->object->id_prof_check($i, $this->object);
             $this->tpl['urlprofid' . $i] = $this->object->id_prof_url($i, $this->object);
         }
         // TVA intra
         if ($this->object->tva_intra) {
             $s = $this->object->tva_intra;
             $s .= '<input type="hidden" name="tva_intra" size="12" maxlength="20" value="' . $this->object->tva_intra . '">';
             if (empty($conf->global->MAIN_DISABLEVATCHECK)) {
                 $s .= ' &nbsp; ';
                 if ($conf->use_javascript_ajax) {
                     $s .= '<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">' . $langs->trans("VATIntraCheck") . '</a>';
                     $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->trans("VATIntraCheck")), 1);
                 } else {
                     $this->tpl['tva_intra'] = $s . '<a href="' . $langs->transcountry("VATIntraCheckURL", $this->object->country_id) . '" target="_blank">' . img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help') . '</a>';
                 }
             } else {
                 $this->tpl['tva_intra'] = $s;
             }
         } else {
             $this->tpl['tva_intra'] = '&nbsp;';
         }
         // Parent company
         if ($this->object->parent) {
             $socm = new Societe($this->db);
             $socm->fetch($this->object->parent);
             $this->tpl['parent_company'] = $socm->getNomUrl(1) . ' ' . ($socm->code_client ? "(" . $socm->code_client . ")" : "");
             $this->tpl['parent_company'] .= $socm->town ? ' - ' . $socm->town : '';
         } else {
             $this->tpl['parent_company'] = $langs->trans("NoParentCompany");
         }
     }
 }