Fix phpcs
This commit is contained in:
parent
7db74c81be
commit
b1d8ca0701
@ -196,7 +196,6 @@ if ($action == 'create') {
|
|||||||
|
|
||||||
|
|
||||||
if ($id > 0 && !preg_match('/^add/i', $action)) {
|
if ($id > 0 && !preg_match('/^add/i', $action)) {
|
||||||
|
|
||||||
if ($action == 'edit') {
|
if ($action == 'edit') {
|
||||||
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
|
print '<form name="edit" method="POST" action="'.$_SERVER["PHP_SELF"].'" enctype="multipart/form-data">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
|
|||||||
@ -110,61 +110,58 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
// Loop on each invoice linked to this payment to rebuild PDF
|
// Loop on each invoice linked to this payment to rebuild PDF
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
if (GETPOST('lang_id', 'aZ09')) {
|
if (GETPOST('lang_id', 'aZ09')) {
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
|
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||||
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
||||||
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
||||||
|
|
||||||
$sql = 'SELECT f.rowid as facid';
|
$sql = 'SELECT f.rowid as facid';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
|
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||||
$sql .= ' WHERE pf.fk_facture = f.rowid';
|
$sql .= ' WHERE pf.fk_facture = f.rowid';
|
||||||
$sql .= ' AND f.fk_soc = s.rowid';
|
$sql .= ' AND f.fk_soc = s.rowid';
|
||||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||||
$sql .= ' AND pf.fk_paiement = '.$object->id;
|
$sql .= ' AND pf.fk_paiement = '.$object->id;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql) {
|
||||||
{
|
$i = 0;
|
||||||
$i = 0;
|
$num = $db->num_rows($resql);
|
||||||
$num = $db->num_rows($resql);
|
|
||||||
|
|
||||||
if ($num > 0)
|
if ($num > 0) {
|
||||||
{
|
while ($i < $num) {
|
||||||
while ($i < $num)
|
$objp = $db->fetch_object($resql);
|
||||||
{
|
|
||||||
$objp = $db->fetch_object($resql);
|
|
||||||
|
|
||||||
$invoice = new Facture($db);
|
$invoice = new Facture($db);
|
||||||
|
|
||||||
if ($invoice->fetch($objp->facid) <= 0) {
|
if ($invoice->fetch($objp->facid) <= 0) {
|
||||||
$errors++;
|
$errors++;
|
||||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
|
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
|
||||||
$errors++;
|
$errors++;
|
||||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
} else {
|
} else {
|
||||||
$errors++;
|
$errors++;
|
||||||
setEventMessages($db->error, $db->errors, 'errors');
|
setEventMessages($db->error, $db->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $errors) {
|
if (! $errors) {
|
||||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -414,9 +414,9 @@ class Paiement extends CommonObject
|
|||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||||
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
||||||
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
||||||
|
|
||||||
$ret = $invoice->fetch($facid); // Reload to get new records
|
$ret = $invoice->fetch($facid); // Reload to get new records
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user