Merge branch '12.0' of git@github.com:Dolibarr/dolibarr.git into 13.0
Conflicts: htdocs/compta/paiement/card.php htdocs/compta/paiement/class/paiement.class.php
This commit is contained in:
commit
48a50f3b10
@ -616,6 +616,10 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
if ($arrayquery['options_'.$key] != '') {
|
if ($arrayquery['options_'.$key] != '') {
|
||||||
$sqlwhere[] = " (te.".$key." = ".$arrayquery['options_'.$key].")";
|
$sqlwhere[] = " (te.".$key." = ".$arrayquery['options_'.$key].")";
|
||||||
}
|
}
|
||||||
|
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
|
||||||
|
if ($arrayquery['options_'.$key] > 0) {
|
||||||
|
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (is_array($arrayquery['options_'.$key])) {
|
if (is_array($arrayquery['options_'.$key])) {
|
||||||
$sqlwhere[] = " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
|
$sqlwhere[] = " (te.".$key." IN ('".implode("','", $arrayquery['options_'.$key])."'))";
|
||||||
@ -642,7 +646,6 @@ class AdvanceTargetingMailing extends CommonObject
|
|||||||
if ($num) {
|
if ($num) {
|
||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$obj = $this->db->fetch_object($resql);
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
$this->thirdparty_lines[$i] = $obj->rowid;
|
$this->thirdparty_lines[$i] = $obj->rowid;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
|
|||||||
@ -109,31 +109,74 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
|
|||||||
if ($object->validate($user) > 0)
|
if ($object->validate($user) > 0)
|
||||||
{
|
{
|
||||||
$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
|
||||||
$factures = array();
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
foreach ($factures as $id)
|
$outputlangs = $langs;
|
||||||
{
|
if (!empty($_REQUEST['lang_id']))
|
||||||
$fac = new Facture($db);
|
{
|
||||||
$fac->fetch($id);
|
$outputlangs = new Translate("", $conf);
|
||||||
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
}
|
||||||
|
|
||||||
$outputlangs = $langs;
|
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||||
if (!empty($_REQUEST['lang_id']))
|
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
|
||||||
{
|
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$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';
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
$sql .= ' WHERE pf.fk_facture = f.rowid';
|
||||||
$fac->generateDocument($fac->modelpdf, $outputlangs);
|
$sql .= ' AND f.fk_soc = s.rowid';
|
||||||
}
|
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||||
|
$sql .= ' AND pf.fk_paiement = '.$object->id;
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
$invoice = new Facture($db);
|
||||||
|
|
||||||
|
if ($invoice->fetch($objp->facid) <= 0) {
|
||||||
|
$errors++;
|
||||||
|
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($invoice->generateDocument($fac->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
|
||||||
|
$errors++;
|
||||||
|
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->free($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errors++;
|
||||||
|
setEventMessages($db->error, $db->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
if (! $errors) {
|
||||||
exit;
|
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
$db->rollback();
|
||||||
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$db->rollback();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -423,8 +423,13 @@ class Paiement extends CommonObject
|
|||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
|
||||||
|
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 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
|
||||||
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs);
|
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
setEventMessages($invoice->error, $invoice->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
|||||||
@ -271,7 +271,7 @@ class FormFile
|
|||||||
$out .= "\n</div><!-- End form link new url -->\n";
|
$out .= "\n</div><!-- End form link new url -->\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm);
|
$parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm, 'options'=>$options);
|
||||||
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
|
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
|
||||||
if (empty($res))
|
if (empty($res))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user