diff --git a/ChangeLog b/ChangeLog index 8a61005c097..8f2b10398e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -119,6 +119,8 @@ For users: - New: [ task #823 ] Shipping_validate email notification. - New: [ task #900 ] Review code of ficheinter.class.php - 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: - Update language files. diff --git a/build/debian/control b/build/debian/control index d88e31cbc3f..8810a7d189c 100755 --- a/build/debian/control +++ b/build/debian/control @@ -59,4 +59,4 @@ Description: Web based software to manage a small company or foundation PDF exports, And a lot of more modules... . - You can also add third parties external modules or develop yours. \ No newline at end of file + You can also add third parties external modules or develop yours. diff --git a/dev/initdata/generate-commande.php b/dev/initdata/generate-commande.php old mode 100644 new mode 100755 diff --git a/dev/initdata/generate-facture.php b/dev/initdata/generate-facture.php old mode 100644 new mode 100755 diff --git a/dev/initdata/generate-produit.php b/dev/initdata/generate-produit.php old mode 100644 new mode 100755 diff --git a/dev/initdata/generate-propale.php b/dev/initdata/generate-propale.php old mode 100644 new mode 100755 diff --git a/dev/initdata/generate-societe.php b/dev/initdata/generate-societe.php old mode 100644 new mode 100755 diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index df082ed4881..fd7704c2858 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -126,12 +126,12 @@ print '
'; print $langs->trans("NoteOnPathLocation").'
'; -$url1='http://www.maxmind.com/app/perl?rId=awstats'; +$url1='http://www.maxmind.com/en/city?rId=awstats'; print $langs->trans("YouCanDownloadFreeDatFileTo",''.$url1.''); print '
'; -$url2='http://www.maxmind.com/app/perl?rId=awstats'; +$url2='http://www.maxmind.com/en/city?rId=awstats'; print $langs->trans("YouCanDownloadAdvancedDatFileTo",''.$url2.''); if ($geoip) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php old mode 100755 new mode 100644 diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php old mode 100755 new mode 100644 diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php old mode 100755 new mode 100644 diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php old mode 100755 new mode 100644 diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php old mode 100755 new mode 100644 diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 62651cd4067..5a4ba72be04 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -639,9 +639,9 @@ class Commande extends CommonOrder $sql.= ", remise_absolue, remise_percent"; $sql.= ", entity"; $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->db->idate($date); + $sql.= ", '".$this->db->idate($date)."'"; $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; @@ -991,7 +991,7 @@ class Commande extends CommonOrder $this->fetch($ret); $this->valid($user); } - return 1; + return $ret; } else return -1; } diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index ac36247fdba..5351a3f5e7b 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -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 '
'; + } + // Define transaction list navigation string print '
'; print ''; @@ -318,16 +326,9 @@ if ($id > 0 || ! empty($ref)) { $navig.= ''.img_next().''; } - $navig.=''; - //var_dump($navig); + $navig.=''; - // Confirmation delete - if ($action == 'delete') - { - $text=$langs->trans('ConfirmDeleteTransaction'); - $ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&rowid='.$_GET["rowid"],$langs->trans('DeleteTransaction'),$text,'confirm_delete'); - if ($ret == 'html') print '
'; - } + //var_dump($navig); print ''; 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 ''; - // Libelle + // Description print ''; print ''; print ''; - print ''; print "\n"; } diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/genericobject.class.php b/htdocs/core/class/genericobject.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9a7d798cc4e..c913a06be06 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -971,7 +971,7 @@ class Form 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.= ' - - - - - - -';*/ - if (empty($noform)) $out.= ''; $out.= ''; $out.= ''; @@ -448,7 +435,8 @@ class FormFile $out.= ''; // Button - $out.= ''; - if ($delallowed) + if ($delallowed || $printer || $morepicto) { $out.= ''; - } - // Printer Icon - if ($printer) - { - $out.= ''; + if ($delallowed) + { + $out.= ''.img_picto($langs->trans("Delete"), 'delete.png').''; + //$out.=''; + } + if ($printer) + { + //$out.= ''; } if (is_object($hookmanager)) { @@ -779,7 +774,7 @@ class FormFile print '
'.$objp->fk_type.' '.($objp->num_chq?$objp->num_chq:'').''; $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/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index 1d7fda3934f..470dfa56ba3 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -414,7 +414,6 @@ if ($resql) print ''.price($total_paid).'   
'; + $addcolumforpicto=($delallowed || $printer || $morepicto); + $out.= ''; $genbutton = 'hooks['formfile']) { foreach($hookmanager->hooks['formfile'] as $module) @@ -524,22 +511,30 @@ class FormFile $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); $out.= ''.dol_print_date($date, 'dayhour').''; - $out.= ''.img_delete().''; - $out.= ' '.img_printer().''; + $out.= ' '.img_picto($langs->trans("Print"),'printer.png').''; + } + if ($morepicto) + { + $out.=$morepicto; + } + $out.='
'; 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); @@ -857,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]:''); } @@ -956,4 +951,4 @@ class FormFile } -?> +?> \ No newline at end of file diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/js/lib_head.js b/htdocs/core/js/lib_head.js index 071034b5fcc..4d088081725 100644 --- a/htdocs/core/js/lib_head.js +++ b/htdocs/core/js/lib_head.js @@ -810,7 +810,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton, minLength: this.options.minLengthToAutocomplete, source: function( request, response ) { 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(); if ( this.value && ( !request.term || matcher.test(text) ) ) return { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 02cb6e663e2..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, @@ -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) * - * @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 $entity Restrict onto entity * @param User $fuser User object (forced) 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/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php b/htdocs/core/triggers/interface_20_modPaypal_PaypalWorkflow.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php old mode 100755 new mode 100644 diff --git a/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN b/htdocs/core/triggers/interface_90_all_Demo.class.php-NORUN old mode 100755 new mode 100644 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/filefunc.inc.php b/htdocs/filefunc.inc.php old mode 100755 new mode 100644 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/commande/index.php b/htdocs/fourn/commande/index.php old mode 100755 new mode 100644 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 '"; // 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 ''; 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 ''; print "\n"; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 9e1c5ad2e14..b39d5216218 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -83,6 +83,7 @@ if (! empty($dolibarr_main_document_root_alt)) print "Should found something like following examples:
\n"; print "\"/extensions\"
\n"; print "\"/extensions1,/extensions2,...\"
\n"; + print "\"/../extensions\"
\n"; print "\"/custom\"
\n"; exit; } diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index c91e2ff0c80..322030e6e36 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -250,9 +250,9 @@ $sandboxpaypalurl='developer.paypal.com'; print '
'; print 'Your API authentication information can be found with following steps. We recommend that you open a separate Web browser session when carrying out this procedure.
-1. Log in to your PayPal Premier or Business account (on real paypal '.$realpaypalurl.' (or sandbox '.$sandboxpaypalurl.').
-2. Click the Profile subtab located under the My Account heading.
-3. Click the API Access link under the Account Information header.
+1. Log in to your PayPal account (on real paypal '.$realpaypalurl.' (or sandbox '.$sandboxpaypalurl.').
+2. Click the "Profile" or "Preferencies" subtab located under the My Account heading.
+3. Click the link "API Access".
4. Click the View API Certificate link in the right column.
5. Click the Request API signature radio button on the Request API Credentials page.
6. Complete the Request API Credential Request form by clicking the agreement checkbox and clicking Submit.
diff --git a/scripts/bank/export-bank-receipts.php b/scripts/bank/export-bank-receipts.php index 18aa26b8246..00a193efd29 100755 --- a/scripts/bank/export-bank-receipts.php +++ b/scripts/bank/export-bank-receipts.php @@ -60,9 +60,10 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); if (! isset($argv[3]) || ! $argv[3]) { - print "Usage: ".$script_file." bank_ref bank_receipt_number (csv|tsv|excel|excel2007) [lang=xx_XX]\n"; + print "Usage: ".$script_file." bank_ref [bank_receipt_number|all] (csv|tsv|excel|excel2007) [lang=xx_XX]\n"; exit(-1); } $bankref=$argv[1]; @@ -172,26 +173,31 @@ $array_export_TypeFields=array( ); -// Recherche les ecritures pour le releve -$listofnum="'"; -$arraynum=explode(',',$num); -foreach($arraynum as $val) +// Build request to find records for a bank account/receipt +$listofnum=""; +if (! empty($num) && $num != "all") { - if ($listofnum != "'") $listofnum.="','"; - $listofnum.=$val; + $listofnum.="'"; + $arraynum=explode(',',$num); + foreach($arraynum as $val) + { + if ($listofnum != "'") $listofnum.="','"; + $listofnum.=$val; + } + $listofnum.="'"; } -$listofnum.="'"; $sql = "SELECT b.rowid, b.dateo as do, b.datev as dv,"; $sql.= " b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type,"; $sql.= " ba.rowid as bankid, ba.ref as bankref, ba.label as banklabel"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= ", ".MAIN_DB_PREFIX."bank as b"; -$sql.= " WHERE b.num_releve IN (".$listofnum.")"; -if (!isset($num)) $sql.= " OR b.num_releve is null"; -$sql.= " AND b.fk_account = ".$acct->id; +$sql.= " WHERE b.fk_account = ".$acct->id; +if ($listofnum) $sql.= " AND b.num_releve IN (".$listofnum.")"; +if (!isset($num)) $sql.= " OR b.num_releve is null"; $sql.= " AND b.fk_account = ba.rowid"; $sql.= $db->order("b.num_releve, b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day //print $sql; + $resql=$db->query($sql); if ($resql) { @@ -401,7 +407,6 @@ if ($resql) $rec->accountelem=$accountelem; $rec->debit=$debit; $rec->credit=$credit; - $rec->sold=$sold; $rec->comment=$comment; $rec->soldbefore=price2num($totalbefore); $rec->soldafter=price2num($total); diff --git a/scripts/company/export-contacts-xls-example.php b/scripts/company/export-contacts-xls-example.php index 5e7b6404994..55c1b04b400 100644 --- a/scripts/company/export-contacts-xls-example.php +++ b/scripts/company/export-contacts-xls-example.php @@ -60,6 +60,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); $fname = DOL_DATA_ROOT.'/export-contacts.xls'; diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index edede8d3ba2..d4e6f9e7ca5 100644 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -57,6 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); print "Mails sending disabled (useless in batch mode)\n"; $conf->global->MAIN_DISABLE_ALL_MAILS=1; // On bloque les mails diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 96e97e13771..9753599115c 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -66,6 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; @@ -130,7 +131,7 @@ if ($resql) $outputlangs->load("bills"); $outputlangs->load("main"); $outputlangs->load("contracts"); - + if (dol_strlen($oldemail)) { $message .= $langs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".$obj->label." (".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)."), ".$langs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite),'day')."\n\n"; diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 08d068685e3..a41a59de3cf 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -66,6 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; @@ -130,7 +131,7 @@ if ($resql) $outputlangs->setDefaultLang(empty($obj->lang)?$langs->defaultlang:$obj->lang); // By default language of sale representative $outputlangs->load("bills"); $outputlangs->load("main"); - + if (dol_strlen($obj->email)) { $message .= $langs->trans("Contract")." ".$obj->ref.": ".$langs->trans("Service")." ".$obj->label." (".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency).") ".$obj->nom.", ".$langs->trans("DateEndPlannedShort")." ".dol_print_date($db->jdate($obj->date_fin_validite),'day')."\n\n"; diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 487c346b732..fbd7bf7b466 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -67,6 +67,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[3])?$argv[3]:'none'; diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 67247db7e8a..e3b23a932d5 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -66,6 +66,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); $now=dol_now('tzserver'); $duration_value=isset($argv[2])?$argv[2]:'none'; diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index eeb5407b37b..2bba8666e0c 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -57,6 +57,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); // Check parameters if (! isset($argv[1])) @@ -124,7 +125,7 @@ foreach ($argv as $key => $value) $paymentdatebefore=dol_stringtotime($argv[$key+2]); if (empty($paymentdateafter) || empty($paymentdatebefore)) { - print 'Error: Bad date format'."\n"; + print 'Error: Bad date format or value'."\n"; exit(-1); } print 'Rebuild PDF for invoices with at least one payment between '.dol_print_date($paymentdateafter,'day')." and ".dol_print_date($paymentdatebefore,'day').".\n"; diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index 31df696aedf..840cf464ba2 100755 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -52,6 +52,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); if (! isset($argv[1]) || ! $argv[1]) { print "Usage: $script_file now\n"; diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index 52735e2a30e..83dfd196ae0 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -57,6 +57,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 5ecb9ee2097..c6793212032 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -55,6 +55,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); /* if (! $conf->global->LDAP_SYNCHRO_ACTIVE) diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index ae8690e3996..485f0dbf72a 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -57,7 +57,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; - +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index 9f2dfe5d53b..9fcd3bc40dc 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -55,6 +55,7 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); /* if (! $conf->global->LDAP_SYNCHRO_ACTIVE) diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 44ead523fd6..8e831e26e84 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -55,6 +55,7 @@ $forcecommit=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); // List of fields to get from LDAP $required_fields = array( diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index 2db617e8405..a842aeb1f1b 100644 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -51,8 +51,9 @@ $error=0; @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".getmypid()." *****\n"; +dol_syslog($script_file." launched with arg ".join(',',$argv)); -$datetimeprev = time(); +$datetimeprev = dol_now(); $month = strftime("%m", $datetimeprev); $year = strftime("%Y", $datetimeprev); @@ -60,8 +61,6 @@ $year = strftime("%Y", $datetimeprev); $user = new user($db); $user->fetch($conf->global->PRELEVEMENT_USER); - -print "***** ".$script_file." (".$version.") *****\n"; if (! isset($argv[1])) { // Check parameters print "This script check invoices with a withdrawal request and\n"; print "then create payment and build a withdraw file.\n"; diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 5b2dba2dd22..eb3fa40f98d 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -301,7 +301,21 @@ class DateLibTest extends PHPUnit_Framework_TestCase $langs=$this->savlangs; $db=$this->savdb; - $stime='1970-01-01T02:00:00Z'; + $conf->global->MAIN_OLD_DATE=1; + + $stime='19700102'; + $result=dol_stringtotime($stime); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(86400,$result); + + $conf->global->MAIN_OLD_DATE=0; + + $stime='19700102'; + $result=dol_stringtotime($stime); + print __METHOD__." result=".$result."\n"; + $this->assertEquals(86400,$result); + + $stime='1970-01-01T02:00:00Z'; $result=dol_stringtotime($stime); print __METHOD__." result=".$result."\n"; $this->assertEquals(7200,$result); @@ -310,7 +324,7 @@ class DateLibTest extends PHPUnit_Framework_TestCase $result=dol_stringtotime($stime); print __METHOD__." result=".$result."\n"; $this->assertEquals(7200,$result); - + $stime='19700101T020000Z'; $result=dol_stringtotime($stime); print __METHOD__." result=".$result."\n"; @@ -321,11 +335,6 @@ class DateLibTest extends PHPUnit_Framework_TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals(7200,$result); - $stime='19700101'; - $result=dol_stringtotime($stime); - print __METHOD__." result=".$result."\n"; - $this->assertEquals(0,$result); - return $result; }
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref', $morehtmlref); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'facid', $linkback, 1, 'rowid', 'ref'); + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', '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 '