2
0
forked from Wavyzz/dolibarr

New: Add option to exclude some thirdparties

This commit is contained in:
Laurent Destailleur
2013-07-15 18:44:59 +02:00
parent d637212dce
commit 17f3d98fb3
2 changed files with 19 additions and 2 deletions

View File

@@ -43,9 +43,10 @@ require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php');
* @param int $regenerate ''=Use existing PDF files, 'nameofpdf'=Regenerate all PDF files using the template
* @param string $option Suffix to add into file name of generated PDF
* @param string $paymentbankid Only if payment on this bank account id
* @param array $excludethirdpartiesid Exclude thirdparties from select
* @return int Error code
*/
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='')
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $option='', $paymentbankid='', $excludethirdpartiesid='')
{
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
@@ -111,6 +112,12 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 2';
}
if (in_array('excludethirdparties',$filter) && is_array($excludethirdpartiesid))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' f.fk_soc NOT IN ('.join(',',$excludethirdpartiesid).')';
}
if ($sqlwhere) $sql.=$sqlwhere;
if ($sqlorder) $sql.=$sqlorder;