diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index da67110193e..3ea4d5642ce 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -98,6 +98,8 @@ class Canvas */ function fetch($id,$action='') { + $this->action = $action; + $ret = $this->object->fetch($id,$action); return $ret; } diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index 71851bced1d..81c423fd679 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -3209,9 +3209,10 @@ function monthArrayOrSelected($selected=0) /** - * \brief Returns formated reduction - * \param reduction Reduction percentage - * \return int Return number of error messages shown + * Returns formated errors messages + * @param mesgstring Error message + * @param mesgarray Error messages array + * @return html Return html output */ function dol_htmloutput_errors($mesgstring='',$mesgarray='') { diff --git a/htdocs/societe/canvas/default/thirdparty.default.class.php b/htdocs/societe/canvas/default/thirdparty.default.class.php index 640c1dec174..9c74d33a5b7 100644 --- a/htdocs/societe/canvas/default/thirdparty.default.class.php +++ b/htdocs/societe/canvas/default/thirdparty.default.class.php @@ -84,7 +84,7 @@ class ThirdPartyDefault extends Societe $this->tpl['profid3'] = $this->ape; $this->tpl['profid4'] = $this->idprof4; - if ($action == 'create') + if ($action == 'create' || $action == 'edit') { for ($i=1; $i<=4; $i++) { diff --git a/htdocs/societe/canvas/default/tpl/create.tpl.php b/htdocs/societe/canvas/default/tpl/create.tpl.php index 01769dee2fb..6467e690e30 100644 --- a/htdocs/societe/canvas/default/tpl/create.tpl.php +++ b/htdocs/societe/canvas/default/tpl/create.tpl.php @@ -27,7 +27,7 @@ -code_auto || $modCodeFournisseur->code_auto) { ?> +object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?> diff --git a/htdocs/societe/canvas/default/tpl/edit.tpl.php b/htdocs/societe/canvas/default/tpl/edit.tpl.php index 4a17dcd09d3..5f7aa2801c0 100644 --- a/htdocs/societe/canvas/default/tpl/edit.tpl.php +++ b/htdocs/societe/canvas/default/tpl/edit.tpl.php @@ -21,5 +21,193 @@ +
" method="POST" name="formsoc"> + + + +object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +object->tpl['fournisseur']) { + if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?> + + + + + + +global->MAIN_MODULE_BARCODE) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +object->tpl['langprofid'.$i]!='-') { + if ($i==1 || $i==3) echo ''; + echo ''; + echo ''; + if ($i==2 || $i==4) echo ''; + } else { + if ($i==1 || $i==3) echo ''; + echo ''; + echo ''; + if ($i==2 || $i==4) echo ''; + } +} +?> + + + + + + + + + + + + + +global->MAIN_MULTILANGS) { ?> + + + + + + +use_javascript_ajax) { ?> + + + + + + + + + + +object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?> + +
trans('Name'); ?>
trans("Prefix"); ?> + tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?> + + object->tpl['prefix_comm']; ?> + + + + +
trans('ProspectCustomer'); ?>object->tpl['select_customertype']; ?>trans('CustomerCode'); ?> + + + + + +
+ object->tpl['ismodifiable_customercode']) { ?> + + + object->tpl['customercode']; ?> + + + tpl['help_customercode']; ?>
+
trans('Supplier'); ?>object->tpl['yn_supplier']; ?>trans('SupplierCode'); ?> + + + + + +
+ object->tpl['ismodifiable_suppliercode']) { ?> + + + object->tpl['suppliercode']; ?> + + + tpl['help_suppliercode']; ?>
+
trans('SupplierCategory'); ?>object->tpl['select_suppliercategory']; ?>
trans('Gencod'); ?>
trans('Address'); ?>
trans('Zip'); ?>object->tpl['autofilltownfromzip']; ?>trans('Town'); ?>
trans('Country'); ?>object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?>
trans('State'); ?>object->tpl['select_state']; ?>
trans('Phone'); ?>trans('Fax'); ?>
trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('Web'); ?>
trans('Capital'); ?> trans("Currency".$conf->monnaie); ?>
'.$this->object->tpl['langprofid'.$i].''.$this->object->tpl['showprofid'.$i].'
  
trans('JuridicalStatus'); ?>object->tpl['select_juridicalstatus']; ?>
trans("Type"); ?>object->tpl['select_companytype']; echo $this->object->tpl['info_admin']; ?>trans("Staff"); ?>object->tpl['select_workforce']; echo $this->object->tpl['info_admin']; ?>
trans("DefaultLang"); ?>object->tpl['select_lang']; ?>
trans('VATIsUsed'); ?>object->tpl['yn_assujtva']; ?>trans('VATIntra'); ?>object->tpl['tva_intra']; ?>
+
+ +
+"> +    +"> +
+ +
\ No newline at end of file diff --git a/htdocs/societe/canvas/individual/thirdparty.individual.class.php b/htdocs/societe/canvas/individual/thirdparty.individual.class.php index 33dc01e50c1..efc1add7c62 100644 --- a/htdocs/societe/canvas/individual/thirdparty.individual.class.php +++ b/htdocs/societe/canvas/individual/thirdparty.individual.class.php @@ -39,11 +39,10 @@ class ThirdPartyIndividual extends Societe * \param DB Handler acces base de donnees * \param id Id produit (0 par defaut) */ - function ThirdPartyIndividual($DB=0, $id=0, $user=0) + function ThirdPartyIndividual($DB) { $this->db = $DB; - $this->id = $id ; - $this->user = $user; + $this->smarty = 0; $this->module = "societe"; $this->canvas = "individual"; @@ -60,10 +59,11 @@ class ThirdPartyIndividual extends Societe } /** - * \brief Lecture des donnees dans la base - * \param id Product id + * Lecture des donnees dans la base + * @param id Element id + * @param action Type of action */ - function fetch($id='', $ref='', $action='') + function fetch($id='', $action='') { $result = parent::fetch($id); @@ -81,9 +81,7 @@ class ThirdPartyIndividual extends Societe parent::assign_values($action); - $form = new Form($db); - - if ($action == 'create') + if ($action == 'create' || $action == 'edit') { $this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id); } diff --git a/htdocs/societe/canvas/individual/tpl/edit.tpl.php b/htdocs/societe/canvas/individual/tpl/edit.tpl.php index 4a17dcd09d3..0fbbb654a10 100644 --- a/htdocs/societe/canvas/individual/tpl/edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/edit.tpl.php @@ -21,5 +21,151 @@ +
" method="POST" name="formsoc"> + + + + +object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +object->tpl['fournisseur']) { + if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?> + + + + + + +global->MAIN_MODULE_BARCODE) { ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +global->MAIN_MULTILANGS) { ?> + + + + + + + + + + + +object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?> + +
trans('Name'); ?>
trans("Prefix"); ?> + tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?> + + object->tpl['prefix_comm']; ?> + + + + +
trans('ProspectCustomer'); ?>object->tpl['select_customertype']; ?>trans('CustomerCode'); ?> + + + + + +
+ object->tpl['ismodifiable_customercode']) { ?> + + + object->tpl['customercode']; ?> + + + tpl['help_customercode']; ?>
+
trans('Supplier'); ?>object->tpl['yn_supplier']; ?>trans('SupplierCode'); ?> + + + + + +
+ object->tpl['ismodifiable_suppliercode']) { ?> + + + object->tpl['suppliercode']; ?> + + + tpl['help_suppliercode']; ?>
+
trans('SupplierCategory'); ?>object->tpl['select_suppliercategory']; ?>
trans('Gencod'); ?>
trans('Address'); ?>
trans('Zip'); ?>object->tpl['autofilltownfromzip']; ?>trans('Town'); ?>
trans('Country'); ?>object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?>
trans('State'); ?>object->tpl['select_state']; ?>
trans('Phone'); ?>trans('Fax'); ?>
trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?>trans('Web'); ?>
trans("DefaultLang"); ?>object->tpl['select_lang']; ?>
trans('VATIsUsed'); ?>object->tpl['yn_assujtva']; ?>
+
+ +
+"> +    +"> +
+ +
\ No newline at end of file diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4e5067945e5..6d7d557bad4 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2160,9 +2160,15 @@ class Societe extends CommonObject $this->tpl[$key] = $value; } - if ($action == 'create') + if ($action == 'create' || $action == 'edit') { - // Load object modCodeTiers + if ($_GET["type"]=='f') { $this->fournisseur=1; } + if ($_GET["type"]=='c') { $this->client=1; } + if ($_GET["type"]=='p') { $this->client=2; } + if ($_GET["type"]=='cp') { $this->client=3; } + if ($_REQUEST["private"]==1) { $this->particulier=1; } + + // Load object modCodeClient $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined")); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') @@ -2171,6 +2177,11 @@ class Societe extends CommonObject } require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); $modCodeClient = new $module; + $this->tpl['auto_customercode'] = $modCodeClient->code_auto; + // We verified if the tag prefix is used + if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed(); + + // Load object modCodeFournisseur $module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON; if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') @@ -2179,6 +2190,9 @@ class Societe extends CommonObject } require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php"); $modCodeFournisseur = new $module; + $this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto; + // We verified if the tag prefix is used + if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed(); // TODO create a function $this->tpl['select_customertype'] = ''; - print ''; - print ''; - if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print ''; - - print ''; - - // Name - print ''; - - // Prefix - print ''; - - // Prospect/Customer - print ''; - print ''; - - // Supplier - print ''; - print ''; - print ''; - - // Category - if ($soc->fournisseur) - { - $load = $soc->LoadSupplierCateg(); - if ( $load == 0) - { - if (sizeof($soc->SupplierCategories) > 0) - { - print ''; - print ''; - } - } - } - - if ($conf->global->MAIN_MODULE_BARCODE) - { - print ''; - } - - // Address - print ''; - - // Zip / Town - print ''; - print ''; - - // Country - print ''; - - // Department - print ''; - - // Phone / Fax - print ''; - print ''; - - // EMail / Web - print ''; - print ''; - - print ''; - // IdProf1 (SIREN for France) - $idprof=$langs->transcountry('ProfId1',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - // IdProf2 (SIRET for France) - $idprof=$langs->transcountry('ProfId2',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - print ''; - print ''; - // IdProf3 (APE for France) - $idprof=$langs->transcountry('ProfId3',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - // IdProf4 (NU for France) - $idprof=$langs->transcountry('ProfId4',$soc->pays_code); - if ($idprof!='-') - { - print ''; - } - else print ''; - print ''; - - // VAT payers - print ''; - - // VAT Code - if ($conf->use_javascript_ajax) - { - print "\n"; - print ''; - print "\n"; - } - print ''; - print ''; - print ''; - - // Local Taxes - if($mysoc->pays_code=='ES') - { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") - { - print ''; - - } - elseif($mysoc->localtax1_assuj=="1") - { - print ''; - - } - elseif($mysoc->localtax2_assuj=="1") - { - print ''; - } - } - - print ''; - - print ''; - - print ''; - print ''; - - if ($conf->global->MAIN_MULTILANGS) - { - print ''; - print ''; - } - - print '
'.$langs->trans('Name').'
'.$langs->trans("Prefix").''; - // It does not change the prefix mode using the auto numbering prefix - if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $soc->prefix_comm) - { - print ''; - print $soc->prefix_comm; - } - else - { - print ''; - } - print '
'.$langs->trans('ProspectCustomer').''.$langs->trans('CustomerCode').''; - - print '
'; - if ((!$soc->code_client || $soc->code_client == -1) && $modCodeClient->code_auto) - { - $tmpcode=$soc->code_client; - if (empty($tmpcode) && $modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($soc,0); - print ''; - } - else if ($soc->codeclient_modifiable()) - { - print ''; - } - else - { - print $soc->code_client; - print ''; - } - print ''; - $s=$modCodeClient->getToolTip($langs,$soc,0); - print $form->textwithpicto('',$s,1); - print '
'; - - print '
'.$langs->trans('Supplier').''; - print $form->selectyesno("fournisseur",$soc->fournisseur,1); - print ''.$langs->trans('SupplierCode').''; - - print '
'; - if ((!$soc->code_fournisseur || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto) - { - $tmpcode=$soc->code_fournisseur; - if (empty($tmpcode) && $modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($soc,1); - print ''; - } - else if ($soc->codefournisseur_modifiable()) - { - print ''; - } - else - { - print $soc->code_fournisseur; - print ''; - } - print ''; - $s=$modCodeFournisseur->getToolTip($langs,$soc,1); - print $form->textwithpicto('',$s,1); - print '
'; - - print '
'.$langs->trans('SupplierCategory').''; - print $form->selectarray("fournisseur_categorie",$soc->SupplierCategories,'',1); - print '
'.$langs->trans('Gencod').''; - print '
'.$langs->trans('Address').'
'.$langs->trans('Zip').''; - if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTOFILL_TOWNFROMZIP) print ' '; - print ''.$langs->trans('Town').'
'.$langs->trans('Country').''; - $form->select_pays($soc->pays_id,'pays_id'); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans('State').''; - $formcompany->select_departement($soc->departement_id,$soc->pays_code); - print '
'.$langs->trans('Phone').''.$langs->trans('Fax').'
'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').''.$langs->trans('Web').'
'.$idprof.''; - $soc->show_input_id_prof(1,'idprof1',$soc->siren); - print '  '.$idprof.''; - $soc->show_input_id_prof(2,'idprof2',$soc->siret); - print '  
'.$idprof.''; - $soc->show_input_id_prof(3,'idprof3',$soc->ape); - print '  '.$idprof.''; - $soc->show_input_id_prof(4,'idprof4',$soc->idprof4); - print '  
'.$langs->trans('VATIsUsed').''; - print $form->selectyesno('assujtva_value',$soc->tva_assuj,1); - print ''.$langs->trans('VATIntra').''; - $s =''; - $s.=' '; - if ($conf->use_javascript_ajax) - { - $s.=''.$langs->trans("VATIntraCheck").''; - print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1); - } - else - { - print $s.'id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').''; - } - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1); - print ''.$langs->trans("LocalTax2IsUsedES").''; - print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1); - print '
'.$langs->trans("LocalTax1IsUsedES").''; - print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1); - print '
'.$langs->trans("LocalTax2IsUsedES").''; - print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1); - print '
'.$langs->trans("Capital").' '.$langs->trans("Currency".$conf->monnaie).'
'.$langs->trans('JuridicalStatus').''; - $formcompany->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code); - print '
'.$langs->trans("Type").''; - print $form->selectarray("typent_id",$formcompany->typent_array(0), $soc->typent_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print ''.$langs->trans("Staff").''; - print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $soc->effectif_id); - if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); - print '
'.$langs->trans("DefaultLang").''."\n"; - $formadmin->select_lang($soc->default_lang,'default_lang',0,0,1); - print '
'; - print '
'; - - print '
'; - print ''; - print '     '; - print ''; - print '
'; - - print ''; + + // Assign values + $soc->assign_values('edit'); + + // Display canvas + $soc->display_canvas(); } } else