diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 0b0aedf70e3..59a0bc060a6 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -35,9 +35,16 @@ $langs->load("contracts"); if (!$user->admin) accessforbidden(); +if (empty($conf->global->CONTRACT_ADDON)) +{ + $conf->global->CONTRACT_ADDON='mod_contract_serpis'; +} + + /* * Actions */ + if ($_POST["action"] == 'updateMask') { $maskconst=$_POST['maskconstcontract']; @@ -56,9 +63,11 @@ if ($_POST["action"] == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PR if ($_POST["action"] == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity); if ($_POST["action"] == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); + /* * View */ + llxHeader(); $dir=DOL_DOCUMENT_ROOT."/includes/modules/contract/"; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index b65159e822d..63b7014d5d7 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -41,6 +41,11 @@ $langs->load("deliveries"); if (!$user->admin) accessforbidden(); +if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) +{ + $conf->global->EXPEDITION_ADDON_NUMBER='mod_expedition_safor'; +} + /* * Actions diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index dfe7bb47e82..7f40aae4b95 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -100,33 +100,30 @@ class Contrat extends CommonObject $dir = DOL_DOCUMENT_ROOT . "/includes/modules/contract"; - if (! empty($conf->global->CONTRACT_ADDON)) + if (empty($conf->global->CONTRACT_ADDON)) { - $file = $conf->global->CONTRACT_ADDON.".php"; + $conf->global->CONTRACT_ADDON='mod_contract_serpis'; + } - // Chargement de la classe de numerotation - $classname = $conf->global->CONTRACT_ADDON; + $file = $conf->global->CONTRACT_ADDON.".php"; - $result=include_once($dir.'/'.$file); - if ($result) + // Chargement de la classe de numerotation + $classname = $conf->global->CONTRACT_ADDON; + + $result=include_once($dir.'/'.$file); + if ($result) + { + $obj = new $classname(); + $numref = ""; + $numref = $obj->getNextValue($soc,$this); + + if ( $numref != "") { - $obj = new $classname(); - $numref = ""; - $numref = $obj->getNextValue($soc,$this); - - if ( $numref != "") - { - return $numref; - } - else - { - dol_print_error($db,"Contract::getNextNumRef ".$obj->error); - return ""; - } + return $numref; } else { - print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined"); + dol_print_error($db,"Contract::getNextNumRef ".$obj->error); return ""; } } @@ -134,9 +131,9 @@ class Contrat extends CommonObject { print $langs->trans("Error")." ".$langs->trans("Error_CONTRACT_ADDON_NotDefined"); return ""; - } + } } - + /** * \brief Activate a contract line * \param user Objet User qui active le contrat @@ -471,9 +468,9 @@ class Contrat extends CommonObject $line->date_debut_reel = $this->db->jdate($objp->date_ouverture); $line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite); $line->date_fin_reel = $this->db->jdate($objp->date_cloture); - + $this->lines[] = $line; - + //dol_syslog("1 ".$line->desc); //dol_syslog("2 ".$line->product_desc); diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index cc1c47c12e2..db63e017cd8 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -85,7 +85,7 @@ class Expedition extends CommonObject $this->statuts[0] = 'StatusSendingDraft'; $this->statuts[1] = 'StatusSendingValidated'; } - + /** * Return next contract ref * @param soc objet society @@ -98,33 +98,30 @@ class Expedition extends CommonObject $dir = DOL_DOCUMENT_ROOT . "/includes/modules/expedition"; - if (! empty($conf->global->EXPEDITION_ADDON_NUMBER)) + if (empty($conf->global->EXPEDITION_ADDON_NUMBER)) + { + $conf->global->EXPEDITION_ADDON_NUMBER='mod_expedition_safor'; + } + + $file = $conf->global->EXPEDITION_ADDON_NUMBER.".php"; + + // Chargement de la classe de numerotation + $classname = $conf->global->EXPEDITION_ADDON_NUMBER; + + $result=include_once($dir.'/'.$file); + if ($result) { - $file = $conf->global->EXPEDITION_ADDON_NUMBER.".php"; + $obj = new $classname(); + $numref = ""; + $numref = $obj->getNextValue($soc,$this); - // Chargement de la classe de numerotation - $classname = $conf->global->EXPEDITION_ADDON_NUMBER; - - $result=include_once($dir.'/'.$file); - if ($result) + if ( $numref != "") { - $obj = new $classname(); - $numref = ""; - $numref = $obj->getNextValue($soc,$this); - - if ( $numref != "") - { - return $numref; - } - else - { - dol_print_error($db,"Expedition::getNextNumRef ".$obj->error); - return ""; - } + return $numref; } else { - print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined"); + dol_print_error($db,"Expedition::getNextNumRef ".$obj->error); return ""; } } @@ -134,7 +131,7 @@ class Expedition extends CommonObject return ""; } } - + /** * \brief Cree expedition en base * \param user Objet du user qui cree @@ -429,7 +426,7 @@ class Expedition extends CommonObject { $num = "EXP".$this->id; } - + $now=dol_now(); // Validate diff --git a/htdocs/includes/modules/expedition/mod_expedition_safor.php b/htdocs/includes/modules/expedition/mod_expedition_safor.php index 559d55fd1c2..a7d1ec7dc9d 100755 --- a/htdocs/includes/modules/expedition/mod_expedition_safor.php +++ b/htdocs/includes/modules/expedition/mod_expedition_safor.php @@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/modules_expedition class mod_expedition_safor extends ModelNumRefExpedition { var $version='dolibarr'; - var $prefix='BE'; + var $prefix='SH'; var $error=''; var $nom='Safor'; @@ -47,7 +47,7 @@ class mod_expedition_safor extends ModelNumRefExpedition } - /** + /** * Return numbering example * @return string Example */ @@ -57,7 +57,7 @@ class mod_expedition_safor extends ModelNumRefExpedition } - /** + /** * Test if existing numbers make problems with numbering * @return boolean false if conflit, true if ok */ @@ -89,7 +89,7 @@ class mod_expedition_safor extends ModelNumRefExpedition return true; } - /** + /** * Return next value * @param objsoc third party object * @param shipment shipment object @@ -126,7 +126,7 @@ class mod_expedition_safor extends ModelNumRefExpedition return $this->prefix.$yymm."-".$num; } - /** + /** *Return next free value * @param objsoc Object third party * @param objforref Object for number to search