Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop

This commit is contained in:
Maxime Kohlhaas 2013-07-14 13:25:20 +02:00
commit 4fd1b5364e
30 changed files with 206 additions and 63 deletions

View File

@ -120,7 +120,7 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->modifier)
{
$accline=new AccountLine($db);
$accline->fetch($_GET["rowid"]);
$result=$accline->fetch(GETPOST("rowid"));
$result=$accline->delete();
}
@ -295,6 +295,14 @@ if ($id > 0 || ! empty($ref))
*/
$param.='&account='.$object->id.'&vline='.$vline;
// Confirmation delete
if ($action == 'delete')
{
$text=$langs->trans('ConfirmDeleteTransaction');
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.GETPOST("rowid"),$langs->trans('DeleteTransaction'),$text,'confirm_delete');
if ($ret == 'html') print '<br>';
}
// Define transaction list navigation string
print '<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -318,16 +326,9 @@ if ($id > 0 || ! empty($ref))
{
$navig.= '<a href="'.$_SERVER["PHP_SELF"].'?'.$param.'&amp;page='.($page-1).'">'.img_next().'</a>';
}
$navig.='</fieldset></div>';
//var_dump($navig);
$navig.='</div>';
// Confirmation delete
if ($action == 'delete')
{
$text=$langs->trans('ConfirmDeleteTransaction');
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete');
if ($ret == 'html') print '<br>';
}
//var_dump($navig);
print '<table class="notopnoleftnoright" width="100%">';

View File

@ -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++;

View File

@ -309,10 +309,10 @@ else
print img_next().'</a>';
print "</td>\n";
// Num cheque
// Type and num
print '<td class="nowrap">'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').'</td>';
// Libelle
// Description
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
$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.

View File

@ -146,7 +146,7 @@ class FormFile
{
print $out;
}
print $hookmanager->resprint;
print $hookmanager->resPrint;
return 1;
}
@ -774,7 +774,7 @@ class FormFile
print '<table width="100%" class="nobordernopadding">';
print '<tr class="liste_titre">';
$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]:''); }

View File

@ -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,

View File

@ -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);
}
?>

View File

@ -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);

View File

@ -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)

View File

@ -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
{

View File

@ -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;

View File

@ -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 '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print "</td></tr>";
// Ref supplier
@ -161,10 +161,10 @@ if ($id > 0 || ! empty($ref))
print '</div>';
print '<br>';
// Contacts lines
include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php';
}
else
{

View File

@ -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 '<tr><td width="30%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref');
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td>';
print "</tr>\n";

View File

@ -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"))
{

View File

@ -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 '<tr><td width="20%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '</td>';
print "</tr>\n";

View File

@ -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);

View File

@ -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';

View File

@ -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

View File

@ -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";

View File

@ -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";

View File

@ -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';

View File

@ -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';

View File

@ -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";

View File

@ -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";

View File

@ -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(

View File

@ -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)

View File

@ -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(

View File

@ -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)

View File

@ -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(

View File

@ -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";

View File

@ -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;
}