From 649f535d56fc89176d9c4dd1896d6cf8700b782b Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Sat, 15 Mar 2014 19:49:21 +0100 Subject: [PATCH 01/23] delete extrafield on delete invoice --- htdocs/compta/facture/class/facture.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 76b54bbe613..e9bf109b9e7 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1252,6 +1252,16 @@ class Facture extends CommonInvoice } // Fin appel triggers } + + // Removed extrafields + if (! $error) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); + } + } if (! $error) { From c8c4a10a06464d84f19d0e665057fe3a847cf6db Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Fri, 21 Mar 2014 16:18:17 +0100 Subject: [PATCH 02/23] Fix restrictedearea bug --- htdocs/compta/bank/account.php | 2 +- htdocs/compta/bank/bankid_fr.php | 2 +- htdocs/compta/bank/fiche.php | 2 +- htdocs/compta/bank/graph.php | 2 +- htdocs/compta/bank/treso.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index d85d6ff3b27..2cdda511bdb 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -50,7 +50,7 @@ $confirm=GETPOST('confirm','alpha'); $fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :'')); $fieldtype = (! empty($ref) ? 'ref' :'rowid'); if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$fieldvalue,'bank_account','','',$fieldtype); +$result=restrictedArea($user,'banque',$fieldvalue,'bank_account&bank_account','','',$fieldtype); $paiementtype=GETPOST('paiementtype','alpha',3); $req_nb=GETPOST("req_nb",'',3); diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php index 6b5a4c2437b..d193ff83b59 100644 --- a/htdocs/compta/bank/bankid_fr.php +++ b/htdocs/compta/bank/bankid_fr.php @@ -43,7 +43,7 @@ if (isset($_GET["id"]) || isset($_GET["ref"])) } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); +$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); /* diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 37376aceb7a..71afc1d9d5c 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -44,7 +44,7 @@ if (isset($_GET["id"]) || isset($_GET["ref"])) } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); +$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); /* diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 11367289e7a..734cdd8eb83 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -41,7 +41,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"])) } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); +$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); $account=$_GET["account"]; $mode='standard'; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index af7078421a2..ffbf6be1ce9 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -42,7 +42,7 @@ if (isset($_GET["account"]) || isset($_GET["ref"])) } $fieldid = isset($_GET["ref"])?'ref':'rowid'; if ($user->societe_id) $socid=$user->societe_id; -$result=restrictedArea($user,'banque',$id,'bank_account','','',$fieldid); +$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid); $vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; From 4bd6f1111233af6594ef3048c2605d2879167bce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Mar 2014 18:35:50 +0100 Subject: [PATCH 03/23] Backport fix to solve warning problems. --- htdocs/core/class/conf.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 903694128f9..957bec47088 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -201,6 +201,11 @@ class Conf //var_dump($this->modules); //var_dump($this->modules_parts['theme']); + // If you can't set timezone of your PHP, set this constant. Better is to set it to UTC. + // In future, this constant will be forced to 'UTC' so PHP server timezone will not have effect anymore. + //$this->global->MAIN_SERVER_TZ='Europe/Paris'; + if (! empty($this->global->MAIN_SERVER_TZ) && $this->global->MAIN_SERVER_TZ != 'auto') date_default_timezone_set($this->global->MAIN_SERVER_TZ); + // Object $mc if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled)) { From 1061a650d200ad159d8fe5c2b2624561f30ebb7a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Mar 2014 21:11:51 +0100 Subject: [PATCH 04/23] Fix: duplicate info --- .../commande/doc/pdf_einstein.modules.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 11a5e271dde..953212748f8 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -593,20 +593,6 @@ class pdf_einstein extends ModelePDFCommandes $posy=$pdf->GetY()+1; } */ - if (! empty($object->date_livraison)) - { - $pdf->SetXY($this->marge_gauche, $posy); - $pdf->SetFont('','B', $default_font_size - 2); - $text=$outputlangs->transnoentities("DeliveryDate").':'; - $pdf->MultiCell(80, 3, $text, 0, 'L', 0); - - $pdf->SetFont('','', $default_font_size - 2); - $pdf->SetXY($posxval, $posy); - $text=dol_print_date($object->date_livraison,'day','',$outputlangs); - $pdf->MultiCell(80, 3, $text, 0, 'L', 0); - - $posy=$pdf->GetY()+1; - } /* TODO else if (! empty($object->availability_code)) { @@ -619,7 +605,7 @@ class pdf_einstein extends ModelePDFCommandes $posy=$pdf->GetY()+1; }*/ - // Show shipping date + // Show planed date of delivery if ($object->date_livraison) { $outputlangs->load("sendings"); From e0b4bd9b0dbe0176a89a6226f39fb78bf765486f Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 22 Mar 2014 13:00:23 +0100 Subject: [PATCH 05/23] Fix: [ bug #1306 ] Fatal error when adding an external calendar --- ChangeLog | 1 + htdocs/admin/agenda_extsites.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 338a1406b8e..0978f65863b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ Fix: [ bug #1240 ] traduction. Fix: [ bug #1238 ] When creating accompte with a %, free product are used for calculation. Fix: [ bug #1280 ] service with not end of date was tagged as expired. Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference +Fix: [ bug #1306 ] Fatal error when adding an external calendar New: Added es_CL language ***** ChangeLog for 3.5 compared to 3.4.* ***** diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 4bb3cb8c4f3..b133485f866 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2013 Juanjo Menent + * Copyright (C) 2011-2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; if (!$user->admin) accessforbidden(); From 466de67b5b8bec3c81fb43cc70e6bca6524c3051 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Mar 2014 20:18:07 +0100 Subject: [PATCH 06/23] Fix: Solve pb of too many embedded tables --- .../doc/doc_generic_order_odt.modules.php | 22 +++++------------ .../doc/doc_generic_shipment_odt.modules.php | 22 +++++------------ .../doc/doc_generic_invoice_odt.modules.php | 20 ++++------------ .../pdf/doc_generic_project_odt.modules.php | 22 +++++------------ .../task/pdf/doc_generic_task_odt.modules.php | 24 ++++++------------- .../doc/doc_generic_proposal_odt.modules.php | 24 +++++-------------- .../societe/doc/doc_generic_odt.modules.php | 8 +------ 7 files changed, 37 insertions(+), 105 deletions(-) diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index e3ca8814a70..e717b92bf14 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -218,7 +218,7 @@ class doc_generic_order_odt extends ModelePDFCommandes if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } @@ -228,34 +228,24 @@ class doc_generic_order_odt extends ModelePDFCommandes $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; - + $texte.= '
'; + // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 4b1433ddd77..6029769afb0 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -208,7 +208,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } @@ -218,34 +218,24 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; - + $texte.= '
'; + // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index d1642023c24..95484b232e4 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -219,7 +219,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texte.= ''; // List of directories area - $texte.= ''; - - $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= '
'; + $texte.= '
'; $texttitle=$langs->trans("ListOfDirectories"); $listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->FACTURE_ADDON_PDF_ODT_PATH))); $listoffiles=array(); @@ -243,34 +243,24 @@ class doc_generic_invoice_odt extends ModelePDFFactures $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; + $texte.= '
'; // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= '
'; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= '
'; - $texte.= ''; - $texte.= '
'; $texte.= ''; diff --git a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php index 68cf3de470c..0e7ec535ac6 100644 --- a/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/pdf/doc_generic_project_odt.modules.php @@ -322,7 +322,7 @@ class doc_generic_project_odt extends ModelePDFProjects if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } @@ -332,34 +332,24 @@ class doc_generic_project_odt extends ModelePDFProjects $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; - + $texte.= '
'; + // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; diff --git a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php index d9960269d3d..fd63ae5a404 100644 --- a/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/pdf/doc_generic_task_odt.modules.php @@ -323,7 +323,7 @@ class doc_generic_task_odt extends ModelePDFTask if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } @@ -333,34 +333,24 @@ class doc_generic_task_odt extends ModelePDFTask $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; - + $texte.= '
'; + // Scan directories if (count($listofdir)) $texte.=$langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; @@ -431,7 +421,7 @@ class doc_generic_task_odt extends ModelePDFTask { //print "srctemplatepath=".$srctemplatepath; // Src filename $newfile=basename($srctemplatepath); - $newfiletmp=preg_replace('/\.odt/i','',$newfile); + $newfiletmp=preg_replace('/\.(ods|odt)/i','',$newfile); $newfiletmp=preg_replace('/template_/i','',$newfiletmp); $newfiletmp=preg_replace('/modele_/i','',$newfiletmp); $newfiletmp=$objectref.'_'.$newfiletmp; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 23f0fc020d3..80fb073b964 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -129,7 +129,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0); else { - $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt'); + $tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)'); if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles); } } @@ -139,17 +139,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it $texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1); - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '
'; + $texte.= '
'; $texte.= ''; - $texte.= '
  '; + $texte.= '
