Define a default module is not defined
This commit is contained in:
parent
4917ba31a2
commit
8fd2f8a577
@ -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/";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user