diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 8a232377ab7..6de7d5f1c39 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -102,21 +102,6 @@ if (empty($reshook)) { } } - // Seems to no be used and replaced with $action == 'infocredit' - if ($action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes') { - if ($object->statut == 2) { - $res = -1; - setEventMessages('WithdrawalCantBeCreditedTwice', array(), 'errors'); - } else { - $res = $object->set_credite(); - } - - if ($res >= 0) { - header("Location: card.php?id=".$id); - exit; - } - } - if ($action == 'infotrans' && $user->rights->prelevement->bons->send) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -184,12 +169,6 @@ if ($id > 0 || $ref) { print '
'.$object->getErrorString(GETPOST('error', 'alpha')).'
'; } - /*if ($action == 'credite') - { - print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1); - - }*/ - $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref'); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 25751a50df0..18216c1cda6 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -332,74 +332,6 @@ class BonPrelevement extends CommonObject } } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Set credite and set status of linked invoices. Still used ?? - * - * @return int <0 if KO, >=0 if OK - */ - public function set_credite() - { - // phpcs:enable - global $user, $conf; - - $error = 0; - - if ($this->db->begin()) { - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons"; - $sql .= " SET statut = ".self::STATUS_TRANSFERED; - $sql .= " WHERE rowid = ".((int) $this->id); - $sql .= " AND entity = ".((int) $conf->entity); - - $result = $this->db->query($sql); - if (!$result) { - dol_syslog(get_class($this)."::set_credite Erreur 1"); - $error++; - } - - if (!$error) { - $facs = array(); - $facs = $this->getListInvoices(); - - $num = count($facs); - for ($i = 0; $i < $num; $i++) { - /* Tag invoice as paid */ - dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]); - $fac = new Facture($this->db); - $fac->fetch($facs[$i]); - $result = $fac->setPaid($user); - } - } - - if (!$error) { - $sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes"; - $sql .= " SET statut = 2"; - $sql .= " WHERE fk_prelevement_bons = ".((int) $this->id); - - if (!$this->db->query($sql)) { - dol_syslog(get_class($this)."::set_credite Erreur 1"); - $error++; - } - } - - /* - * End of procedure - */ - if (!$error) { - $this->db->commit(); - return 0; - } else { - $this->db->rollback(); - dol_syslog(get_class($this)."::set_credite ROLLBACK "); - - return -1; - } - } else { - dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible "); - return -2; - } - } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set direct debit or credit transfer order to "paid" status.