'; $texte.= ''; - $texte.= '
'; - + $texte.= '
'; + // Scan directories if (count($listofdir)) { @@ -181,22 +178,13 @@ class doc_generic_proposal_odt extends ModelePDFPropales } } - - $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 77d1e76eea1..563444a51a3 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -135,17 +135,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc $texte.= ''; - - $texte.= ''; + $texte.= ''; $texte.= $langs->trans("ExampleOfDirectoriesForModelGen"); $texte.= ''; $texte.= ''; - /*$texte.= ''; - $texte.= ''; - $texte.= ''; - $texte.= '';*/ - $texte.= ''; $texte.= ''; From 57bd043f59227dfbcce34ffe79d446da98a6403e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Mar 2014 20:30:54 +0100 Subject: [PATCH 07/23] Fix: Missing lang loading --- htdocs/compta/facture.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f8655c7c850..4823bb636fc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -51,6 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $langs->load('bills'); $langs->load('companies'); +$langs->load('compta'); $langs->load('products'); $langs->load('banks'); $langs->load('main'); From 6039c81845ce705c35f2acdea1a1b24419d75ec4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Mar 2014 20:56:41 +0100 Subject: [PATCH 08/23] Fix: copy to clipboard does not work with jmobile Fix: Bad translation --- htdocs/core/lib/company.lib.php | 9 +++++---- htdocs/langs/en_US/admin.lang | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 4de405e3567..3bc2eb5982c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -726,7 +726,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $coords .= "
".addslashes($object->country); } - print ''; + print ''; // hideonsmatphone because copyToClipboard call jquery dialog that does not work with jmobile + print ''; print img_picto($langs->trans("Address"), 'object_address.png'); print ''; @@ -771,15 +772,15 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print "
\n"; ?> - + + $("#dialog").dialog() function copyToClipboard (text) { text = text.replace(/
/g,"\n"); var newElem = "

'.$langs->trans('HelpCopyToClipboard').'"; $("#dialog").html(newElem); - $( "#dialog" ).dialog(); + $("#dialog").dialog(); $("#coords").select(); return false; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ee651563845..b46f2c57be4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1435,7 +1435,7 @@ AccountancyCodeBuy=Purchase account. code AgendaSetup=Events and agenda module setup PasswordTogetVCalExport=Key to authorize export link PastDelayVCalExport=Do not export event older than -AGENDA_USE_EVENT_TYPE=Use events types (managed into Configuration->Dictionnary->llx_c_actioncomm) +AGENDA_USE_EVENT_TYPE=Use events types (managed into menu Setup -> Dictionnary -> Type of agenda events) ##### ClickToDial ##### ClickToDialDesc=This module allows to add an icon after phone numbers. A click on this icon will call a server with a particular URL you define below. This can be used to call a call center system from Dolibarr that can call the phone number on a SIP system for example. ##### Point Of Sales (CashDesk) ##### From 3f78fe8c936302dbb78c1aab9e1cf209828cfebb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 23 Mar 2014 21:01:05 +0100 Subject: [PATCH 09/23] Fix: Avoid to get duplicate field --- htdocs/core/lib/company.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 3bc2eb5982c..b6e8e4c6786 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -641,7 +641,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$object->id; if ($search_status!='') $sql .= " AND p.statut = ".$db->escape($search_status); - if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape(strtolower($search_name))."%' OR p.firstname LIKE '%".$db->escape(strtolower($search_name))."%')"; + if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')"; $sql.= " ORDER BY $sortfield $sortorder"; dol_syslog('core/lib/company.lib.php :: show_contacts sql='.$sql,LOG_DEBUG); @@ -737,7 +737,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''; + print ''; print img_object($langs->trans("Rendez-Vous"),"action_rdv"); print ' '; } From e16385b4966fbc3ec5688aea610c9aa8b16e8648 Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 25 Mar 2014 11:48:44 +0100 Subject: [PATCH 10/23] FIX :[bug #1309] --- htdocs/comm/action/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 2d22e77619d..9c980e5c00f 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -538,7 +538,7 @@ if ($action == 'create') // Busy print ''.$langs->trans("Busy").''; - print ''; + print ''; print ''; // Realised by From 57cf3846171a2a1393d5c2a9fcdb0aec64a3c8ba Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 25 Mar 2014 13:05:29 +0100 Subject: [PATCH 11/23] Keep value on validtions failure --- htdocs/comm/action/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 9c980e5c00f..d67b810e536 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -538,7 +538,7 @@ if ($action == 'create') // Busy print ''.$langs->trans("Busy").''; - print ''; + print 'transparency?' checked="checked"':'').'>'; print ''; // Realised by From 3d12979b3f975fee82d4416615b88952d848e58e Mon Sep 17 00:00:00 2001 From: Florian Henry Date: Wed, 26 Mar 2014 09:53:48 +0100 Subject: [PATCH 12/23] remove debug string --- htdocs/comm/action/index.php | 3 --- htdocs/expedition/note.php | 4 ---- htdocs/fourn/facture/fiche.php | 3 --- htdocs/projet/tasks/task.php | 3 --- 4 files changed, 13 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f3b4f5e1d5e..2727bca7164 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -19,9 +19,6 @@ * along with this program. If not, see . */ -error_reporting(E_ALL); -ini_set('display_errors', true); -ini_set('html_errors', false); /** * \file htdocs/comm/action/index.php diff --git a/htdocs/expedition/note.php b/htdocs/expedition/note.php index d0300dad278..4d4c30b55a4 100644 --- a/htdocs/expedition/note.php +++ b/htdocs/expedition/note.php @@ -24,10 +24,6 @@ * \brief Note card expedition */ -error_reporting(E_ALL); -ini_set('display_errors', true); -ini_set('html_errors', false); - require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index fd4a988cedf..5605ed2340f 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -28,9 +28,6 @@ * \brief Page for supplier invoice card (view, edit, validate) */ -error_reporting(E_ALL); -ini_set('display_errors', true); -ini_set('html_errors', false); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 5e2f20729cc..a7ab5446c92 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -23,9 +23,6 @@ * \brief Page of a project task */ -error_reporting(E_ALL); -ini_set('display_errors', true); -ini_set('html_errors', false); require ("../../main.inc.php"); require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; From f97c8feb546951a5f3f2621324ec3ee5b034c0fb Mon Sep 17 00:00:00 2001 From: Alexis Algoud Date: Wed, 26 Mar 2014 11:28:41 +0100 Subject: [PATCH 13/23] fix can't add line with product in supplier order --- htdocs/fourn/commande/fiche.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index 73a62207af1..5f3ef882fcf 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -240,7 +240,7 @@ else if ($action == 'addline' && $user->rights->fournisseur->commande->creer) // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit // Ecrase $txtva par celui du produit - if ((GETPOST('addline_predefined') || GETPOST('idprodfournprice')) && ( GETPOST('pu')!=='')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' + if (GETPOST('addline_predefined') || GETPOST('idprodfournprice')) // With combolist idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or '' { $idprod=0; $productsupplier = new ProductFournisseur($db); From acb752c5f253895cc6014033f7265947e1303edf Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 28 Mar 2014 18:22:44 +0100 Subject: [PATCH 14/23] Fix: Margin tabs bad data show --- ChangeLog | 1 + htdocs/margin/agentMargins.php | 10 +++++++--- htdocs/margin/customerMargins.php | 18 ++++++++++++------ htdocs/margin/productMargins.php | 18 +++++++++++++----- 4 files changed, 33 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0978f65863b..442d632d6da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,7 @@ Fix: [ bug #1280 ] service with not end of date was tagged as expired. Fix: [ bug #1295 ] Error when creating an agenda extrafield with a number as reference Fix: [ bug #1306 ] Fatal error when adding an external calendar New: Added es_CL language +Fix: Margin tabs bad data show ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 5bfa61cc7b6..3640ae6dfbb 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -130,11 +131,14 @@ if ($agentid > 0) { else $sql .= " AND sc.fk_user = ".$agentid; } -if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; -if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; +if (!empty($startdate)) + $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; +if (!empty($enddate)) + $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; +if($agentid) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; +else $sql.= " GROUP BY u.rowid, u.login, u.lastname, u.firstname"; $sql.= " ORDER BY ".$sortfield." ".$sortorder; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index e9a0bbfe102..e5226040794 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,13 +173,18 @@ $sql.= " WHERE f.fk_soc = s.rowid"; $sql.= " AND f.fk_statut > 0"; $sql.= " AND s.entity = ".$conf->entity; $sql.= " AND d.fk_facture = f.rowid"; -if ($client) $sql.= " AND f.fk_soc = ".$socid; -if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; -if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; +if ($client) + $sql.= " AND f.fk_soc = ".$socid; +if (!empty($startdate)) + $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; +if (!empty($enddate)) + $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; -if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -$sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; -$sql.= " ORDER BY ".$sortfield." ".$sortorder; +if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) + $sql .= " AND d.buy_price_ht <> 0"; +if ($client) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; +else $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client"; +$sql.= " ORDER BY $sortfield $sortorder "; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index c4ba7b54c20..3152b8387b6 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -1,5 +1,6 @@ + * Copyright (C) 2014 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -178,12 +179,19 @@ $sql.= " AND f.fk_soc = s.rowid"; $sql.= " AND d.fk_product = p.rowid"; $sql.= " AND f.fk_statut > 0"; $sql.= " AND d.fk_facture = f.rowid"; -if ($id > 0) $sql.= " AND d.fk_product =".$id; -if (!empty($startdate)) $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; -if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; +if ($id > 0) + $sql.= " AND d.fk_product =".$id; +if (!empty($startdate)) + $sql.= " AND f.datef >= '".$db->idate($startdate)."'"; +if (!empty($enddate)) + $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; -if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -$sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; +if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) + $sql .= " AND d.buy_price_ht <> 0"; +if ($id > 0) + $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; +else + $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref"; $sql.= " ORDER BY ".$sortfield." ".$sortorder; // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); From 61f649e1aed2e79d3a81e51155dcf937a7a38ba0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 29 Mar 2014 04:26:44 +0100 Subject: [PATCH 15/23] Fix: When select_date is called with '' as preselected date, automatic user date was not correctly et (We must set a date into PHP server timezone area) Fix: First param of select_date must always be forged with a dolibarr date function and not time(). New: Add a page for tests. --- htdocs/compta/bank/fiche.php | 2 +- htdocs/core/class/html.form.class.php | 24 +++++---- htdocs/core/lib/functions.lib.php | 6 +-- htdocs/cron/card.php | 8 +-- htdocs/public/test/test_arrays.php | 9 ++-- htdocs/public/test/test_forms.php | 71 +++++++++++++++++++++++++++ 6 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 htdocs/public/test/test_forms.php diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php index 37376aceb7a..806ca6fa5ad 100644 --- a/htdocs/compta/bank/fiche.php +++ b/htdocs/compta/bank/fiche.php @@ -325,7 +325,7 @@ if ($action == 'create') print ''.$langs->trans("Date").''; print ''; - $form->select_date(time(), 're', 0, 0, 0, 'formsoc'); + $form->select_date('', 're', 0, 0, 0, 'formsoc'); print ''; print ''.$langs->trans("BalanceMinimalAllowed").''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 452d0e7110d..5943d451b9c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2915,16 +2915,17 @@ class Form } /** - * Show a form to select a date + * Show a form + html select a date * * @param string $page Page * @param string $selected Date preselected - * @param string $htmlname Name of input html field + * @param string $htmlname Html name of date input fields or 'none' * @param int $displayhour Display hour selector * @param int $displaymin Display minutes selector * @return void + * @see select_date */ - function form_date($page, $selected, $htmlname,$displayhour=0,$displaymin=0) + function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0) { global $langs; @@ -3437,13 +3438,13 @@ class Form /** - * Show a HTML widget to input a date or combo list for day, month, years and optionnaly hours and minutes + * Show a HTML widget to input a date or combo list for day, month, years and optionnaly hours and minutes. * Fields are preselected with : - * - set_time date (Local PHP server timestamps or date format YYYY-MM-DD or YYYY-MM-DD HH:MM) - * - local date of PHP server if set_time is '' - * - Empty (fields empty) if set_time is -1 (in this case, parameter empty must also have value 1) + * - set_time date (must be a local PHP server timestamp or string date with format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM') + * - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location) + * - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1) * - * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp) + * @param timestamp $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date. * @param string $prefix Prefix for fields name * @param int $h 1=Show also hours * @param int $m 1=Show also minutes @@ -3455,6 +3456,7 @@ class Form * @param int $disabled Disable input fields * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @return mixed Nothing or string if nooutput is 1 + * @see form_date */ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowbutton=0, $nooutput=0, $disabled=0, $fullday='') { @@ -3467,7 +3469,11 @@ class Form if($m == '') $m=0; if($empty == '') $empty=0; - if (! $set_time && $empty == 0) $set_time = dol_now('tzuser'); + if ($set_time === '' && $empty == 0) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + $set_time = dol_now('tzuser')-(getServerTimeZoneInt('now')*3600); // set_time must be relative to PHP server timezone + } // Analysis of the pre-selection date if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/',$set_time,$reg)) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index bf398c389c0..c3889a41456 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1058,7 +1058,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) /** - * Return date for now. We should always use this function without parameters (that means GMT time) + * Return date for now. In mot cases, we use this function without parameters (that means GMT time). * * @param string $mode 'gmt' => we return GMT timestamp, * 'tzserver' => we add the PHP server timezone @@ -1068,7 +1068,7 @@ function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1) */ function dol_now($mode='gmt') { - // Note that gmmktime and mktime return same value (GMT) whithout parameters + // Note that gmmktime and mktime return same value (GMT) when used without parameters //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() function instead if ($mode == 'gmt') $ret=time(); // Time for now at greenwich. else if ($mode == 'tzserver') // Time for now with PHP server timezone added @@ -1083,7 +1083,7 @@ function dol_now($mode='gmt') $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time $ret=dol_now('gmt')+($tzsecond*3600); }*/ - else if ($mode == 'tzuser') // Time for now with user timezone is added + else if ($mode == 'tzuser') // Time for now with user timezone added { //print 'eeee'.time().'-'.mktime().'-'.gmmktime(); $offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 89b257ca817..4857523aaf5 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -303,11 +303,13 @@ if (($action=="create") || ($action=="edit")) print ""; print $langs->trans('CronHourStart').""; - if(!empty($object->datestart)){ + if(!empty($object->datestart)) + { $form->select_date($object->datestart,'datestart',1,1,'',"cronform"); } - else{ - $form->select_date(dol_now(),'datestart',1,1,'',"cronform"); + else + { + $form->select_date('','datestart',1,1,'',"cronform"); } print ""; print ""; diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index fb8274e5524..f7e29a695a1 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -131,11 +131,8 @@ Example 1 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tag Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable
- +
@@ -274,4 +271,4 @@ Example 3 : Standard table
- + \ No newline at end of file diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php new file mode 100644 index 00000000000..126c9723fa7 --- /dev/null +++ b/htdocs/public/test/test_forms.php @@ -0,0 +1,71 @@ +global->MAIN_FEATURES_LEVEL)) +{ + print "Page available onto dev environment only"; + exit; +} +?> + + + + + + + + +Test page + + + + + + + + + + + + + + + + +
+
+This page is a sample of page using html methods.
+
+ + +select_date using tzuser date +print "Test 1: We must have here current hour for user (must match hour on browser). Note: Check your are logged so user TZ and DST are known."; +$offsettz=(empty($_SESSION['dol_tz'])?0:$_SESSION['dol_tz'])*60*60; +$offsetdst=(empty($_SESSION['dol_dst'])?0:$_SESSION['dol_dst'])*60*60; +print " (dol_tz=".$offsettz." dol_dst=".$dol_dst.")
\n"; +$form->select_date('', 'test1', 1, 1, 0); + +print '

