New: Can exclude deposit, replacement or credit notes in script rebuild_merge_pdf

This commit is contained in:
Laurent Destailleur 2010-09-19 14:06:44 +00:00
parent 5a80ce5141
commit 37f92ad5a1
2 changed files with 50 additions and 2 deletions

View File

@ -3,6 +3,7 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.0 compared to 2.9 *****
For users:
- New: Can exclude deposit, replacement or credit notes in script rebuild_merge_pdf.
- New: task #10473 : Option MAIN_PROFIDx_IN_ADDRESS must no more be hidden.
- New: Can generate business card for on particular member.
- New: Task #10553 : Can attach files on members card.
@ -25,6 +26,7 @@ For users:
- New: Add option to send all emails sent to a bulk carbon copy.
- New: Preview of emails sent by member module is shown.
- New: task #10100 : Add button to create invoice from a subscription
- New: Reorganize tabs on third parties.
- Perf: Avoid reading database to determine country code after each
page call.
- Fix: Better Postgresql compatibility.

View File

@ -84,7 +84,7 @@ foreach ($argv as $key => $value)
if ($value == 'filter=all')
{
$found=true;
$option.='all';
$option.=(empty($option)?'':'_').'all';
$filter[]='all';
print 'Rebuild PDF for all invoices'."\n";
@ -121,6 +121,31 @@ foreach ($argv as $key => $value)
print 'Rebuild PDF for invoices with no payment done yet.'."\n";
}
if ($value == 'filter=nodeposit')
{
$found=true;
$option.=(empty($option)?'':'_').'nodeposit';
$filter[]='nodeposit';
print 'Exclude deposit invoices'."\n";
}
if ($value == 'filter=noreplacement')
{
$found=true;
$option.=(empty($option)?'':'_').'noreplacement';
$filter[]='noreplacement';
print 'Exclude replacement invoices'."\n";
}
if ($value == 'filter=nocreditnote')
{
$found=true;
$option.=(empty($option)?'':'_').'nocreditnote';
$filter[]='nocreditnote';
print 'Exclude credit note invoices'."\n";
}
if (! $found && preg_match('/filter=/i',$value))
{
usage();
@ -181,6 +206,24 @@ if (in_array('payments',$filter))
$sqlwhere.= " AND p.datep <= ".$db->idate($paymentdatebefore);
$sqlorder = " ORDER BY p.datep ASC";
}
if (in_array('nodeposit',$filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 3';
}
if (in_array('noreplacement',$filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 1';
}
if (in_array('nocreditnote',$filter))
{
if (empty($sqlwhere)) $sqlwhere=' WHERE ';
else $sqlwhere.=" AND";
$sqlwhere.=' type <> 2';
}
if ($sqlwhere) $sql.=$sqlwhere;
if ($sqlorder) $sql.=$sqlorder;
@ -346,7 +389,10 @@ function usage()
print "Usage: ".$script_file." filter=all\n";
print "To build/merge PDF for invoices with no payments, use filter=nopayment\n";
print "Usage: ".$script_file." filter=nopayment\n";
print "\n";
print "To exclude credit notes, use filter=nocreditnote\n";
print "To exclude replacement invoices, use filter=noreplacement\n";
print "To exclude deposit invoices, use filter=nodeposit\n";
print "\n";
print "Example: ".$script_file." filter=payments 20080101 20081231 lang=fr_FR\n";
print "Example: ".$script_file." filter=all lang=it_IT\n";
print "\n";