Merge branch '13.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-01-15 11:41:45 +01:00
commit 4c50f25c12
7 changed files with 33 additions and 17 deletions

View File

@ -2893,19 +2893,20 @@ class Commande extends CommonOrder
* Classify the order as invoiced
*
* @param User $user Object user making the change
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
* @param int $notrigger 1=Does not execute triggers, 0=execute triggers
* @return int <0 if KO, 0 if already billed, >0 if OK
*/
public function classifyBilled(User $user, $notrigger = 0)
{
$error = 0;
$this->db->begin();
if ($this->billed)
{
return 0;
}
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;

View File

@ -401,6 +401,7 @@ class Paiement extends CommonObject
if ($result < 0)
{
$this->error = $invoice->error;
$this->errors = $invoice->errors;
$error++;
}
}

View File

@ -179,20 +179,29 @@ class Interfaces
$objMod = new $modName($this->db);
if ($objMod)
{
$dblevelbefore = $this->db->transaction_opened;
$result = 0;
if (method_exists($objMod, 'runTrigger')) // New method to implement
{
if (method_exists($objMod, 'runTrigger')) { // New method to implement
//dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG);
$result = $objMod->runTrigger($action, $object, $user, $langs, $conf);
} elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
{
} elseif (method_exists($objMod, 'run_trigger')) { // Deprecated method
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
$result = $objMod->run_trigger($action, $object, $user, $langs, $conf);
} else {
dol_syslog(get_class($this)."::run_triggers action=".$action." A trigger was declared for class ".get_class($objMod)." but method runTrigger was not found", LOG_ERR);
}
$dblevelafter = $this->db->transaction_opened;
if ($dblevelbefore != $dblevelafter) {
$errormessage = "Error, the balance begin/close of db transactions has been broken into trigger ".$modName." with action=".$action." before=".$dblevelbefore." after=".$dblevelafter;
$this->errors[] = $errormessage;
dol_syslog($errormessage, LOG_ERR);
$result = -1;
}
if ($result > 0)
{
// Action OK

View File

@ -891,11 +891,17 @@ class CommandeFournisseur extends CommonOrder
* Class invoiced the supplier order
*
* @param User $user Object user making the change
* @return int <0 if KO, >0 if KO
* @return int <0 if KO, 0 if already billed, >0 if OK
*/
public function classifyBilled(User $user)
{
$error = 0;
if ($this->billed)
{
return 0;
}
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur SET billed = 1';

View File

@ -122,7 +122,7 @@ if (!function_exists("imagecreate"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportGD")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
} else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportGD")."<br>\n";
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "GD")."<br>\n";
}
@ -133,7 +133,7 @@ if (!function_exists("curl_init"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCurl")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
} else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportCurl")."<br>\n";
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Curl")."<br>\n";
}
// Check if PHP calendar extension is available
@ -141,7 +141,7 @@ if (!function_exists("easter_date"))
{
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."<br>\n";
} else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportCalendar")."<br>\n";
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Calendar")."<br>\n";
}
@ -152,7 +152,7 @@ if (!function_exists("utf8_encode"))
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
} else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportUTF8")."<br>\n";
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "UTF8")."<br>\n";
}
@ -165,7 +165,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPDoesNotSupportIntl")."<br>\n";
// $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install)
} else {
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupportIntl")."<br>\n";
print '<img src="../theme/eldy/img/tick.png" alt="Ok"> '.$langs->trans("PHPSupport", "Intl")."<br>\n";
}
}

View File

@ -68,7 +68,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
$listofstatus = array_keys($listofoppstatus);
// Complete with values found into database and not into the dictionary
foreach($valsamount as $key => $val) {
foreach ($valsamount as $key => $val) {
if (!in_array($key, $listofstatus)) {
$listofstatus[] = $key;
}

View File

@ -3828,9 +3828,8 @@ class Societe extends CommonObject
if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label"
$state_code = $tmp[1];
$state_label = $tmp[2];
} else // For backward compatibility
{
dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR);
} else { // For backward compatibility
dol_syslog("Your state setup use an old syntax (entity=".$conf->entity."). Reedit it using setup area.", LOG_ERR);
include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
$state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore
$state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore