diff --git a/ChangeLog b/ChangeLog index 9ca1cc847e7..b6de1a1d94f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -85,6 +85,7 @@ For developers: - New: Add hook addHomeSetup. - New: Add trigger CATEGORY_LINK and CATEGORY_UNLINK. - New: A trigger can return an array of error strings instead of one error string. +- New: Add method to use a dictionnary as a combo box. WARNING: Following change may create regression for some external modules, but was necessary to make Dolibarr better: diff --git a/build/debian/README.howto b/build/debian/README.howto index abfa7f456fb..4978b686070 100644 --- a/build/debian/README.howto +++ b/build/debian/README.howto @@ -139,11 +139,11 @@ Warning: Name and email must match value into debian/control file (Entry added h > git-buildpackage -us -uc Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file - +Note: Package is built into directory ../build-area * If package .deb is ok: Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit -> git-buildpackage --git-tag +> git-buildpackage --git-tag-only --git-retag > git push --all ou git push origin --all > git push --tags @@ -195,10 +195,11 @@ Warning: Name and email must match value into debian/control file (Entry added h > git-buildpackage -us -uc Note: You can use git-buildpackage -us -uc --git-ignore-new if you want to test build with uncommited file +Note: Package is built into directory ../build-area * If package .deb is ok: Note: If there was errors managed manually, you may need to make a git commit but do not use option "amend" previous commit -> git-buildpackage --git-tag +> git-buildpackage --git-tag-only --git-retag > git push --all ou git push origin --all > git push --tags diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index c39c66b6e7b..49deff65c33 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -340,6 +340,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/template`; # Package not valid for most linux distributions (errors reported into compile.js). Package should be embed by modules to avoid problems. $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpmailer`; # Package not valid for most linux distributions (errors reported into file LICENSE). Package should be embed by modules to avoid problems. + $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/jquery/plugins/multiselect/MIT-LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/license.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpexcel/PHPExcel/Shared/PDF`; diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index 94941d53e6c..81723b8283d 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -1003,7 +1003,7 @@ if ($id > 0) { $project=new Project($db); $project->fetch($act->fk_project); - print $project->getNomUrl(1); + print $project->getNomUrl(1,'',1); } print ''; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index ee62ac5d977..e2da54015cc 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -875,14 +875,18 @@ else if ($action == 'add' && $user->rights->facture->creer) if ($id > 0) { - //If deposit invoice - if ($_POST['type'] == 3) { + // If deposit invoice + if ($_POST['type'] == 3) + { $typeamount=GETPOST('typedeposit','alpha'); $valuedeposit=GETPOST('valuedeposit','int'); - if ($typeamount=='amount') { + if ($typeamount=='amount') + { $amountdeposit=$valuedeposit; - }else { + } + else + { $amountdeposit=0; dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); @@ -890,19 +894,20 @@ else if ($action == 'add' && $user->rights->facture->creer) $classname = ucfirst($subelement); $srcobject = new $classname($db); - dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit line"); + dol_syslog("Try to find source object origin=".$object->origin." originid=".$object->origin_id." to add deposit lines"); $result=$srcobject->fetch($object->origin_id); if ($result > 0) { $totalamount=0; $lines = $srcobject->lines; - $num=count($lines); - for ($i=0;$i<$num;$i++) + $numlines=count($lines); + for ($i=0; $i<$numlines; $i++) { - $totalamount=+$lines[$i]->subprice; + $totalamount += $lines[$i]->subprice; } - if ($totalamount!=0) { + if ($totalamount!=0) + { $amountdeposit=($totalamount*$valuedeposit)/100; } } @@ -1585,7 +1590,7 @@ else if ($action == 'down' && $user->rights->facture->creer) /* * Add file in email form -*/ + */ if (GETPOST('addfile')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1600,7 +1605,7 @@ if (GETPOST('addfile')) /* * Remove file in email form -*/ + */ if (! empty($_POST['removedfile'])) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1616,7 +1621,7 @@ if (! empty($_POST['removedfile'])) /* * Send mail -*/ + */ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_POST['cancel']) { $langs->load('mails'); @@ -1790,7 +1795,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO /* * Generate document -*/ + */ else if ($action == 'builddoc') // En get ou en post { $object->fetch($id); @@ -2019,7 +2024,7 @@ if ($action == 'create') $remise_percent = (! empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(! empty($soc->remise_percent)?$soc->remise_percent:0)); $remise_absolue = (! empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(! empty($soc->remise_absolue)?$soc->remise_absolue:0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:0; - + //Replicate extrafields $objectsrc->fetch_optionals($originid); $object->array_options=$objectsrc->array_options; @@ -2058,8 +2063,7 @@ if ($action == 'create') // Ref print ''.$langs->trans('Ref').''.$langs->trans('Draft').''; - // Tiers - print ''; + // Thirdparty print ''.$langs->trans('Customer').''; if($soc->id > 0) { @@ -2076,7 +2080,7 @@ if ($action == 'create') } print ''."\n"; - // Factures predefinies + // Predefined invoices if (empty($origin) && empty($originid) && $socid > 0) { $sql = 'SELECT r.rowid, r.titre, r.total_ttc'; @@ -2183,10 +2187,13 @@ if ($action == 'create') print ''; $desc=$form->textwithpicto($langs->trans("InvoiceDeposit"),$langs->transnoentities("InvoiceDepositDesc"),1); print ''; - if (($origin=='propal') || ($origin=='commande')) { - print ''; - print ''; + print '
'.$desc.''.$langs->trans('Value').':'; + if (($origin=='propal') || ($origin=='commande')) + { + print ''; + $arraylist=array('amount'=>'FixAmount','variable'=>'VarAmount'); + print $form->selectarray('typedeposit',$arraylist, GETPOST('typedeposit'), 0, 0, 0, '', 1); + print ''.$langs->trans('Value').':'; } print '
'; print ''."\n"; @@ -2455,6 +2462,7 @@ if ($action == 'create') print ''; } + print '
'; } else if ($id > 0 || ! empty($ref)) { @@ -3722,24 +3730,24 @@ else if ($id > 0 || ! empty($ref)) if (empty($somethingshown) && $object->statut > 0) { - + print ''.$langs->trans('LinkedOrder').''; - + print ''; + + print ''; } // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) @@ -3944,7 +3952,7 @@ $db->close(); function lier_commande(commande) { - + if(commande.style.display=='none') { commande.style.display='inline'; diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 159c834ea9e..c8fc4a917f2 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -83,17 +83,29 @@ class box_graph_invoices_permonth extends ModeleBoxes if ($user->rights->facture->lire) { - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb'; - $param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot'; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; + $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; - $shownb=GETPOST($param_shownb,'alpha',4); - $showtot=GETPOST($param_showtot,'alpha',4); + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $endyear=GETPOST($param_year,'int'); + $shownb=GETPOST($param_shownb,'alpha'); + $showtot=GETPOST($param_showtot,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $endyear=$tmparray['year']; + $shownb=$tmparray['shownb']; + $showtot=$tmparray['showtot']; + } if (empty($shownb) && empty($showtot)) $showtot=1; $nowarray=dol_getdate(dol_now(),true); - $endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='customer'; $userid=0; @@ -191,7 +203,7 @@ class box_graph_invoices_permonth extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.='
'; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 6c4c18824d6..45f3be02933 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -82,17 +82,29 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes if ($user->rights->fournisseur->facture->lire) { - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb'; - $param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot'; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; + $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; - $shownb=GETPOST($param_shownb,'alpha',4); - $showtot=GETPOST($param_showtot,'alpha',4); + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $endyear=GETPOST($param_year,'int'); + $shownb=GETPOST($param_shownb,'alpha'); + $showtot=GETPOST($param_showtot,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $endyear=$tmparray['year']; + $shownb=$tmparray['shownb']; + $showtot=$tmparray['showtot']; + } if (empty($shownb) && empty($showtot)) $showtot=1; $nowarray=dol_getdate(dol_now(),true); - $endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='supplier'; $userid=0; @@ -190,7 +202,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=' '.$langs->trans("NumberOfBillsByMonth"); $stringtoshow.='   '; $stringtoshow.=' '.$langs->trans("AmountOfBillsByMonthHT"); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 8c33c138623..17fc0215fef 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -83,17 +83,29 @@ class box_graph_orders_permonth extends ModeleBoxes if ($user->rights->commande->lire) { - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb'; - $param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot'; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; + $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; - $shownb=GETPOST($param_shownb,'alpha',4); - $showtot=GETPOST($param_showtot,'alpha',4); + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $endyear=GETPOST($param_year,'int'); + $shownb=GETPOST($param_shownb,'alpha'); + $showtot=GETPOST($param_showtot,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $endyear=$tmparray['year']; + $shownb=$tmparray['shownb']; + $showtot=$tmparray['showtot']; + } if (empty($shownb) && empty($showtot)) $showtot=1; $nowarray=dol_getdate(dol_now(),true); - $endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='customer'; $userid=0; @@ -191,7 +203,7 @@ class box_graph_orders_permonth extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index d85b0f7a09c..61cc4f8fe87 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -82,17 +82,29 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if ($user->rights->fournisseur->commande->lire) { - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb'; - $param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot'; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; + $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; - $shownb=GETPOST($param_shownb,'alpha',4); - $showtot=GETPOST($param_showtot,'alpha',4); + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $endyear=GETPOST($param_year,'int'); + $shownb=GETPOST($param_shownb,'alpha'); + $showtot=GETPOST($param_showtot,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $endyear=$tmparray['year']; + $shownb=$tmparray['shownb']; + $showtot=$tmparray['showtot']; + } if (empty($shownb) && empty($showtot)) $showtot=1; $nowarray=dol_getdate(dol_now(),true); - $endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='supplier'; $userid=0; @@ -190,7 +202,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=' '.$langs->trans("NumberOfOrdersByMonth"); $stringtoshow.='   '; $stringtoshow.=' '.$langs->trans("AmountOfOrdersByMonthHT"); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index e2b6dfe907c..a39b0acf1cb 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -82,20 +82,33 @@ class box_graph_product_distribution extends ModeleBoxes 'target'=>'none' // Set '' to get target="_blank" ); - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_showinvoicenb='DOLUSERCOOKIE_param'.$this->boxcode.'showinvoicenb'; - $param_showpropalnb='DOLUSERCOOKIE_param'.$this->boxcode.'showpropalnb'; - $param_showordernb='DOLUSERCOOKIE_param'.$this->boxcode.'showordernb'; - $showinvoicenb=GETPOST($param_showinvoicenb,'alpha',4); - $showpropalnb=GETPOST($param_showpropalnb,'alpha',4); - $showordernb=GETPOST($param_showordernb,'alpha',4); + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_showinvoicenb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showinvoicenb'; + $param_showpropalnb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showpropalnb'; + $param_showordernb='DOLUSERCOOKIE_box_'.$this->boxcode.'_showordernb'; + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $year=GETPOST($param_year,'int'); + $showinvoicenb=GETPOST($param_showinvoicenb,'alpha'); + $showpropalnb=GETPOST($param_showpropalnb,'alpha'); + $showordernb=GETPOST($param_showordernb,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $year=$tmparray['year']; + $showinvoicenb=$tmparray['showinvoicenb']; + $showpropalnb=$tmparray['showpropalnb']; + $showordernb=$tmparray['showordernb']; + } if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { $showpropalnb=1; $showinvoicenb=1; $showordernb=1; } if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) $showinvoicenb=0; if (empty($conf->propal->enabled) || empty($user->rights->propal->lire)) $showpropalnb=0; if (empty($conf->commande->enabled) || empty($user->rights->commande->lire)) $showordernb=0; $nowarray=dol_getdate(dol_now(),true); - $year=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($year)) $year=$nowarray['year']; $nbofgraph=0; if ($showinvoicenb) $nbofgraph++; @@ -300,7 +313,7 @@ class box_graph_product_distribution extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; if (! empty($conf->facture->enabled) || ! empty($user->rights->facture->lire)) { $stringtoshow.=' '.$langs->trans("ForCustomersInvoices"); diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index e09b19b45ad..8fd42d525fd 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -83,17 +83,29 @@ class box_graph_propales_permonth extends ModeleBoxes if ($user->rights->propal->lire) { - $param_year='DOLUSERCOOKIE_param'.$this->boxcode.'year'; - $param_shownb='DOLUSERCOOKIE_param'.$this->boxcode.'shownb'; - $param_showtot='DOLUSERCOOKIE_param'.$this->boxcode.'showtot'; + $param_year='DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_shownb='DOLUSERCOOKIE_box_'.$this->boxcode.'_shownb'; + $param_showtot='DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; - $shownb=GETPOST($param_shownb,'alpha',4); - $showtot=GETPOST($param_showtot,'alpha',4); + if (GETPOST('DOL_AUTOSET_COOKIE')) + { + $endyear=GETPOST($param_year,'int'); + $shownb=GETPOST($param_shownb,'alpha'); + $showtot=GETPOST($param_showtot,'alpha'); + } + else + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmparray=dol_json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode],true); + $endyear=$tmparray['year']; + $shownb=$tmparray['shownb']; + $showtot=$tmparray['showtot']; + } if (empty($shownb) && empty($showtot)) $showtot=1; $nowarray=dol_getdate(dol_now(),true); - $endyear=(GETPOST($param_year,'',4)?GETPOST($param_year,'int',4):$nowarray['year']); + if (empty($endyear)) $endyear=$nowarray['year']; $startyear=$endyear-1; $mode='customer'; $userid=0; @@ -196,7 +208,7 @@ class box_graph_propales_permonth extends ModeleBoxes $stringtoshow.='
'; // hideobject is to start hidden $stringtoshow.=''; $stringtoshow.=''; - $stringtoshow.=''; + $stringtoshow.=''; $stringtoshow.=' '.$langs->trans("NumberOfProposalsByMonth"); $stringtoshow.='   '; $stringtoshow.=' '.$langs->trans("AmountOfProposalsByMonthHT"); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 15bb2f9acf5..aec3884ac15 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1084,6 +1084,68 @@ class FormOther } + /** + * Return a HTML select list of bank accounts + * + * @param string $htmlname Name of select zone + * @param string $dictionnarytable Dictionnary table + * @param string $keyfield Field for key + * @param string $labelfield Label field + * @param string $selected Selected value + * @param int $useempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. + * @return void + */ + function select_dictionnary($htmlname,$dictionnarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0) + { + global $langs, $conf; + + $langs->load("admin"); + + $sql = "SELECT rowid, ".$keyfield.", ".$labelfield; + $sql.= " FROM ".MAIN_DB_PREFIX.$dictionnarytable; + $sql.= " ORDER BY ".$labelfield; + + dol_syslog(get_class($this)."::select_dictionnary sql=".$sql); + $result = $this->db->query($sql); + if ($result) + { + $num = $this->db->num_rows($result); + $i = 0; + if ($num) + { + print '"; + } + else + { + print $langs->trans("DictionnaryEmpty"); + } + } + else { + dol_print_error($this->db); + } + } + } ?> diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b509c41666a..7b21c9ca20c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3478,16 +3478,18 @@ function dol_html_entity_decode($a,$b,$c='UTF-8') /** * Replace htmlentities functions to manage errors + * http://php.net/manual/en/function.htmlentities.php * - * @param string $a Operand a - * @param string $b Operand b - * @param string $c Operand c - * @return string String encoded + * @param string $string The input string. + * @param int $flags Flags(see PHP doc above) + * @param string $encoding Encoding + * @param bool $double_encode When double_encode is turned off PHP will not encode existing html entities + * @return string $ret Encoded string */ -function dol_htmlentities($a,$b,$c='UTF-8') +function dol_htmlentities($string, $flags=null, $encoding='UTF-8', $double_encode=false) { // We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8; - $ret=@htmlentities($a,$b,$c); + $ret=@htmlentities($string, $flags, $encoding, $double_encode); return $ret; } diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 7b9ec52aef6..584a8e3494f 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -176,27 +176,34 @@ class modProjet extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); + $this->export_dependencies_array[$r]=array('task_time'=>'ppt.rowid'); + $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", - 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc"); + 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId",'p.ref'=>"ProjectRef",'p.datec'=>"DateCreation",'p.dateo'=>"DateDebutProjet",'p.datee'=>"DateFinProjet",'p.fk_statut'=>'ProjectStatus','p.description'=>"projectNote", + 'pt.rowid'=>'RefTask','pt.dateo'=>"TaskDateo",'pt.datee'=>"TaskDatee",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"DurationPlanned",'pt.progress'=>"Progress",'pt.description'=>"TaskDesc", + 'ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"); - //$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - $this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', - 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", - 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Duree",'pt.progress'=>"Number",'pt.description'=>"Text"); - - $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", - 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task"); + $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_pays:libelle', + 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", + 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Number",'pt.progress'=>"Number",'pt.description'=>"Text", + 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:Name",'ptt.note'=>"Text"); + $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company', + 's.tel'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', + 'f.rowid'=>"project",'f.ref'=>"project",'f.datec'=>"project",'f.duree'=>"project",'f.fk_statut'=>"project",'f.description'=>"project", + 'pt.rowid'=>'task','pt.dateo'=>"task",'pt.datee'=>"task",'pt.duration_effective'=>"task",'pt.planned_workload'=>"task",'pt.progress'=>"task",'pt.description'=>"task", + 'ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"); + + $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'projet_task as pt, '.MAIN_DB_PREFIX.'societe as s)'; - $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid AND p.rowid = pt.fk_projet '; + $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'projet as p, '.MAIN_DB_PREFIX.'societe as s)'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON (p.rowid = pt.fk_projet)"; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON (pt.rowid = ptt.fk_task)"; + $this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' AND p.entity = '.$conf->entity; - $r++; + } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 923930d5252..efa93e17aec 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -377,7 +377,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if (! empty($object->remise_percent)) $localtax2ligne-=($localtax2ligne*$object->remise_percent)/100; $vatrate=(string) $object->lines[$i]->tva_tx; - + // Retrieve type from database for backward compatibility with old records if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax @@ -470,8 +470,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } - // Pied de page - $this->_pagefoot($pdf,$object,$outputlangs); + // Pied de page + $this->_pagefoot($pdf, $object, $outputlangs); if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages(); $pdf->Close(); @@ -963,7 +963,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0,0,60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefSupplier")." : " . $outputlangs->convToOutputCharset($object->ref_supplier), '', 'R'); } - + $posy+=2; $pdf->SetFont('','', $default_font_size -1); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b128b48b6b5..32aa044b4e3 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -165,13 +165,21 @@ require_once 'filefunc.inc.php'; // If there is a POST parameter to tell to save automatically some POST params into a cookies, we do it if (! empty($_POST["DOL_AUTOSET_COOKIE"])) { - $tmplist=explode(',',$_POST["DOL_AUTOSET_COOKIE"]); - foreach ($tmplist as $value) + require_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + $tmpautoset=explode(':',$_POST["DOL_AUTOSET_COOKIE"],2); + $tmplist=explode(',',$tmpautoset[1]); + $cookiearrayvalue=''; + foreach ($tmplist as $tmpkey) { - //var_dump('setcookie key='.$value.' value='.$_POST[$value]); - setcookie($value, empty($_POST[$value])?'':$_POST[$value], empty($_POST[$value])?0:(time()+(86400*354)), '/'); // keep cookie 1 year - if (empty($_POST[$value])) unset($_COOKIE[$value]); + $postkey=$tmpautoset[0].'_'.$tmpkey; + //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]); + if (! empty($_POST[$postkey])) $cookiearrayvalue[$tmpkey]=$_POST[$postkey]; } + $cookiename=$tmpautoset[0]; + $cookievalue=dol_json_encode($cookiearrayvalue); + //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue); + setcookie($cookiename, empty($cookievalue)?'':$cookievalue, empty($cookievalue)?0:(time()+(86400*354)), '/'); // keep cookie 1 year + if (empty($cookievalue)) unset($_COOKIE[$cookiename]); } // Init session. Name of session is specific to Dolibarr instance. diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 49b42decef4..861ad5c9ef8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1664,6 +1664,41 @@ class Societe extends CommonObject return $contacts; } + /** + * Renvoie la liste des contacts de cette societe + * + * @return array $contacts tableau des contacts + */ + function contact_array_objects() + { + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + $contacts = array(); + + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = '".$this->id."'"; + $resql=$this->db->query($sql); + if ($resql) + { + $nump = $this->db->num_rows($resql); + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($resql); + $contact = new Contact($this->db); + $contact->fetch($obj->rowid); + $contacts[] = $contact; + $i++; + } + } + } + else + { + dol_print_error($this->db); + } + return $contacts; + } + /** * Return property of contact from its id *