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

This commit is contained in:
Laurent Destailleur 2020-10-23 15:31:35 +02:00
commit cddbbc76c9
4 changed files with 20 additions and 15 deletions

View File

@ -2573,7 +2573,6 @@ if ($action == 'create' && $usercancreate)
if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=shipped">'.$langs->trans('ClassifyShipped').'</a></div>';
} }
// Create bill and Classify billed // Create bill and Classify billed
// Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed"
if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) { if ($object->statut > Commande::STATUS_DRAFT && !$object->billed && $object->total_ttc >= 0) {

View File

@ -745,6 +745,10 @@ class Commande extends CommonOrder
if ($usercanclose) if ($usercanclose)
{ {
$this->db->begin(); $this->db->begin();
if ($this->statut == self::STATUS_CLOSED)
{
return 0;
}
$now = dol_now(); $now = dol_now();
@ -2882,6 +2886,10 @@ class Commande extends CommonOrder
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
if ($this->billed)
{
return 0;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1';
$sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT;

View File

@ -164,21 +164,19 @@ class RejetPrelevement
$pai->paiementid = 3; // type of payment: withdrawal $pai->paiementid = 3; // type of payment: withdrawal
$pai->num_payment = $fac->ref; $pai->num_payment = $fac->ref;
if ($pai->create($this->user) < 0) // we call with no_commit if ($pai->create($this->user) < 0) {
{ // we call with no_commit
$error++; $error++;
dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]);
} else { } else {
$result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', '');
if ($result < 0) if ($result < 0) {
{
dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); dol_syslog("RejetPrelevement::Create AddPaymentToBan Error");
$error++; $error++;
} }
// Payment validation // Payment validation
if ($pai->validate($user) < 0) if ($pai->validate($user) < 0) {
{
$error++; $error++;
dol_syslog("RejetPrelevement::Create Error payment validation"); dol_syslog("RejetPrelevement::Create Error payment validation");
} }
@ -264,8 +262,7 @@ class RejetPrelevement
$mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email, '', $trackid); $mailfile = new CMailFile($subject, $sendto, $from, $message, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $this->user->email, '', $trackid);
$result = $mailfile->sendfile(); $result = $mailfile->sendfile();
if ($result) if ($result) {
{
dol_syslog("RejetPrelevement::_send_email email envoye"); dol_syslog("RejetPrelevement::_send_email email envoye");
} else { } else {
dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); dol_syslog("RejetPrelevement::_send_email Erreur envoi email");
@ -308,8 +305,9 @@ class RejetPrelevement
while ($i < $num) while ($i < $num)
{ {
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
if (!$amounts) $arr[$i] = $row[0]; if (!$amounts) {
else { $arr[$i] = $row[0];
} else {
$arr[$i] = array( $arr[$i] = array(
$row[0], $row[0],
$row[1] $row[1]
@ -346,9 +344,9 @@ class RejetPrelevement
{ {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $rowid; $this->id = $rowid;
$this->date_rejet = $this->db->jdate($obj->dr); $this->date_rejet = $this->db->jdate($obj->dr);
$this->motif = $this->motifs[$obj->motif]; $this->motif = $this->motifs[$obj->motif];
$this->invoicing = $this->facturer[$obj->afacturer]; $this->invoicing = $this->facturer[$obj->afacturer];
$this->db->free($resql); $this->db->free($resql);

View File

@ -2192,7 +2192,7 @@ class ExpenseReport extends CommonObject
$modele = $conf->global->EXPENSEREPORT_ADDON_PDF; $modele = $conf->global->EXPENSEREPORT_ADDON_PDF;
} }
} }
if (!empty($modele)) { if (!empty($modele)) {
$modelpath = "core/modules/expensereport/doc/"; $modelpath = "core/modules/expensereport/doc/";