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

Conflicts:
	htdocs/core/class/html.formfile.class.php
This commit is contained in:
Maxime Kohlhaas 2013-07-14 13:27:41 +02:00
commit 9e5286bce9
67 changed files with 252 additions and 111 deletions

View File

@ -119,6 +119,8 @@ For users:
- New: [ task #823 ] Shipping_validate email notification. - New: [ task #823 ] Shipping_validate email notification.
- New: [ task #900 ] Review code of ficheinter.class.php - New: [ task #900 ] Review code of ficheinter.class.php
- Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers - Fix: [Bug #958] LocalTax2 for Spain fails on Suppliers
- Fix: [ bug #972 ] Auto completion contact field do not take account the min caract number before search
- Fix : [ bug #971 ] html.form.class.php select_contact with autocomplete do not exclude id from exclude array
For translators: For translators:
- Update language files. - Update language files.

0
dev/initdata/generate-commande.php Normal file → Executable file
View File

0
dev/initdata/generate-facture.php Normal file → Executable file
View File

0
dev/initdata/generate-produit.php Normal file → Executable file
View File

0
dev/initdata/generate-propale.php Normal file → Executable file
View File

0
dev/initdata/generate-societe.php Normal file → Executable file
View File

View File

@ -126,12 +126,12 @@ print '<br>';
print $langs->trans("NoteOnPathLocation").'<br>'; print $langs->trans("NoteOnPathLocation").'<br>';
$url1='http://www.maxmind.com/app/perl?rId=awstats'; $url1='http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadFreeDatFileTo",'<a href="'.$url1.'" target="_blank">'.$url1.'</a>'); print $langs->trans("YouCanDownloadFreeDatFileTo",'<a href="'.$url1.'" target="_blank">'.$url1.'</a>');
print '<br>'; print '<br>';
$url2='http://www.maxmind.com/app/perl?rId=awstats'; $url2='http://www.maxmind.com/en/city?rId=awstats';
print $langs->trans("YouCanDownloadAdvancedDatFileTo",'<a href="'.$url2.'" target="_blank">'.$url2.'</a>'); print $langs->trans("YouCanDownloadAdvancedDatFileTo",'<a href="'.$url2.'" target="_blank">'.$url2.'</a>');
if ($geoip) if ($geoip)

0
htdocs/admin/pdf.php Executable file → Normal file
View File

0
htdocs/admin/proxy.php Executable file → Normal file
View File

0
htdocs/admin/sms.php Executable file → Normal file
View File

0
htdocs/admin/translation.php Executable file → Normal file
View File

0
htdocs/admin/workflow.php Executable file → Normal file
View File

View File

@ -639,9 +639,9 @@ class Commande extends CommonOrder
$sql.= ", remise_absolue, remise_percent"; $sql.= ", remise_absolue, remise_percent";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ")"; $sql.= ")";
$sql.= " VALUES ('(PROV)',".$this->socid.", ".$this->db->idate($now).", ".$user->id; $sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
$sql.= ", ".($this->fk_project?$this->fk_project:"null"); $sql.= ", ".($this->fk_project?$this->fk_project:"null");
$sql.= ", ".$this->db->idate($date); $sql.= ", '".$this->db->idate($date)."'";
$sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null');
$sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_private)."'";
$sql.= ", '".$this->db->escape($this->note_public)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'";
@ -991,7 +991,7 @@ class Commande extends CommonOrder
$this->fetch($ret); $this->fetch($ret);
$this->valid($user); $this->valid($user);
} }
return 1; return $ret;
} }
else return -1; else return -1;
} }

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

View File

@ -1159,7 +1159,7 @@ class AccountLine extends CommonObject
$this->db->begin(); $this->db->begin();
// Delete urls // Delete urls
$result=$this->delete_urls(); $result=$this->delete_urls($user);
if ($result < 0) if ($result < 0)
{ {
$nbko++; $nbko++;

View File

@ -309,10 +309,10 @@ else
print img_next().'</a>'; print img_next().'</a>';
print "</td>\n"; print "</td>\n";
// Num cheque // Type and num
print '<td class="nowrap">'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').'</td>'; 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.'">'; print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'">';
$reg=array(); $reg=array();
preg_match('/\((.+)\)/i',$objp->label,$reg); // Si texte entoure de parenthese on tente recherche de traduction 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->id=$links[$key]['url_id'];
$paymentvatstatic->ref=$langs->trans("Payment"); $paymentvatstatic->ref=$langs->trans("Payment");
print ' '.$paymentvatstatic->getNomUrl(2); print ' '.$paymentvatstatic->getNomUrl(1);
} }
elseif ($links[$key]['type']=='banktransfert') { 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. // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail.

View File

@ -414,7 +414,6 @@ if ($resql)
print '<td align="right"><b>'.price($total_paid).'</b></td>'; print '<td align="right"><b>'.price($total_paid).'</b></td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
} }

