';
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 01ec205564a..7db4831c294 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -1159,7 +1159,7 @@ class AccountLine extends CommonObject
$this->db->begin();
// Delete urls
- $result=$this->delete_urls();
+ $result=$this->delete_urls($user);
if ($result < 0)
{
$nbko++;
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index c76e35a5ed8..4c04655ae65 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -309,10 +309,10 @@ else
print img_next().'';
print "\n";
- // Num cheque
+ // Type and num
print '| '.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').' | ';
- // Libelle
+ // Description
print '';
$reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction
@@ -355,7 +355,7 @@ else
{
$paymentvatstatic->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$langs->trans("Payment");
- print ' '.$paymentvatstatic->getNomUrl(2);
+ print ' '.$paymentvatstatic->getNomUrl(1);
}
elseif ($links[$key]['type']=='banktransfert') {
// Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 533472e5acd..a29b4d53ddf 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -146,7 +146,7 @@ class FormFile
{
print $out;
}
- print $hookmanager->resprint;
+ print $hookmanager->resPrint;
return 1;
}
@@ -774,7 +774,7 @@ class FormFile
print '';
print '';
$sortref="fullname";
- if ($modulepart == 'invoice_supplier') $sortref=''; // No sort for supplier invoices as path name is not
+ if ($modulepart == 'invoice_supplier') $sortref='level1name';
print_liste_field_titre($langs->trans("Ref"),$url,$sortref,"",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
@@ -852,7 +852,7 @@ class FormFile
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'invoice_supplier') { preg_match('/(\d+)\/[^\/]+$/',$relativefile,$reg); $id=(isset($reg[1])?$reg[1]:''); }
+ if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index e76705a1690..3e726a67c60 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -135,8 +135,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file
{
+ preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg);
+ $level1name=(isset($reg[1])?$reg[1]:'');
$file_list[] = array(
"name" => $file,
+ "level1name" => $level1name,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
@@ -159,8 +162,11 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file
{
+ preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg);
+ $level1name=(isset($reg[1])?$reg[1]:'');
$file_list[] = array(
"name" => $file,
+ "level1name" => $level1name,
"fullname" => $path.'/'.$file,
"date" => $filedate,
"size" => $filesize,
diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php
index d6d135edc4a..61d247ff2c2 100644
--- a/htdocs/core/lib/pdf.lib.php
+++ b/htdocs/core/lib/pdf.lib.php
@@ -1553,4 +1553,31 @@ function pdf_getLinkedObjects($object,$outputlangs)
return $linkedobjects;
}
+/**
+ * Return dimensions to use for images onto PDF
+ *
+ * @param string $realpath Full path to photo file to use
+ * @return array Height/Width to use to output image (in pixel)
+ */
+function pdf_getHeightForImage($realpath)
+{
+ $maxheight=12; $maxwidth=16;
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
+ $tmp=dol_getImageSize($realpath);
+ if ($tmp['height'])
+ {
+ $width=(int) round($maxheight*$tmp['width']/$tmp['height']);
+ if ($width > $maxwidth)
+ {
+ $height=(int) round($height*$maxwidth/$width);
+ $width=$maxwidth;
+ }
+ else
+ {
+ $height=$maxheight;
+ }
+ }
+ return array('width'=>$width,'height'=>$height);
+}
+
?>
diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
index 772e7599568..caeb4c3be1d 100644
--- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php
+++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php
@@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
/**
- * Classe permettant de generer les propales au modele Azur
+ * Class to generate PDF proposal Azur
*/
class pdf_azur extends ModelePDFPropales
{
@@ -102,6 +102,7 @@ class pdf_azur extends ModelePDFPropales
// Define position of columns
$this->posxdesc=$this->marge_gauche+1;
+ $this->posxpicture=95;
$this->posxtva=111;
$this->posxup=126;
$this->posxqty=145;
@@ -281,7 +282,15 @@ class pdf_azur extends ModelePDFPropales
$showpricebeforepagebreak=1;
$pdf->startTransaction();
- pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
+ {
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
+ }
+ else
+ {
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
+ }
+
$pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak
{
@@ -289,7 +298,15 @@ class pdf_azur extends ModelePDFPropales
$pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
- pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,$hideref,$hidedesc);
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
+ {
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
+ }
+ else
+ {
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
+ }
+
$pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text
@@ -326,6 +343,60 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
+ // Photo
+ if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
+ {
+ $curX = $this->posxpicture-1;
+ if ($object->lines[$i]->fk_product)
+ {
+ $objphoto = new Product($this->db);
+ $objphoto->fetch($object->lines[$i]->fk_product);
+
+ $pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
+ $dir = $conf->product->dir_output.'/'.$pdir;
+
+ $realpath='';
+ if ($object->ref == 'SPECIMEN')
+ {
+ $realpath = DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg';
+ }
+ else
+ {
+ foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
+ {
+ if ($obj['photo_vignette'])
+ {
+ $filename='thumbs/'.$obj['photo_vignette'];
+ }
+ else
+ {
+ $filename=$obj['photo'];
+ }
+
+ $realpath = $dir.$filename;
+ break;
+ }
+ }
+
+ if (!empty($realpath))
+ {
+ //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+ $tmp=pdf_getHeightForImage($realpath);
+ //var_dump(constant('PDF_IMAGE_SCALE_RATIO'));var_dump($pdf->getImageScale());var_dump($tmp['width']);var_dump($pdf->pixelsToUnits($tmp['width']));exit;
+ // measures 1/72 of an inch, i.e. approximately 0.0139 inch or 25.4/72 = 0.3528 mm
+ var_dump($this->page_largeur);exit;
+ //var_dump(tmp['height']);exit;
+ $pdf->Line($this->posxtva,10,$this->posxtva+0.5,10);
+ $pdf->Image($realpath, $this->posxtva, 10, $tmp['width'], $tmp['height'],'','','',2,0); // Use 300 dpi
+ $pdf->Line($this->posxtva+$pdf->pixelsToUnits($tmp['width']),10,$this->posxtva+$pdf->pixelsToUnits($tmp['width'])+0.5,10);
+ $pdf->Image($realpath, $curX + ($this->posxtva-$this->posxpicture-($pdf->pixelsToUnits($tmp['width'])))/2, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi
+ //$nexY += 7; // +7 for height = 12
+ $nexY += round($pdf->pixelsToUnits($tmp['height']));
+ //var_dump($nexY);exit;
+ }
+ }
+ }
+
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
@@ -744,7 +815,7 @@ class pdf_azur extends ModelePDFPropales
//{
foreach( $this->localtax1 as $localtax_type => $localtax_rate )
{
- if (in_array((string) $localtax_type, array('1','3','5','7'))) continue;
+ if (in_array((string) $localtax_type, array('1','3','5'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
@@ -776,7 +847,7 @@ class pdf_azur extends ModelePDFPropales
//{
foreach( $this->localtax2 as $localtax_type => $localtax_rate )
{
- if (in_array((string) $localtax_type, array('1','3','5','7'))) continue;
+ if (in_array((string) $localtax_type, array('1','3','5'))) continue;
foreach( $localtax_rate as $tvakey => $tvaval )
{
@@ -1009,6 +1080,16 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
}
+ if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
+ {
+ $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height);
+ if (empty($hidetop))
+ {
+ $pdf->SetXY($this->posxpicture-1, $tab_top+1);
+ $pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
+ }
+ }
+
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index c671fa2e29b..bb8844eafc6 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -63,6 +63,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="fullname";
+if ($module == 'invoice_supplier' && $sortfield == "fullname") $sortfield="level1name";
$ecmdir = new EcmDirectory($db);
if ($section)
diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php
index 708f75a9b2a..5440b11e874 100644
--- a/htdocs/fourn/class/fournisseur.class.php
+++ b/htdocs/fourn/class/fournisseur.class.php
@@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
/**
- * \class Fournisseur
- * \brief Class to manage suppliers
+ * Class to manage suppliers
*/
class Fournisseur extends Societe
{
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index e62832ec692..246c3231012 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -120,7 +120,8 @@ class FactureFournisseur extends CommonInvoice
$error=0;
$now=dol_now();
- // Clear parameters
+ // Clean parameters
+ if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (empty($this->date)) $this->date=$now;
$socid = $this->socid;
diff --git a/htdocs/fourn/facture/contact.php b/htdocs/fourn/facture/contact.php
index c96018c4d33..004e5cbb648 100644
--- a/htdocs/fourn/facture/contact.php
+++ b/htdocs/fourn/facture/contact.php
@@ -51,7 +51,7 @@ $object = new FactureFournisseur($db);
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
{
- $result = $object->fetch($id);
+ $result = $object->fetch($id, $ref);
if ($result > 0 && $id > 0)
{
@@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref))
// Reference du facture
print ' | '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print " | ";
// Ref supplier
@@ -161,10 +161,10 @@ if ($id > 0 || ! empty($ref))
print '';
print ' ';
-
+
// Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
-
+
}
else
{
diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php
index 494b5cf23e6..a8fceb2a998 100644
--- a/htdocs/fourn/facture/document.php
+++ b/htdocs/fourn/facture/document.php
@@ -39,6 +39,7 @@ $langs->load("companies");
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
$action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha');
+$ref = GETPOST('ref','alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
@@ -58,7 +59,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new FactureFournisseur($db);
-if ($object->fetch($id))
+if ($object->fetch($id, $ref))
{
$object->fetch_thirdparty();
$ref=dol_sanitizeFileName($object->ref);
@@ -130,7 +131,7 @@ if ($object->id > 0)
// Ref
print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref');
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print ' | ';
print " \n";
diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php
index 80b76772f09..540cbebea12 100644
--- a/htdocs/fourn/facture/index.php
+++ b/htdocs/fourn/facture/index.php
@@ -73,7 +73,7 @@ if ($mode == 'search')
if ($modesearch == 'soc')
{
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s ";
- $sql.= " WHERE s.nom LIKE '%".$db->escape(strtolower($socname))."%'";
+ $sql.= " WHERE s.nom LIKE '%".$db->escape($socname)."%'";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
}
@@ -127,7 +127,8 @@ if (GETPOST('filtre'))
if (GETPOST("search_ref"))
{
- $sql .= " AND fac.rowid = ".$db->escape(GETPOST("search_ref"));
+ if (is_numeric(GETPOST("search_ref"))) $sql .= " AND (fac.rowid = ".GETPOST("search_ref",'int')." OR fac.ref = '".$db->escape(GETPOST("search_ref"))."')"; // For backward compatibility
+ else $sql .= " AND fac.ref LIKE '%".$db->escape(GETPOST("search_ref"))."%'";
}
if (GETPOST("search_ref_supplier"))
{
diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php
index a866407a82a..d1143966010 100644
--- a/htdocs/fourn/facture/note.php
+++ b/htdocs/fourn/facture/note.php
@@ -41,7 +41,7 @@ if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db);
-$object->fetch($id,$ref);
+$object->fetch($id, $ref);
@@ -71,13 +71,13 @@ if ($action == 'setlabel' && $user->rights->fournisseur->facture->creer)
/*
* View
-*/
+ */
$form = new Form($db);
llxHeader();
-if ($id)
+if ($object->id > 0)
{
$object->fetch_thirdparty();
@@ -92,7 +92,7 @@ if ($id)
// Ref
print '| '.$langs->trans("Ref").' | ';
- print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
+ print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print ' | ';
print " \n";
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;
}
|