diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d57ca4119d2..f4bdc1cb0aa 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2573,7 +2573,6 @@ if ($action == 'create' && $usercancreate) if (($object->statut == Commande::STATUS_VALIDATED || $object->statut == Commande::STATUS_SHIPMENTONPROCESS) && $usercanclose) { print '
'; } - // Create bill and Classify 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) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 70df565cd2b..4a88c324c88 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -745,6 +745,10 @@ class Commande extends CommonOrder if ($usercanclose) { $this->db->begin(); + if ($this->statut == self::STATUS_CLOSED) + { + return 0; + } $now = dol_now(); @@ -2882,6 +2886,10 @@ class Commande extends CommonOrder $error = 0; $this->db->begin(); + if ($this->billed) + { + return 0; + } $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 37a8d682bf8..3f95d18e38b 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -164,21 +164,19 @@ class RejetPrelevement $pai->paiementid = 3; // type of payment: withdrawal $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++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); } else { $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); - if ($result < 0) - { + if ($result < 0) { dol_syslog("RejetPrelevement::Create AddPaymentToBan Error"); $error++; } // Payment validation - if ($pai->validate($user) < 0) - { + if ($pai->validate($user) < 0) { $error++; 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); $result = $mailfile->sendfile(); - if ($result) - { + if ($result) { dol_syslog("RejetPrelevement::_send_email email envoye"); } else { dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); @@ -308,8 +305,9 @@ class RejetPrelevement while ($i < $num) { $row = $this->db->fetch_row($resql); - if (!$amounts) $arr[$i] = $row[0]; - else { + if (!$amounts) { + $arr[$i] = $row[0]; + } else { $arr[$i] = array( $row[0], $row[1] @@ -346,9 +344,9 @@ class RejetPrelevement { $obj = $this->db->fetch_object($resql); - $this->id = $rowid; - $this->date_rejet = $this->db->jdate($obj->dr); - $this->motif = $this->motifs[$obj->motif]; + $this->id = $rowid; + $this->date_rejet = $this->db->jdate($obj->dr); + $this->motif = $this->motifs[$obj->motif]; $this->invoicing = $this->facturer[$obj->afacturer]; $this->db->free($resql); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 817e211e957..d91893223b0 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2192,7 +2192,7 @@ class ExpenseReport extends CommonObject $modele = $conf->global->EXPENSEREPORT_ADDON_PDF; } } - + if (!empty($modele)) { $modelpath = "core/modules/expensereport/doc/";