';
print 'Your API authentication information can be found with following steps. We recommend that you open a separate Web browser session when carrying out this procedure.
-1. Log in to your PayPal Premier or Business account (on real paypal
'.$realpaypalurl.' (or sandbox
'.$sandboxpaypalurl.').
-2. Click the Profile subtab located under the My Account heading.
-3. Click the API Access link under the Account Information header.
+1. Log in to your PayPal account (on real paypal
'.$realpaypalurl.' (or sandbox
'.$sandboxpaypalurl.').
+2. Click the "Profile" or "Preferencies" subtab located under the My Account heading.
+3. Click the link "API Access".
4. Click the View API Certificate link in the right column.
5. Click the Request API signature radio button on the Request API Credentials page.
6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.
diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php
index 18aa26b8246..00a193efd29 100755
--- a/scripts/bank/export-bank-receipts.php
+++ b/scripts/bank/export-bank-receipts.php
@@ -60,9 +60,10 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[3]) || ! $argv[3]) {
- print "Usage: ".$script_file." bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
+ print "Usage: ".$script_file." bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n";
exit(-1);
}
$bankref=$argv[1];
@@ -172,26 +173,31 @@ $array_export_TypeFields=array(
);
-// Recherche les ecritures pour le releve
-$listofnum="'";
-$arraynum=explode(',',$num);
-foreach($arraynum as $val)
+// Build request to find records for a bank account/receipt
+$listofnum="";
+if (! empty($num) && $num != "all")
{
- if ($listofnum != "'") $listofnum.="','";
- $listofnum.=$val;
+ $listofnum.="'";
+ $arraynum=explode(',',$num);
+ foreach($arraynum as $val)
+ {
+ if ($listofnum != "'") $listofnum.="','";
+ $listofnum.=$val;
+ }
+ $listofnum.="'";
}
-$listofnum.="'";
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,";
$sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,";
$sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b";
-$sql.= " WHERE b.num_releve IN (".$listofnum.")";
-if (!isset($num)) $sql.= " OR b.num_releve is null";
-$sql.= " AND b.fk_account = ".$acct->id;
+$sql.= " WHERE b.fk_account = ".$acct->id;
+if ($listofnum) $sql.= " AND b.num_releve IN (".$listofnum.")";
+if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ba.rowid";
$sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
//print $sql;
+
$resql=$db->query($sql);
if ($resql)
{
@@ -401,7 +407,6 @@ if ($resql)
$rec->accountelem=$accountelem;
$rec->debit=$debit;
$rec->credit=$credit;
- $rec->sold=$sold;
$rec->comment=$comment;
$rec->soldbefore=price2num($totalbefore);
$rec->soldafter=price2num($total);
diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php
index 5e7b6404994..55c1b04b400 100644
--- a/scripts/company/export-contacts-xls-example.php
+++ b/scripts/company/export-contacts-xls-example.php
@@ -60,6 +60,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
$fname = DOL_DATA_ROOT.'/export-contacts.xls';
diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php
index edede8d3ba2..d4e6f9e7ca5 100644
--- a/scripts/company/sync_contacts_dolibarr2ldap.php
+++ b/scripts/company/sync_contacts_dolibarr2ldap.php
@@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails
diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php
index 96e97e13771..9753599115c 100755
--- a/scripts/contracts/email_expire_services_to_customers.php
+++ b/scripts/contracts/email_expire_services_to_customers.php
@@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none';
@@ -130,7 +131,7 @@ if ($resql)
$outputlangs->load("bills");
$outputlangs->load("main");
$outputlangs->load("contracts");
-
+
if (dol_strlen($oldemail))
{
$message .= $langs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".$obj->label." (".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)."), ".$langs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite),'day')."\n\n";
diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php
index 08d068685e3..a41a59de3cf 100755
--- a/scripts/contracts/email_expire_services_to_representatives.php
+++ b/scripts/contracts/email_expire_services_to_representatives.php
@@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none';
@@ -130,7 +131,7 @@ if ($resql)
$outputlangs->setDefaultLang(empty($obj->lang)?$langs->defaultlang:$obj->lang); // By default language of sale representative
$outputlangs->load("bills");
$outputlangs->load("main");
-
+
if (dol_strlen($obj->email))
{
$message .= $langs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".$obj->label." (".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency).") ".$obj->nom.", ".$langs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite),'day')."\n\n";
diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php
index 487c346b732..fbd7bf7b466 100755
--- a/scripts/invoices/email_unpaid_invoices_to_customers.php
+++ b/scripts/invoices/email_unpaid_invoices_to_customers.php
@@ -67,6 +67,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver');
$duration_value=isset($argv[3])?$argv[3]:'none';
diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php
index 67247db7e8a..e3b23a932d5 100755
--- a/scripts/invoices/email_unpaid_invoices_to_representatives.php
+++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php
@@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none';
diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php
index eeb5407b37b..2bba8666e0c 100755
--- a/scripts/invoices/rebuild_merge_pdf.php
+++ b/scripts/invoices/rebuild_merge_pdf.php
@@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
// Check parameters
if (! isset($argv[1]))
@@ -124,7 +125,7 @@ foreach ($argv as $key => $value)
$paymentdatebefore=dol_stringtotime($argv[$key+2]);
if (empty($paymentdateafter) || empty($paymentdatebefore))
{
- print 'Error: Bad date format'."\n";
+ print 'Error: Bad date format or value'."\n";
exit(-1);
}
print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n";
diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php
index 31df696aedf..840cf464ba2 100755
--- a/scripts/members/sync_members_dolibarr2ldap.php
+++ b/scripts/members/sync_members_dolibarr2ldap.php
@@ -52,6 +52,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[1]) || ! $argv[1]) {
print "Usage: $script_file now\n";
diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php
index 52735e2a30e..83dfd196ae0 100755
--- a/scripts/members/sync_members_ldap2dolibarr.php
+++ b/scripts/members/sync_members_ldap2dolibarr.php
@@ -57,6 +57,7 @@ $forcecommit=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP
$required_fields = array(
diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php
index 5ecb9ee2097..c6793212032 100755
--- a/scripts/user/sync_groups_dolibarr2ldap.php
+++ b/scripts/user/sync_groups_dolibarr2ldap.php
@@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
/*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE)
diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php
index ae8690e3996..485f0dbf72a 100755
--- a/scripts/user/sync_groups_ldap2dolibarr.php
+++ b/scripts/user/sync_groups_ldap2dolibarr.php
@@ -57,7 +57,7 @@ $forcecommit=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
-
+dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP
$required_fields = array(
diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php
index 9f2dfe5d53b..9fcd3bc40dc 100755
--- a/scripts/user/sync_users_dolibarr2ldap.php
+++ b/scripts/user/sync_users_dolibarr2ldap.php
@@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
/*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE)
diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php
index 44ead523fd6..8e831e26e84 100755
--- a/scripts/user/sync_users_ldap2dolibarr.php
+++ b/scripts/user/sync_users_ldap2dolibarr.php
@@ -55,6 +55,7 @@ $forcecommit=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP
$required_fields = array(
diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php
index 2db617e8405..a842aeb1f1b 100644
--- a/scripts/withdrawals/build_withdrawal_file.php
+++ b/scripts/withdrawals/build_withdrawal_file.php
@@ -51,8 +51,9 @@ $error=0;
@set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
+dol_syslog($script_file." launched with arg ".join(',',$argv));
-$datetimeprev = time();
+$datetimeprev = dol_now();
$month = strftime("%m", $datetimeprev);
$year = strftime("%Y", $datetimeprev);
@@ -60,8 +61,6 @@ $year = strftime("%Y", $datetimeprev);
$user = new user($db);
$user->fetch($conf->global->PRELEVEMENT_USER);
-
-print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1])) { // Check parameters
print "This script check invoices with a withdrawal request and\n";
print "then create payment and build a withdraw file.\n";
diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php
index 5b2dba2dd22..eb3fa40f98d 100644
--- a/test/phpunit/DateLibTest.php
+++ b/test/phpunit/DateLibTest.php
@@ -301,7 +301,21 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$langs=$this->savlangs;
$db=$this->savdb;
- $stime='1970-01-01T02:00:00Z';
+ $conf->global->MAIN_OLD_DATE=1;
+
+ $stime='19700102';
+ $result=dol_stringtotime($stime);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals(86400,$result);
+
+ $conf->global->MAIN_OLD_DATE=0;
+
+ $stime='19700102';
+ $result=dol_stringtotime($stime);
+ print __METHOD__." result=".$result."\n";
+ $this->assertEquals(86400,$result);
+
+ $stime='1970-01-01T02:00:00Z';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result);
@@ -310,7 +324,7 @@ class DateLibTest extends PHPUnit_Framework_TestCase
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result);
-
+
$stime='19700101T020000Z';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
@@ -321,11 +335,6 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result);
- $stime='19700101';
- $result=dol_stringtotime($stime);
- print __METHOD__." result=".$result."\n";
- $this->assertEquals(0,$result);
-
return $result;
}