0
htdocs/core/class/CSMSFile.class.php Executable file → Normal file
View File

0
htdocs/core/class/commondocgenerator.class.php Executable file → Normal file
View File

0
htdocs/core/class/extrafields.class.php Executable file → Normal file
View File

0
htdocs/core/class/genericobject.class.php Executable file → Normal file
View File

0
htdocs/core/class/hookmanager.class.php Executable file → Normal file
View File

View File

@ -971,7 +971,7 @@ class Form
if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo && ! $options_only) if ($conf->use_javascript_ajax && $conf->global->CONTACT_USE_SEARCH_TO_SELECT && ! $forcecombo && ! $options_only)
{ {
$out.= ajax_combobox($htmlname, $event); $out.= ajax_combobox($htmlname, $event, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
} }
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">'; if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlname.'" name="'.$htmlname.'">';
@ -2590,6 +2590,7 @@ class Form
$.each(inputok, function(i, inputname) { $.each(inputok, function(i, inputname) {
var more = ""; var more = "";
if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; } if ($("#" + inputname).attr("type") == "checkbox") { more = ":checked"; }
if ($("#" + inputname).attr("type") == "radio") { more = ":checked"; }
var inputvalue = $("#" + inputname + more).val(); var inputvalue = $("#" + inputname + more).val();
if (typeof inputvalue == "undefined") { inputvalue=""; } if (typeof inputvalue == "undefined") { inputvalue=""; }
options += "&" + inputname + "=" + inputvalue; options += "&" + inputname + "=" + inputvalue;

View File

@ -146,7 +146,7 @@ class FormFile
{ {
print $out; print $out;
} }
print $hookmanager->resprint; print $hookmanager->resPrint;
return 1; return 1;
} }
@ -184,8 +184,8 @@ class FormFile
* Return a string to show the box with list of available documents for object. * Return a string to show the box with list of available documents for object.
* This also set the property $this->numoffiles * This also set the property $this->numoffiles
* *
* @param string $modulepart propal, facture, facture_fourn, ... * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule_temp', ...)
* @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) * @param string $filename Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete)
* @param string $filedir Directory to scan * @param string $filedir Directory to scan
* @param string $urlsource Url of origin page (for return) * @param string $urlsource Url of origin page (for return)
* @param int $genallowed Generation is allowed (1/0 or array list of templates) * @param int $genallowed Generation is allowed (1/0 or array list of templates)
@ -200,9 +200,10 @@ class FormFile
* @param string $title Title to show on top of form * @param string $title Title to show on top of form
* @param string $buttonlabel Label on submit button * @param string $buttonlabel Label on submit button
* @param string $codelang Default language code to use on lang combo box if multilang is enabled * @param string $codelang Default language code to use on lang combo box if multilang is enabled
* @param string $morepicto Add more HTML content into cell with picto
* @return string Output string with HTML array of documents (might be empty string) * @return string Output string with HTML array of documents (might be empty string)
*/ */
function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='')
{ {
global $langs,$conf,$hookmanager; global $langs,$conf,$hookmanager;
global $bc; global $bc;
@ -220,7 +221,6 @@ class FormFile
$out=''; $out='';
$var=true; $var=true;
//$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents
$headershown=0; $headershown=0;
$showempty=0; $showempty=0;
$i=0; $i=0;
@ -231,7 +231,7 @@ class FormFile
$out.= "\n".'<!-- Start show_document -->'."\n"; $out.= "\n".'<!-- Start show_document -->'."\n";
//print 'filedir='.$filedir; //print 'filedir='.$filedir;
// Affiche en-tete tableau // Show table
if ($genallowed) if ($genallowed)
{ {
$modellist=array(); $modellist=array();
@ -390,19 +390,6 @@ class FormFile
$buttonlabeltoshow=$buttonlabel; $buttonlabeltoshow=$buttonlabel;
if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate');
// Keep this. Used for test with jmobile
/*print '
<form id="form1" name="form1">
<select id="custom-select2a" name="custom-select2a">
<option value="" data-placeholder="true">Choose One...</option>
<option value="option1">Option #1</option>
<option value="option2">Option #2</option>
<option value="option3">Option #3 - This is a really f fsd f gdfgdgd gd gd gd fgd gd gd fgd fgfdreally really really really long label.</option>
</select>
</form>
';*/
if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">'; if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
$out.= '<input type="hidden" name="action" value="builddoc">'; $out.= '<input type="hidden" name="action" value="builddoc">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -448,7 +435,8 @@ class FormFile
$out.= '</th>'; $out.= '</th>';
// Button // Button
$out.= '<th align="center" colspan="'.($delallowed?'2':'1').'" class="formdocbutton liste_titre">'; $addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th align="center" colspan="'.($addcolumforpicto?'2':'1').'" class="formdocbutton liste_titre">';
$genbutton = '<input class="button" id="'.$forname.'_generatebutton"'; $genbutton = '<input class="button" id="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"'; $genbutton.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled="disabled"'; if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled="disabled"';
@ -462,7 +450,6 @@ class FormFile
$out.= $genbutton; $out.= $genbutton;
$out.= '</th>'; $out.= '</th>';
if ($printer) $out.= '<th></th>';
if($hookmanager->hooks['formfile']) if($hookmanager->hooks['formfile'])
{ {
foreach($hookmanager->hooks['formfile'] as $module) foreach($hookmanager->hooks['formfile'] as $module)
@ -524,22 +511,30 @@ class FormFile
$date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"]));
$out.= '<td align="right" class="nowrap">'.dol_print_date($date, 'dayhour').'</td>'; $out.= '<td align="right" class="nowrap">'.dol_print_date($date, 'dayhour').'</td>';
if ($delallowed) if ($delallowed || $printer || $morepicto)
{ {
$out.= '<td align="right">'; $out.= '<td align="right">';
$out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&file='.urlencode($relativepath); if ($delallowed)
$out.= ($param?'&'.$param:''); {
//$out.= '&modulepart='.$modulepart; // TODO obsolete ? $out.= '<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=remove_file&file='.urlencode($relativepath);
//$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ? $out.= ($param?'&'.$param:'');
$out.= '">'.img_delete().'</a></td>'; //$out.= '&modulepart='.$modulepart; // TODO obsolete ?
} //$out.= '&urlsource='.urlencode($urlsource); // TODO obsolete ?
// Printer Icon $out.= '">'.img_picto($langs->trans("Delete"), 'delete.png').'</a>';
if ($printer) //$out.='</td>';
{ }
$out.= '<td align="right">'; if ($printer)
$out.= '&nbsp;<a href="'.$urlsource.'&action=print_file&amp;printer='.$modulepart.'&amp;file='.urlencode($relativepath); {
$out.= ($param?'&'.$param:''); //$out.= '<td align="right">';
$out.= '">'.img_printer().'</a></td>'; $out.= '&nbsp;<a href="'.$urlsource.(strpos($urlsource,'?')?'&':'?').'action=print_file&amp;printer='.$modulepart.'&amp;file='.urlencode($relativepath);
$out.= ($param?'&'.$param:'');
$out.= '">'.img_picto($langs->trans("Print"),'printer.png').'</a>';
}
if ($morepicto)
{
$out.=$morepicto;
}
$out.='</td>';
} }
if (is_object($hookmanager)) if (is_object($hookmanager))
{ {
@ -779,7 +774,7 @@ class FormFile
print '<table width="100%" class="nobordernopadding">'; print '<table width="100%" class="nobordernopadding">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$sortref="fullname"; $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("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("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
@ -857,7 +852,7 @@ class FormFile
// To show ref or specific information according to view to show (defined by $module) // 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 == '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') { 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 == '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') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); } if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }

0
htdocs/core/class/html.formsms.class.php Executable file → Normal file
View File

0
htdocs/core/class/rssparser.class.php Executable file → Normal file
View File

0
htdocs/core/class/smtps.class.php Executable file → Normal file
View File

0
htdocs/core/class/vcard.class.php Executable file → Normal file
View File

View File

@ -810,7 +810,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
minLength: this.options.minLengthToAutocomplete, minLength: this.options.minLengthToAutocomplete,
source: function( request, response ) { source: function( request, response ) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
response( select.children( "option" ).map(function() { response( select.children( "option:enabled" ).map(function() {
var text = $( this ).text(); var text = $( this ).text();
if ( this.value && ( !request.term || matcher.test(text) ) ) if ( this.value && ( !request.term || matcher.test(text) ) )
return { return {

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 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( $file_list[] = array(
"name" => $file, "name" => $file,
"level1name" => $level1name,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize, "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 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( $file_list[] = array(
"name" => $file, "name" => $file,
"level1name" => $level1name,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize, "size" => $filesize,
@ -1233,7 +1239,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$
/** /**
* Security check when accessing to a document (used by document.php, viewimage.php and webservices) * Security check when accessing to a document (used by document.php, viewimage.php and webservices)
* *
* @param string $modulepart Module of document * @param string $modulepart Module of document (module, module_user_temp, module_user or module_temp)
* @param string $original_file Relative path with filename * @param string $original_file Relative path with filename
* @param string $entity Restrict onto entity * @param string $entity Restrict onto entity
* @param User $fuser User object (forced) * @param User $fuser User object (forced)

View File

@ -1553,4 +1553,31 @@ function pdf_getLinkedObjects($object,$outputlangs)
return $linkedobjects; 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 class pdf_azur extends ModelePDFPropales
{ {
@ -102,6 +102,7 @@ class pdf_azur extends ModelePDFPropales
// Define position of columns // Define position of columns
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
$this->posxpicture=95;
$this->posxtva=111; $this->posxtva=111;
$this->posxup=126; $this->posxup=126;
$this->posxqty=145; $this->posxqty=145;
@ -281,7 +282,15 @@ class pdf_azur extends ModelePDFPropales
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
$pdf->startTransaction(); $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(); $pageposafter=$pdf->getPage();
if ($pageposafter > $pageposbefore) // There is a pagebreak if ($pageposafter > $pageposbefore) // There is a pagebreak
{ {
@ -289,7 +298,15 @@ class pdf_azur extends ModelePDFPropales
$pageposafter=$pageposbefore; $pageposafter=$pageposbefore;
//print $pageposafter.'-'.$pageposbefore;exit; //print $pageposafter.'-'.$pageposbefore;exit;
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $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(); $pageposafter=$pdf->getPage();
$posyafter=$pdf->GetY(); $posyafter=$pdf->GetY();
if ($posyafter > ($this->page_hauteur - ($heightforfooter+$heightforfreetext+$heightforinfotot))) // There is no space left for total+free text 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 $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 // VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) 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 ) 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 ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
@ -776,7 +847,7 @@ class pdf_azur extends ModelePDFPropales
//{ //{
foreach( $this->localtax2 as $localtax_type => $localtax_rate ) 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 ) foreach( $localtax_rate as $tvakey => $tvaval )
{ {
@ -1009,6 +1080,16 @@ class pdf_azur extends ModelePDFPropales
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); $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)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);

View File

View File

View File

View File

View File

View File

@ -63,6 +63,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="fullname"; if (! $sortfield) $sortfield="fullname";
if ($module == 'invoice_supplier' && $sortfield == "fullname") $sortfield="level1name";
$ecmdir = new EcmDirectory($db); $ecmdir = new EcmDirectory($db);
if ($section) if ($section)

0
htdocs/filefunc.inc.php Executable file → Normal file
View File

View File

@ -29,8 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
/** /**
* \class Fournisseur * Class to manage suppliers
* \brief Class to manage suppliers
*/ */
class Fournisseur extends Societe class Fournisseur extends Societe
{ {

View File

@ -120,7 +120,8 @@ class FactureFournisseur extends CommonInvoice
$error=0; $error=0;
$now=dol_now(); $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; if (empty($this->date)) $this->date=$now;
$socid = $this->socid; $socid = $this->socid;

0
htdocs/fourn/commande/index.php Executable file → Normal file
View File

View File

@ -51,7 +51,7 @@ $object = new FactureFournisseur($db);
if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer) if ($action == 'addcontact' && $user->rights->fournisseur->facture->creer)
{ {
$result = $object->fetch($id); $result = $object->fetch($id, $ref);
if ($result > 0 && $id > 0) if ($result > 0 && $id > 0)
{ {
@ -146,7 +146,7 @@ if ($id > 0 || ! empty($ref))
// Reference du facture // Reference du facture
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">'; 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>"; print "</td></tr>";
// Ref supplier // Ref supplier

View File

@ -39,6 +39,7 @@ $langs->load("companies");
$id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int'); $id = GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$ref = GETPOST('ref','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
@ -58,7 +59,7 @@ if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new FactureFournisseur($db); $object = new FactureFournisseur($db);
if ($object->fetch($id)) if ($object->fetch($id, $ref))
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$ref=dol_sanitizeFileName($object->ref); $ref=dol_sanitizeFileName($object->ref);
@ -130,7 +131,7 @@ if ($object->id > 0)
// Ref // Ref
print '<tr><td width="30%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; 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 '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -73,7 +73,7 @@ if ($mode == 'search')
if ($modesearch == 'soc') if ($modesearch == 'soc')
{ {
$sql = "SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s "; $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).")"; $sql.= " AND s.entity IN (".getEntity('societe', 1).")";
} }
@ -127,7 +127,8 @@ if (GETPOST('filtre'))
if (GETPOST("search_ref")) 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")) 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'); $result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$object = new FactureFournisseur($db); $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 * View
*/ */
$form = new Form($db); $form = new Form($db);
llxHeader(); llxHeader();
if ($id) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
@ -92,7 +92,7 @@ if ($id)
// Ref // Ref
print '<tr><td width="20%" class="nowrap">'.$langs->trans("Ref").'</td><td colspan="3">'; 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 '</td>';
print "</tr>\n"; print "</tr>\n";

View File

@ -83,6 +83,7 @@ if (! empty($dolibarr_main_document_root_alt))
print "Should found something like following examples:<br>\n"; print "Should found something like following examples:<br>\n";
print "\"/extensions\"<br>\n"; print "\"/extensions\"<br>\n";
print "\"/extensions1,/extensions2,...\"<br>\n"; print "\"/extensions1,/extensions2,...\"<br>\n";
print "\"/../extensions\"<br>\n";
print "\"/custom\"<br>\n"; print "\"/custom\"<br>\n";
exit; exit;
} }

View File

@ -250,9 +250,9 @@ $sandboxpaypalurl='developer.paypal.com';
print '<div id="apidoc">'; print '<div id="apidoc">';
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.<br> 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.<br>
1. Log in to your PayPal Premier or Business account (on real paypal <a href="https://'.$realpaypalurl.'" target="_blank">'.$realpaypalurl.'</a> (or sandbox <a href="https://'.$sandboxpaypalurl.'" target="_blank">'.$sandboxpaypalurl.'</a>).<br> 1. Log in to your PayPal account (on real paypal <a href="https://'.$realpaypalurl.'" target="_blank">'.$realpaypalurl.'</a> (or sandbox <a href="https://'.$sandboxpaypalurl.'" target="_blank">'.$sandboxpaypalurl.'</a>).<br>
2. Click the Profile subtab located under the My Account heading.<br> 2. Click the "Profile" or "Preferencies" subtab located under the My Account heading.<br>
3. Click the API Access link under the Account Information header.<br> 3. Click the link "API Access".<br>
4. Click the View API Certificate link in the right column.<br> 4. Click the View API Certificate link in the right column.<br>
5. Click the Request API signature radio button on the Request API Credentials page.<br> 5. Click the Request API signature radio button on the Request API Credentials page.<br>
6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.<br> 6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.<br>

View File

@ -60,9 +60,10 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[3]) || ! $argv[3]) { 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); exit(-1);
} }
$bankref=$argv[1]; $bankref=$argv[1];
@ -172,26 +173,31 @@ $array_export_TypeFields=array(
); );
// Recherche les ecritures pour le releve // Build request to find records for a bank account/receipt
$listofnum="'"; $listofnum="";
$arraynum=explode(',',$num); if (! empty($num) && $num != "all")
foreach($arraynum as $val)
{ {
if ($listofnum != "'") $listofnum.="','"; $listofnum.="'";
$listofnum.=$val; $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 = "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.= " 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.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.num_releve IN (".$listofnum.")"; $sql.= " WHERE b.fk_account = ".$acct->id;
if (!isset($num)) $sql.= " OR b.num_releve is null"; if ($listofnum) $sql.= " AND b.num_releve IN (".$listofnum.")";
$sql.= " AND b.fk_account = ".$acct->id; if (!isset($num)) $sql.= " OR b.num_releve is null";
$sql.= " AND b.fk_account = ba.rowid"; $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 $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; //print $sql;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -401,7 +407,6 @@ if ($resql)
$rec->accountelem=$accountelem; $rec->accountelem=$accountelem;
$rec->debit=$debit; $rec->debit=$debit;
$rec->credit=$credit; $rec->credit=$credit;
$rec->sold=$sold;
$rec->comment=$comment; $rec->comment=$comment;
$rec->soldbefore=price2num($totalbefore); $rec->soldbefore=price2num($totalbefore);
$rec->soldafter=price2num($total); $rec->soldafter=price2num($total);

View File

@ -60,6 +60,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$fname = DOL_DATA_ROOT.'/export-contacts.xls'; $fname = DOL_DATA_ROOT.'/export-contacts.xls';

View File

@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; 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"; print "Mails sending disabled (useless in batch mode)\n";
$conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails $conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -67,6 +67,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[3])?$argv[3]:'none'; $duration_value=isset($argv[3])?$argv[3]:'none';

View File

@ -66,6 +66,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
$now=dol_now('tzserver'); $now=dol_now('tzserver');
$duration_value=isset($argv[2])?$argv[2]:'none'; $duration_value=isset($argv[2])?$argv[2]:'none';

View File

@ -57,6 +57,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// Check parameters // Check parameters
if (! isset($argv[1])) if (! isset($argv[1]))
@ -124,7 +125,7 @@ foreach ($argv as $key => $value)
$paymentdatebefore=dol_stringtotime($argv[$key+2]); $paymentdatebefore=dol_stringtotime($argv[$key+2]);
if (empty($paymentdateafter) || empty($paymentdatebefore)) if (empty($paymentdateafter) || empty($paymentdatebefore))
{ {
print 'Error: Bad date format'."\n"; print 'Error: Bad date format or value'."\n";
exit(-1); 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"; 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); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
if (! isset($argv[1]) || ! $argv[1]) { if (! isset($argv[1]) || ! $argv[1]) {
print "Usage: $script_file now\n"; print "Usage: $script_file now\n";

View File

@ -57,6 +57,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
/* /*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE) if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -57,7 +57,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -55,6 +55,7 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
/* /*
if (! $conf->global->LDAP_SYNCHRO_ACTIVE) if (! $conf->global->LDAP_SYNCHRO_ACTIVE)

View File

@ -55,6 +55,7 @@ $forcecommit=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',',$argv));
// List of fields to get from LDAP // List of fields to get from LDAP
$required_fields = array( $required_fields = array(

View File

@ -51,8 +51,9 @@ $error=0;
@set_time_limit(0); @set_time_limit(0);
print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; 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); $month = strftime("%m", $datetimeprev);
$year = strftime("%Y", $datetimeprev); $year = strftime("%Y", $datetimeprev);
@ -60,8 +61,6 @@ $year = strftime("%Y", $datetimeprev);
$user = new user($db); $user = new user($db);
$user->fetch($conf->global->PRELEVEMENT_USER); $user->fetch($conf->global->PRELEVEMENT_USER);
print "***** ".$script_file." (".$version.") *****\n";
if (! isset($argv[1])) { // Check parameters if (! isset($argv[1])) { // Check parameters
print "This script check invoices with a withdrawal request and\n"; print "This script check invoices with a withdrawal request and\n";
print "then create payment and build a withdraw file.\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; $langs=$this->savlangs;
$db=$this->savdb; $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); $result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result); $this->assertEquals(7200,$result);
@ -321,11 +335,6 @@ class DateLibTest extends PHPUnit_Framework_TestCase
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
$this->assertEquals(7200,$result); $this->assertEquals(7200,$result);
$stime='19700101';
$result=dol_stringtotime($stime);
print __METHOD__." result=".$result."\n";
$this->assertEquals(0,$result);
return $result; return $result;
} }