Remove unused set_credit function

This commit is contained in:
Maxime Kohlhaas 2021-12-28 17:59:41 +01:00
parent 93393b82a3
commit 2237c09d64
2 changed files with 0 additions and 89 deletions

View File

@ -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 '<div class="error">'.$object->getErrorString(GETPOST('error', 'alpha')).'</div>';
}
/*if ($action == 'credite')
{
print $form->formconfirm("card.php?id=".$object->id,$langs->trans("ClassCredited"),$langs->trans("ClassCreditedConfirm"),"confirm_credite",'',1,1);
}*/
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/orders_list.php?restore_lastsearch_values=1'.($object->type != 'bank-transfer' ? '' : '&type=bank-transfer').'">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref');

View File

@ -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.