'."\n"; + +// Test2: form->select_date using tzuser date +print "Test 2: We must have here 1970-01-01 00:00:00 selected (fields can be empty)
\n"; +$form->select_date(dol_get_first_day(1970,1,false), 'test2', 1, 1, 1); + +print '

'."\n"; + +// Test3: form->select_date for 1970-01-01 00:00:00 +print "Test 3: We must have here 1970-01-01 00:00:00 selected (fields are mandatory)
\n"; +$form->select_date(dol_get_first_day(1970,1,false), 'test3', 1, 1, 0); + +?> + +
+ + \ No newline at end of file From c506e59d8c12f5da114ae1bb407757891e5443fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Mar 2014 15:58:41 +0200 Subject: [PATCH 16/23] Look: Minor fix to not have calendar picto to glue to input --- htdocs/theme/amarok/style.css.php | 2 ++ htdocs/theme/auguria/style.css.php | 2 ++ htdocs/theme/cameleo/style.css.php | 2 ++ 3 files changed, 6 insertions(+) diff --git a/htdocs/theme/amarok/style.css.php b/htdocs/theme/amarok/style.css.php index 1a6149b76fb..9181c9b74f8 100644 --- a/htdocs/theme/amarok/style.css.php +++ b/htdocs/theme/amarok/style.css.php @@ -1515,6 +1515,8 @@ table.valid { /* Calendar */ /* ============================================================================== */ +img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } + .ui-datepicker-title { margin:0 !important; line-height:28px; diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php index 31e7f1b7479..a118409890c 100644 --- a/htdocs/theme/auguria/style.css.php +++ b/htdocs/theme/auguria/style.css.php @@ -1723,6 +1723,8 @@ opacity: 1; /* Calendar */ /* ============================================================================== */ +img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } + .ui-datepicker-trigger { vertical-align: middle; cursor: pointer; diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php index 7a8277a4cdc..ad03e369d95 100644 --- a/htdocs/theme/cameleo/style.css.php +++ b/htdocs/theme/cameleo/style.css.php @@ -1816,6 +1816,8 @@ border-radius:6px; /* Calendar */ /* ============================================================================== */ +img.datecallink { padding-left: 2px !important; padding-right: 2px !important; } + .ui-datepicker-trigger { vertical-align: middle; cursor: pointer; From 95793a5475a131c141d819ceb3be2c046e6e5ab7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 30 Mar 2014 16:08:30 +0200 Subject: [PATCH 17/23] Fix: fields into group by of sql requests for module margins must be same than fields into select. --- htdocs/margin/agentMargins.php | 7 ++++--- htdocs/margin/customerMargins.php | 8 ++++---- htdocs/margin/productMargins.php | 13 +++++-------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 3640ae6dfbb..51166bc472b 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -105,7 +105,8 @@ print ''; print "
snake
"; print ''; -$sql = "SELECT s.rowid as socid, s.nom, s.code_client, s.client, "; +$sql = "SELECT"; +if ($agentid > 0) $sql.= " s.rowid as socid, s.nom, s.code_client, s.client,"; $sql.= " u.rowid as agent, u.login, u.lastname, u.firstname,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; @@ -137,9 +138,9 @@ if (!empty($enddate)) $sql.= " AND f.datef <= '".$db->idate($enddate)."'"; $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -if($agentid) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; +if ($agentid > 0) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, u.rowid, u.login, u.lastname, u.firstname"; else $sql.= " GROUP BY u.rowid, u.login, u.lastname, u.firstname"; -$sql.= " ORDER BY ".$sortfield." ".$sortorder; +$sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index e5226040794..6675753d4d6 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -160,9 +160,9 @@ if (! empty($conf->global->DISPLAY_MARK_RATES)) { print ""; print ''; -$sql = "SELECT s.rowid as socid, s.nom, s.code_client, s.client,"; -$sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; -$sql.= " f.datef, f.paye, f.fk_statut as statut,"; +$sql = "SELECT"; +$sql.= " s.rowid as socid, s.nom, s.code_client, s.client,"; +if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; @@ -184,7 +184,7 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr $sql .= " AND d.buy_price_ht <> 0"; if ($client) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; else $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client"; -$sql.= " ORDER BY $sortfield $sortorder "; +$sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 3152b8387b6..ca7b2c4845b 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -164,9 +164,8 @@ print ""; print ''; $sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref,"; -$sql.= " d.fk_product,"; -$sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,"; -$sql.= " f.datef, f.paye, f.fk_statut as statut,"; +if ($id > 0) $sql.= " d.fk_product,"; +if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,"; $sql.= " sum(d.total_ht) as selling_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,"; $sql.= " sum(".$db->ifsql('d.total_ht <=0','-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty))','d.total_ht - (d.buy_price_ht * d.qty)').") as marge"; @@ -188,11 +187,9 @@ if (!empty($enddate)) $sql .= " AND d.buy_price_ht IS NOT NULL"; if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0"; -if ($id > 0) - $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; -else - $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref"; -$sql.= " ORDER BY ".$sortfield." ".$sortorder; +if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut"; +else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref"; +$sql.=$db->order($sortfield,$sortorder); // TODO: calculate total to display then restore pagination //$sql.= $db->plimit($conf->liste_limit +1, $offset); From ed49f8844629df216f3512344d2eaff0f156f008 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 00:19:31 +0200 Subject: [PATCH 18/23] Fix: deleting files into backup system tools. Fix: Dump using php not not include lock on tables that are deleted. --- htdocs/admin/tools/dolibarr_export.php | 2 +- htdocs/admin/tools/export.php | 85 ++++++++++++++------------ 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 31a11f260f9..847b20783b2 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -50,7 +50,7 @@ if (! $user->admin) if ($action == 'delete') { - $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); + $file=$conf->admin->dir_output.'/'.GETPOST('urlfile'); $ret=dol_delete_file($file, 1); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 8dbd7a1912e..4e85a4d3096 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -58,7 +58,7 @@ if ($file && ! $what) if ($action == 'delete') { - $file=$conf->admin->dir_output.'/backup/'.GETPOST('urlfile'); + $file=$conf->admin->dir_output.'/'.GETPOST('urlfile'); $ret=dol_delete_file($file, 1); if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors'); @@ -451,46 +451,53 @@ function backup_tables($outputfile, $tables='*') //fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n"); $resqldrop=$db->query('SHOW CREATE TABLE '.$table); $row2 = $db->fetch_row($resqldrop); - fwrite($handle,$row2[1].";\n"); - //fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n"); - - - // Dumping the data (locking the table and disabling the keys check while doing the process) - fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n"); - if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back) - if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); - - $sql='SELECT * FROM '.$table; - $result = $db->query($sql); - $num_fields = $db->num_rows($result); - while($row = $db->fetch_row($result)) { - // For each row of data we print a line of INSERT - fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES ('); - $columns = count($row); - for($j=0; $j<$columns; $j++) { - // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier) - if ($row[$j] == null and !is_string($row[$j])) { - // IMPORTANT: if the field is NULL we set it NULL - $row[$j] = 'NULL'; - } elseif(is_string($row[$j]) and $row[$j] == '') { - // if it's an empty string, we set it as an empty string - $row[$j] = "''"; - } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) - // if it's a number, we return it as-is - $row[$j] = $row[$j]; - } else { // else for all other cases we escape the value and put quotes around - $row[$j] = addslashes($row[$j]); - $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); - $row[$j] = "'".$row[$j]."'"; - } - } - fwrite($handle,implode(',', $row).");\n"); + if (empty($row2[1])) + { + fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n"); } - if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking - if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table - fwrite($handle,"\n\n\n"); - } + else + { + fwrite($handle,$row2[1].";\n"); + //fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n"); + // Dumping the data (locking the table and disabling the keys check while doing the process) + fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n"); + if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back) + if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); + + $sql='SELECT * FROM '.$table; + $result = $db->query($sql); + $num_fields = $db->num_rows($result); + while($row = $db->fetch_row($result)) + { + // For each row of data we print a line of INSERT + fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES ('); + $columns = count($row); + for($j=0; $j<$columns; $j++) { + // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier) + if ($row[$j] == null and !is_string($row[$j])) { + // IMPORTANT: if the field is NULL we set it NULL + $row[$j] = 'NULL'; + } elseif(is_string($row[$j]) and $row[$j] == '') { + // if it's an empty string, we set it as an empty string + $row[$j] = "''"; + } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) + // if it's a number, we return it as-is + $row[$j] = $row[$j]; + } else { // else for all other cases we escape the value and put quotes around + $row[$j] = addslashes($row[$j]); + $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); + $row[$j] = "'".$row[$j]."'"; + } + } + fwrite($handle,implode(',', $row).");\n"); + } + if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking + if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table + fwrite($handle,"\n\n\n"); + } + } + /* Backup Procedure structure*/ /* $result = $db->query('SHOW PROCEDURE STATUS'); From d48cbeb7206f1060daea44bc99735a94068d7623 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 01:45:48 +0200 Subject: [PATCH 19/23] Fix: W3C --- htdocs/compta/hrm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/hrm.php b/htdocs/compta/hrm.php index 95b133e8446..d6b0d345010 100644 --- a/htdocs/compta/hrm.php +++ b/htdocs/compta/hrm.php @@ -164,7 +164,7 @@ if ($result) } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } From 39f48f25dbd74d303afabf98fd047714ec2d26ae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 01:48:50 +0200 Subject: [PATCH 20/23] Fix: Trip and expenses were moved into menu hrm --- htdocs/compta/index.php | 68 ----------------------------------------- 1 file changed, 68 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 9a7839fd1c3..d2a78423068 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -529,74 +529,6 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) } -// Last trips and expenses -if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire) -{ - include_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'; - - $langs->load("boxes"); - - $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.fk_statut, d.rowid, d.dated as date, d.tms as dm, d.km"; - $sql.= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE u.rowid = d.fk_user"; - $sql.= " AND d.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND d.fk_soc = ".$socid; - $sql.= $db->order("d.tms","DESC"); - $sql.= $db->plimit($max, 0); - - $result = $db->query($sql); - if ($result) - { - $var=false; - $num = $db->num_rows($result); - - $i = 0; - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($num) - { - $total_ttc = $totalam = $total = 0; - - $deplacementstatic=new Deplacement($db); - $userstatic=new User($db); - while ($i < $num && $i < $max) - { - $objp = $db->fetch_object($result); - $deplacementstatic->ref=$objp->rowid; - $deplacementstatic->id=$objp->rowid; - $userstatic->id=$objp->uid; - $userstatic->lastname=$objp->lastname; - $userstatic->firstname=$objp->firstname; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $var=!$var; - $i++; - } - - } - else - { - print ''; - } - print '
'.$langs->trans("BoxTitleLastModifiedExpenses",$max).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$objp->km.''.dol_print_date($db->jdate($objp->dm),'day').''.$deplacementstatic->LibStatut($objp->fk_statut,3).'
'.$langs->trans("None").'

'; - } - else dol_print_error($db); -} - - /** * Social contributions to pay */ From 76259a633c0c2aa23247ee03efc8abbdfff2d6b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 02:16:49 +0200 Subject: [PATCH 21/23] Clean constant FACTURE_TVAOPTION into conf.class.php so we don't have to do it everywhere at different places. Value is now 0 or 1. --- htdocs/admin/company.php | 8 ++++---- htdocs/core/class/conf.class.php | 10 +++++++++- htdocs/societe/class/societe.class.php | 4 ++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 699a797f751..f8a0c9ea5a1 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -530,7 +530,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=true; $var=!$var; - print ""; + print ""; print ''; print ""; print ""; @@ -539,7 +539,7 @@ if ($action == 'edit' || $action == 'updateedit') print "\n"; $var=!$var; - print ""; + print ""; print '
".$langs->trans("VATIsUsedDesc")."
'; print ""; print ""; @@ -913,7 +913,7 @@ else $var=true; $var=!$var; - print ""; + print ""; print '
".$langs->trans("VATIsNotUsedDesc")."
'; print ""; print ""; @@ -922,7 +922,7 @@ else print "\n"; $var=!$var; - print ""; + print ""; print '
".$langs->trans("VATIsUsedDesc")."
'; print ""; print ""; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 7cc37e380f5..61ba7b062db 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -235,7 +235,15 @@ class Conf if (empty($this->global->MAIN_MENUFRONT_STANDARD)) $this->global->MAIN_MENUFRONT_STANDARD="eldy_menu.php"; if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones - + // Clean var use vat for company + if (! isset($conf->global->FACTURE_TVAOPTION)) $conf->global->FACTURE_TVAOPTION=1; + else if (! empty($conf->global->FACTURE_TVAOPTION) && ! is_numeric($conf->global->FACTURE_TVAOPTION)) + { + // Old value of option, we clean to use new value (0 or 1) + if ($conf->global->FACTURE_TVAOPTION != "franchise") $conf->global->FACTURE_TVAOPTION=1; + else $conf->global->FACTURE_TVAOPTION=0; + } + // Variable globales LDAP if (empty($this->global->LDAP_FIELD_FULLNAME)) $this->global->LDAP_FIELD_FULLNAME=''; if (! isset($this->global->LDAP_KEY_USERS)) $this->global->LDAP_KEY_USERS=$this->global->LDAP_FIELD_FULLNAME; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a8f6bbe8d56..e7a6fc4742d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2575,8 +2575,8 @@ class Societe extends CommonObject $this->logo_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; $this->logo_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; - // Define if company use vat or not (Do not use conf->global->FACTURE_TVAOPTION anymore) - $this->tva_assuj=((isset($conf->global->FACTURE_TVAOPTION) && $conf->global->FACTURE_TVAOPTION=='franchise')?0:1); + // Define if company use vat or not + $this->tva_assuj=$conf->global->FACTURE_TVAOPTION; // Define if company use local taxes $this->localtax1_assuj=((isset($conf->global->FACTURE_LOCAL_TAX1_OPTION) && ($conf->global->FACTURE_LOCAL_TAX1_OPTION=='1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on'))?1:0); From 7f23bec7c443874d8cc83ec60b8c1684638ff578 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 02:21:45 +0200 Subject: [PATCH 22/23] Update changelog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 88fdeafe29b..a4f4c18837e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ For users: - New: Add field url as product properties. - New: More options to create a credit note (can be filled autatically according to remain to pay). - New: Can define custom fields for categories. +- New: Prepare generation of SEPA files into module withdrawal. - Fix: Project Task numbering customs rule works. - Fix: Add actions events not implemented. From c81406c7f302c74d2076c36b041053f11d77833d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Mar 2014 02:41:15 +0200 Subject: [PATCH 23/23] Fix: CI --- .../class/bonprelevement.class.php | 15 ++-- .../sociales/class/chargesociales.class.php | 20 +++-- htdocs/core/class/html.form.class.php | 1 + htdocs/expedition/fiche.php | 83 ++++++++++--------- 4 files changed, 63 insertions(+), 56 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 2d2466272e4..c788abeb48d 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1353,8 +1353,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, - $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->facnumber, $obj->idfac, $obj->iban, $obj->bic, $obj->datec, $obj->drum); $this->total = $this->total + $obj->somme; $i++; } @@ -1545,10 +1544,9 @@ class BonPrelevement extends CommonObject * @param string $row_bic rib.bic AS bic, * @param string $row_datec soc.datec, * @param string $row_drum soc.rowid AS drum - * @retrun void + * @return void */ - function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, - $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) + function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { $CrLf = "\n"; $Rowing = sprintf("%06d", $row_idfac); @@ -1663,6 +1661,11 @@ class BonPrelevement extends CommonObject /** * Write sender of request (me) * + * @param string $configuration conf + * @param date $ladate Date + * @param int $nombre 0 or 1 + * @param float $total Total + * @param string $CrLf End of line character * @return SEPA */ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n') @@ -1688,7 +1691,7 @@ class BonPrelevement extends CommonObject $pays = explode(':', $configuration->global->MAIN_INFO_SOCIETE_COUNTRY); $IdBon = sprintf("%05d", $obj->rowid); $RefBon = $obj->ref; - $type = (nombre == 1) ? 'FRST' : 'RCUR' ; + $type = ($nombre == 1) ? 'FRST' : 'RCUR' ; // SEPA Paiement Information $XML_SEPA_INFO = ''; $XML_SEPA_INFO .= ' '.$CrLf; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 8693ff31b70..795d4b99e84 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -323,9 +323,9 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function getLibStatut($mode=0,$alreadypayed=-1) + function getLibStatut($mode=0,$alreadypaid=-1) { - return $this->LibStatut($this->paye,$mode,$alreadypayed); + return $this->LibStatut($this->paye,$mode,$alreadypaid); } /** @@ -336,7 +336,7 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function LibStatut($statut,$mode=0,$alreadypayed=-1) + function LibStatut($statut,$mode=0,$alreadypaid=-1) { global $langs; $langs->load('customers'); @@ -354,24 +354,26 @@ class ChargeSociales extends CommonObject } if ($mode == 2) { - if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } if ($mode == 3) { - if ($statut == 0) return img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } if ($mode == 4) { - if ($statut == 0 && $alreadypayed <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); - if ($statut == 0 && $alreadypayed > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); + if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); + if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } if ($mode == 5) { - if ($statut == 0 && $alreadypayed <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); - if ($statut == 0 && $alreadypayed > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); + if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); + if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9583414b6dc..6b73b7ba53a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -729,6 +729,7 @@ class Form * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $limit Maximum number of elements * @return string HTML string with * @deprecated Use select_thirdparty instead */ diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 7ed44102a4c..a7a847f8b0c 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -856,47 +856,48 @@ if ($action == 'create') if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; } - if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_array($product->stock_warehouse[GETPOST('entrepot_id','int')] ))) { - // Quantity to send - print ''; - - // Stock - if (! empty($conf->stock->enabled)) - { - print ''; - } - - print "\n"; - - // Show subproducts of product + if (empty($conf->productbatch->enabled) || ! ($product->hasbatch() and is_array($product->stock_warehouse[GETPOST('entrepot_id','int')]))) + { + // Quantity to send + print ''; + + // Stock + if (! empty($conf->stock->enabled)) + { + print ''; + } + + print "\n"; + + // Show subproducts of product if (! empty($conf->global->PRODUIT_SOUSPRODUITS) && $line->fk_product > 0) { $product->get_sousproduits_arbo();
".$langs->trans("VATIsNotUsedDesc")."
'; - if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - print ''; - print ''; - } - else print $langs->trans("NA"); - print ''; - if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) - { - // Show warehouse combo list - $ent = "entl".$indiceAsked; - $idl = "idl".$indiceAsked; - $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); - print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product); - if ($tmpentrepot_id > 0 && $tmpentrepot_id == GETPOST('entrepot_id','int')) - { - //print $stock.' '.$quantityToBeDelivered; - if ($stock < $quantityToBeDelivered) - { - print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for entrepot_id but we may have change warehouse - } - } - } - else - { - print $langs->trans("Service"); - } - print '
'; + if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + print ''; + print ''; + } + else print $langs->trans("NA"); + print ''; + if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { + // Show warehouse combo list + $ent = "entl".$indiceAsked; + $idl = "idl".$indiceAsked; + $tmpentrepot_id = is_numeric(GETPOST($ent,'int'))?GETPOST($ent,'int'):GETPOST('entrepot_id','int'); + print $formproduct->selectWarehouses($tmpentrepot_id,'entl'.$indiceAsked,'',1,0,$line->fk_product); + if ($tmpentrepot_id > 0 && $tmpentrepot_id == GETPOST('entrepot_id','int')) + { + //print $stock.' '.$quantityToBeDelivered; + if ($stock < $quantityToBeDelivered) + { + print ' '.img_warning($langs->trans("StockTooLow")); // Stock too low for entrepot_id but we may have change warehouse + } + } + } + else + { + print $langs->trans("Service"); + } + print '