From bac1f95e306ff2f5beb5f9d391ef58132b45d30a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2016 12:11:57 +0200 Subject: [PATCH 01/20] Fix consistency on permission. Missing the getLibStatut function. --- htdocs/accountancy/admin/card.php | 22 +++---- .../class/accountingaccount.class.php | 61 ++++++++++++++++++- 2 files changed, 71 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 057e2f0484c..fce8b5b6a7f 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -43,13 +43,13 @@ $rowid = GETPOST('rowid', 'int'); $cancel = GETPOST('cancel'); // Security check -if (! $user->admin) - accessforbidden(); + $object = new AccountingAccount($db); // Action -if ($action == 'add') { +if ($action == 'add' && $user->rights->accounting->chartofaccount) +{ if (! $cancel) { $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; @@ -97,7 +97,7 @@ if ($action == 'add') { } header("Location: account.php"); exit; -} else if ($action == 'edit') { +} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) { if (! $cancel) { $result = $object->fetch($id); @@ -145,7 +145,7 @@ if ($action == 'add') { header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); exit(); } -} else if ($action == 'delete') { +} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) { $result = $object->fetch($id); if (! empty($object->id)) { @@ -329,14 +329,14 @@ if ($action == 'create') { print '' . $object->pcg_subtype . ''; // Active - print '' . $langs->trans("Activated") . ''; + print '' . $langs->trans("Status") . ''; print ''; - - if (empty($object->active)) { + print $object->getLibStatut(4); + /*if (empty($object->active)) { print img_picto($langs->trans("Disabled"), 'switch_off'); } else { print img_picto($langs->trans("Activated"), 'switch_on'); - } + }*/ print ''; @@ -350,13 +350,13 @@ if ($action == 'create') { print '
'; - if ($user->admin) { + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Modify') . ''; } else { print '' . $langs->trans('Modify') . ''; } - if ($user->admin) { + if (! empty($user->rights->accounting->chartofaccount)) { print '' . $langs->trans('Delete') . ''; } else { print '' . $langs->trans('Delete') . ''; diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 690f3785df1..00a16a227e3 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -45,7 +45,8 @@ class AccountingAccount extends CommonObject var $label; var $fk_user_author; var $fk_user_modif; - var $active; + var $active; // duplicate with status + var $status; /** * Constructor @@ -103,6 +104,7 @@ class AccountingAccount extends CommonObject $this->fk_user_author = $obj->fk_user_author; $this->fk_user_modif = $obj->fk_user_modif; $this->active = $obj->active; + $this->status = $obj->active; return $this->id; } else { @@ -465,4 +467,61 @@ class AccountingAccount extends CommonObject return - 1; } } + + + /** + * Retourne le libelle du statut d'un user (actif, inactif) + * + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut($this->status,$mode); + } + + /** + * Renvoi le libelle d'un statut donne + * + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + $langs->load('users'); + + if ($mode == 0) + { + $prefix=''; + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 1) + { + if ($statut == 1) return $langs->trans('Enabled'); + if ($statut == 0) return $langs->trans('Disabled'); + } + if ($mode == 2) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 3) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); + } + if ($mode == 4) + { + if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + } + if ($mode == 5) + { + if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + } + } } From e6503c0d368182ad8b68c622fdc919d956af7c5e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2016 12:52:28 +0200 Subject: [PATCH 02/20] Better explanation --- htdocs/accountancy/customer/index.php | 2 +- htdocs/accountancy/supplier/index.php | 2 +- htdocs/langs/en_US/accountancy.lang | 15 ++++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 18a18720569..1d670bc4ece 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -143,7 +143,7 @@ $textnextyear = ' ' . $langs->trans("DescVentilCustomer") . ''; +print $langs->trans("DescVentilCustomer") . '

'; print '
'; print '' . $langs->trans("ValidateHistory") . ''; print '' . $langs->trans("CleanFixHistory", $year_current) . ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 674edd94e86..36a750b57dd 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -140,7 +140,7 @@ $textnextyear = ' ' . $langs->trans("DescVentilSupplier") . ''; +print $langs->trans("DescVentilSupplier") . '

'; print '
'; print '' . $langs->trans("ValidateHistory") . ''; print '' . $langs->trans("CleanFixHistory", $year_current) . ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 3c8a431fbb6..469453df0ee 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -116,15 +116,15 @@ Pcgtype=Class of account Pcgsubtype=Under class of account Accountparent=Root of the account -DescVentilCustomer=Consult here the annual breakdown accounting of your invoices customers +DescVentilCustomer=Consult here the list of customer invoice lines binded or not yet binded to a product bookkeeping account TotalVente=Total turnover before tax TotalMarge=Total sales margin -DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their accounting account -DescVentilTodoCustomer=Ventilate your lines of customer invoice with an accounting account +DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their product bookkeeping account +DescVentilTodoCustomer=Bind your lines of customer invoice with a product bookkeeping account ChangeAccount=Change the accounting account for lines selected by the account: Vide=- -DescVentilSupplier=Consult here the annual breakdown accounting of your invoices suppliers -DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account +DescVentilSupplier=Consult here the list of supplier invoice lines binded or not yet binded to a product bookkeeping account +DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their bookkeeping account ValidateHistory=Validate Automatically @@ -171,3 +171,8 @@ Formula=Formula ErrorNoAccountingCategoryForThisCountry=No accounting category are available for this country ExportNotSupported=The export format setuped is not supported into this page BookeppingLineAlreayExists=Lines already existing into bookeeping + + +Binded=Lines binded +To bind=Lines to bind + From 2b8255590a61eb48d7c2be1e5f21e2f6a965af2d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2016 13:55:46 +0200 Subject: [PATCH 03/20] Better error message --- htdocs/commande/class/commande.class.php | 2 +- htdocs/core/lib/cron.lib.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3680672bc53..e554990892c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -276,7 +276,7 @@ class Commande extends CommonOrder if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate)))) { - $this->error='ErrorPermissionDenied'; + $this->error='NotEnoughPermissions'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index d7a0a57ac37..7141d1df882 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -100,10 +100,12 @@ function dol_print_cron_urls() print img_picto('','object_globe.png').' '.$url."
\n"; print '
'; - + $logintouse = 'firstadmin'; + if ($user->admin) $logintouse = $user->login; + print ''.$langs->trans("FileToLaunchCronJobs").':
'; - $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$user->login.' [cronjobid]'; + $file='/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY)?'securitykey':''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; print '
\n"; print '
'; @@ -116,7 +118,7 @@ function dol_print_cron_urls() { print $langs->trans("CronExplainHowToRunUnix"); print '
'; - print '
'; + print '
'; } else { From 17d9c158251f8e7ac268b37d259e51026e05003a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2016 14:02:54 +0200 Subject: [PATCH 04/20] Better error message --- scripts/cron/cron_run_jobs.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 1d27f03cff9..e10d089c2a8 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -157,7 +157,8 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->fetch($line->id); if ($result<0) { - echo "Error cronjob->fetch: ".$cronjob->error; + echo "Error cronjob->fetch: ".$cronjob->error."\n"; + echo "Failed to fetch job ".$line->id."\n"; dol_syslog("cron_run_jobs.php::fetch Error ".$cronjob->error, LOG_ERR); exit(-1); } @@ -165,7 +166,9 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->run_jobs($userlogin); if ($result<0) { - echo "Error cronjob->run_job: ".$cronjob->error; + echo "Error cronjob->run_job: ".$cronjob->error."\n"; + echo "At least one job failed. Go on menu Home-Setup-Admin tools to see result for each job.\n"; + echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::run_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); } @@ -174,7 +177,8 @@ if(is_array($object->lines) && (count($object->lines)>0)) $result=$cronjob->reprogram_jobs($userlogin, $now); if ($result<0) { - echo "Error cronjob->reprogram_job: ".$cronjob->error; + echo "Error cronjob->reprogram_job: ".$cronjob->error."\n"; + echo "Enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::reprogram_jobs Error ".$cronjob->error, LOG_ERR); exit(-1); } From 8d2ae73663eba0a0c144ba58d3d2f2e540898636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Sep 2016 10:56:35 +0200 Subject: [PATCH 05/20] FIX Menu users not visible on dolidroid. --- htdocs/core/get_menudiv.php | 2 +- htdocs/core/menus/standard/eldy.lib.php | 8 +++++--- htdocs/core/menus/standard/eldy_menu.php | 11 ++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index b8eae83d4eb..655e10afd67 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -85,7 +85,7 @@ if (! class_exists('MenuManager')) } $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager->loadMenu('all','all'); - +//var_dump($menumanager->tabMenu);exit; $menumanager->showmenu('jmobile'); print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index c3104ae48da..748a4532cb5 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -434,7 +434,8 @@ function print_end_menu_array() /** * Core function to output left menu eldy - * + * Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home) + * * @param DoliDB $db Database handler * @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add) * @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add) @@ -442,7 +443,7 @@ function print_end_menu_array() * @param Menu $menu Object Menu to return back list of menu entries * @param int $noout Disable output (Initialise &$menu only). * @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x' - * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all) + * @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not efined in session. * @param array $moredata An array with more data to output * @return int nb of menu entries */ @@ -586,7 +587,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users'); if ($user->rights->user->user->lire) { - if (! empty($leftmenu) && $leftmenu=="users") + if (empty($leftmenu) || $leftmenu=="users") { $newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin); $newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home'); @@ -597,6 +598,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin); } } + } diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 5800e4b5d7a..db1a7b8392f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -105,6 +105,8 @@ class MenuManager $menuArbo = new Menubase($this->db,'eldy'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu); $this->tabMenu=$tabMenu; + + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } } @@ -150,8 +152,9 @@ class MenuManager if ($mode == 'jmobile') { - print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); + print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // Fill this->menu that is empty with top menu + print ''."\n"; foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { @@ -169,8 +172,9 @@ class MenuManager $tmpmainmenu=$val['mainmenu']; $tmpleftmenu='all'; $submenu=new Menu(); - print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); - $nexturl=dol_buildpath($submenu->liste[0]['url'],1); + print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home) + //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu);exit; } + $nexturl=dol_buildpath($submenu->liste[0]['url'],1); $canonrelurl=preg_replace('/\?.*$/','',$relurl); $canonnexturl=preg_replace('/\?.*$/','',$nexturl); @@ -194,6 +198,7 @@ class MenuManager print ''; print ''."\n"; } + foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'] { $showmenu=true; From 2a6d8e77dbf73788803ada5707efc2a5610907c1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Sep 2016 11:45:36 +0200 Subject: [PATCH 06/20] FIX Lost filter on opportunities --- htdocs/install/mysql/migration/3.7.0-3.8.0.sql | 2 +- htdocs/projet/class/project.class.php | 2 +- htdocs/projet/list.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql index 068fbc753cb..9669fe89e54 100755 --- a/htdocs/install/mysql/migration/3.7.0-3.8.0.sql +++ b/htdocs/install/mysql/migration/3.7.0-3.8.0.sql @@ -724,7 +724,7 @@ INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES ( INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (3,'PROPO' ,'Proposal', 30, 40,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (4,'NEGO' ,'Negotiation', 40, 60,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (5,'PENDING','Pending', 50, 50,0); -INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WIN' ,'Won', 60, 100,1); +INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (6,'WON' ,'Won', 60, 100,1); INSERT INTO llx_c_lead_status(rowid,code,label,position,percent,active) VALUES (7,'LOST' ,'Lost', 70, 0,1); diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index ef4d4d7d20f..38135a898e0 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -767,7 +767,7 @@ class Project extends CommonObject if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { - // TODO What to do if fk_opp_status is not code 'WIN' or 'LOST' + // TODO What to do if fk_opp_status is not code 'WON' or 'LOST' } dol_syslog(get_class($this)."::setClose", LOG_DEBUG); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 04edadda890..5928ca09cac 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -266,7 +266,7 @@ if ($search_opp_status) { if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL"; - if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WIN','LOST'))"; + if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))"; if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL"; } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); @@ -327,8 +327,8 @@ if ($resql) if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status >= 0) $param.='&search_status='.$search_status; - if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); - if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); + if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); + if ((is_numeric($search_opp_percent) && $search_opp_percent >= 0) || in_array($search_opp_percent, array('all','openedopp','none'))) $param.='&search_opp_percent='.urlencode($search_opp_percent); if ($search_public != '') $param.='&search_public='.$search_public; if ($search_user > 0) $param.='&search_user='.$search_user; if ($search_sale > 0) $param.='&search_sale='.$search_sale; From 5d26565199bacb9441158f28c255692f141d9c07 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Sep 2016 15:41:08 +0200 Subject: [PATCH 07/20] Package add version into xml integrity file. --- build/generate_filecheck_xml.php | 26 ++++++++++++++++++++++++-- htdocs/install/.gitignore | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/build/generate_filecheck_xml.php b/build/generate_filecheck_xml.php index 665bb3a65d1..1bc0e2b6620 100644 --- a/build/generate_filecheck_xml.php +++ b/build/generate_filecheck_xml.php @@ -32,11 +32,33 @@ if (substr($sapi_type, 0, 3) == 'cgi') { exit; } +require_once($path."../htdocs/master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); -// Main + +/* + * Main + */ + +if (empty($argv[1])) +{ + print "Usage: ".$script_file." release=x.y.z\n"; + exit -1; +} parse_str($argv[1]); + +if ($release != DOL_VERSION) +{ + print 'Error: release is not version declared into filefunc.in.php.'."\n"; + exit -1; +} + //$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml'; -$outputfile=dirname(__FILE__).'/../htdocs/install/filelist.xml'; +$outputdir=dirname(__FILE__).'/../htdocs/install'; +print 'Delete current files '.$outputdir.'/filelist*.xml'."\n"; +dol_delete_file($outputdir.'/filelist*.xml',0,1,1); + +$outputfile=$outputdir.'/filelist-'.$release.'.xml'; $fp = fopen($outputfile,'w'); fputs($fp, ''."\n"); fputs($fp, ''."\n"); diff --git a/htdocs/install/.gitignore b/htdocs/install/.gitignore index 7e55df64ce7..85797d21c95 100644 --- a/htdocs/install/.gitignore +++ b/htdocs/install/.gitignore @@ -1 +1 @@ -/filelist.xml +/filelist*.xml From 7bf1d6cc9cee80323977b824909d628a81bbd085 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Sep 2016 16:05:33 +0200 Subject: [PATCH 08/20] Push file signature on server --- ChangeLog | 25 +++++++++++++++++++ ...heck_xml.php => generate_filelist_xml.php} | 0 build/makepack-dolibarr.pl | 9 ++++++- 3 files changed, 33 insertions(+), 1 deletion(-) rename build/{generate_filecheck_xml.php => generate_filelist_xml.php} (100%) diff --git a/ChangeLog b/ChangeLog index ce28c4a577e..db688e220a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,31 @@ Upgrading to any other version or any other database system is abolutely require make a Dolibarr upgrade. +***** ChangeLog for 4.0.1 compared to 4.0.0 ***** +FIX #2853 +FIX #2991 +FIX #3128 +FIX: #5699 +FIX #5734 +FIX : #5776 +FIX alignement of intervention status +FIX Clean of search fields +FIX Creation of donation should go back on card after creation +FIX Date visible on project overview +FIX Execute a dedicated job from its id may results of launching other jobs too. +FIX: Failed to export contact categories with contact extra fields +FIX inversion customer/supplier price +FIX link "back to list" was not visible. +FIX Lost filter on opportunities +FIX Mandatory field payment term was not css highlighted. +FIX Menu users not visible on dolidroid. +FIX SEC for HTB23302 +FIX The email test sender in email setup was broken +FIX Translation of "Name" is not a good choice for floow-up. +FIX Update of maxnbrun on job list failed. +FIX Value of payment term and project are not set on correct default value when invoice generated from template. +FIX: vat dictionary should allow enter and edit multiple values for localtaxes, separated by: (ex -19:-15) + ***** ChangeLog for 4.0.0 compared to 3.9.* ***** For users: diff --git a/build/generate_filecheck_xml.php b/build/generate_filelist_xml.php similarity index 100% rename from build/generate_filecheck_xml.php rename to build/generate_filelist_xml.php diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index ac735c59e0d..1883f1814da 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -317,8 +317,13 @@ print "\n"; if ($CHOOSEDTARGET{'-CHKSUM'}) { print 'Create xml check file with md5 checksum with command php '.$SOURCE.'/build/generate_filecheck_xml.php release='.$MAJOR.'.'.$MINOR.'.'.$BUILD."\n"; - $ret=`php $SOURCE/build/generate_filecheck_xml.php release=$MAJOR.$MINOR.$BUILD`; + $ret=`php $SOURCE/build/generate_filelist_xml.php release=$MAJOR.$MINOR.$BUILD`; print $ret."\n"; + # Copy to final dir + $NEWDESTI=$DESTI; + print "Copy \"$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml\" to $NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml\n"; + use File::Copy qw(copy); + copy "$SOURCE/htdocs/install/filelist-$MAJOR.$MINOR.$BUILD.xml", "$NEWDESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"; } @@ -1132,6 +1137,7 @@ if ($nboftargetok) { print "\nList of files to publish (BUILD=$BUILD)\n"; %filestoscansf=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'Dolibarr installer for Fedora-Redhat-Mandriva-Opensuse (DoliRpm)', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', @@ -1140,6 +1146,7 @@ if ($nboftargetok) { "$DESTI/standard/$FILENAMETGZ.zip"=>'Dolibarr ERP-CRM' ); %filestoscanstableasso=( + "$DESTI/signatures/filelist-$MAJOR.$MINOR.$BUILD.xml"=>'signatures', "$DESTI/package_rpm_generic/$FILENAMERPM"=>'package_rpm_generic', "$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu', "$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu', From aae4524fe21d44e1e24f9333f655d66d4a36e682 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Sep 2016 18:38:48 +0200 Subject: [PATCH 09/20] Debug module accountancy --- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- .../class/html.formventilation.class.php | 12 +++++++----- htdocs/accountancy/customer/index.php | 13 +++++++++---- htdocs/accountancy/customer/lines.php | 10 +++++----- htdocs/accountancy/supplier/index.php | 12 ++++++++---- htdocs/accountancy/supplier/lines.php | 6 +++--- htdocs/langs/en_US/accountancy.lang | 14 +++++++++----- 8 files changed, 43 insertions(+), 28 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 736aec48644..b0949a7007f 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -64,7 +64,7 @@ $formventilation = new FormVentilation($db); $formother = new FormOther($db); $form = new Form($db); -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $search_accountancy_code_start = ''; $search_accountancy_code_end = ''; diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 7e4e898408f..eb27d4cbefe 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -277,7 +277,7 @@ if ($result < 0) { } if ($action == 'delmouv') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt'), 'delmouvconfirm', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?mvt_num=' . GETPOST('mvt_num'), $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1); print $formconfirm; } if ($action == 'delbookkeepingyear') { diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 9294cf7f6a8..738a98bb57e 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -308,14 +308,16 @@ class FormVentilation extends Form /** * Return HTML combo list of years existing into book keepping * - * @param string $selected Preselected value - * @param string $htmlname Name of HTML select object - * @param int $useempty Affiche valeur vide dans liste - * @param string $output_format (html/opton (for option html only)/array (to return options arrays + * @param string $selected Preselected value + * @param string $htmlname Name of HTML select object + * @param int $useempty Affiche valeur vide dans liste + * @param string $output_format Html/option (for option html only)/array (to return options arrays * @return string/array */ function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') { + global $langs; + $out_array = array(); $sql = "SELECT DISTINCT code_journal"; @@ -330,7 +332,7 @@ class FormVentilation extends Form return -1; } while ($obj = $this->db->fetch_object($resql)) { - $out_array[$obj->code_journal] = $obj->code_journal; + $out_array[$obj->code_journal] = $obj->code_journal?$obj->code_journal:$langs->trans("NotDefined"); // TODO Not defined is accepted ? We should avoid this, shouldn't we ? } $this->db->free($resql); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 1d670bc4ece..be23efb56ea 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -85,7 +85,7 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } } elseif ($action == 'fixaccountancycode') { $error = 0; @@ -133,9 +133,11 @@ if ($action == 'validatehistory') { } } + /* * View */ + llxHeader('', $langs->trans("CustomersVentilation")); $textprevyear = '' . img_previous() . ''; @@ -143,11 +145,14 @@ $textnextyear = ' 
'; +print $langs->trans("DescVentilCustomer") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '
'; +print '
'; print '
'; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 31e4ea7ccff..a579daf1a9d 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -263,7 +263,7 @@ if ($result) { print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "fd.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("IntracommunityVATNumber"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Ventilate") . '
/', '', '', '', '', 'align="center"'); print "\n"; @@ -272,11 +272,11 @@ if ($result) { print ''; print ''; print ''; - print ''; - print '%'; + print ''; + print '%'; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 36a750b57dd..2506267ac15 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -81,7 +81,7 @@ if ($action == 'validatehistory') { setEventMessages($db->lasterror(), null, 'errors'); } else { $db->commit(); - setEventMessages($langs->trans('Dispatched'), null, 'mesgs'); + setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } } elseif ($action == 'fixaccountancycode') { $error = 0; @@ -140,11 +140,15 @@ $textnextyear = ' 
'; +print $langs->trans("DescVentilSupplier") . '
'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '
'; +print '
'; + print '
'; $y = $year_current; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 18b1c4b6b74..bbb76f7c15c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -223,9 +223,9 @@ if ($result) { print ''; print ''; print ''; - print ''; - print '%'; - print ''; + print ''; + print '%'; + print ''; print ' '; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 469453df0ee..99c2779768b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -29,7 +29,7 @@ NewAccount=New accounting account Create=Create CreateMvts=Create movement UpdateMvts=Modification of a movement -WriteBookKeeping=Record accounts in general ledger +WriteBookKeeping=Write records in general ledger Bookkeeping=General ledger AccountBalance=Account balance @@ -89,7 +89,8 @@ NotMatch=Not Set DeleteMvt=Delete general ledger lines DelYear=Year to delete DelJournal=Journal to delete -ConfirmDeleteMvt=This will delete all line of of the general ledger for year and/or from a specifics journal +ConfirmDeleteMvt=This will delete all lines of the general ledger for year and/or from a specifics journal +ConfirmDeleteMvtPartial=This will delete the selected line(s) of the general ledger DelBookKeeping=Delete the records of the general ledger @@ -116,9 +117,11 @@ Pcgtype=Class of account Pcgsubtype=Under class of account Accountparent=Root of the account -DescVentilCustomer=Consult here the list of customer invoice lines binded or not yet binded to a product bookkeeping account TotalVente=Total turnover before tax TotalMarge=Total sales margin + +DescVentilCustomer=Consult here the list of customer invoice lines binded (or not) to a product bookkeeping account +DescVentilMore=In most cases, if you use predefined products or services and you set the account number on the product/service card, the application will be able to make all the binding between your invoice lines and the bookkeeping account of your chart of accounts, just in one click with the button "%s". If account was not set on product/service cards or if you still has some lines not binded to any account, you will have to make a manual binding from the menu "%s". DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their product bookkeeping account DescVentilTodoCustomer=Bind your lines of customer invoice with a product bookkeeping account ChangeAccount=Change the accounting account for lines selected by the account: @@ -126,7 +129,8 @@ Vide=- DescVentilSupplier=Consult here the list of supplier invoice lines binded or not yet binded to a product bookkeeping account DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their bookkeeping account -ValidateHistory=Validate Automatically +ValidateHistory=Bind Automatically +AutomaticBindingDone=Automatic binding done ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used MvtNotCorrectlyBalanced=Mouvement not correctly balanced. Credit = %s. Debit = %s @@ -160,7 +164,7 @@ OptionModeProductBuy=Mode purchases OptionModeProductSellDesc=Show all products with no accounting account defined for sales. OptionModeProductBuyDesc=Show all products with no accounting account defined for purchases. CleanFixHistory=Remove accountancy code from lines that not exists into charts of account -CleanHistory=Reset all accountancy for selected year +CleanHistory=Reset all bindings for selected year ## Dictionary Range=Range of accounting account From d079247b2b0131fe1d139fbf29334ad56c67aece Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 13:32:24 +0200 Subject: [PATCH 10/20] FIX #5813 Bug: Incoterms not being read correctly --- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 37e3c0f08d4..cc0d6478bb6 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -338,11 +338,6 @@ class pdf_crabe extends ModelePDFFactures $height_incoterms = 0; if ($conf->incoterm->enabled) { - if (is_object($object->thirdparty)) - { - $object->fk_incoterms=$object->thirdparty->fk_incoterms; - $object->location_incoterms=$object->thirdparty->location_incoterms; - } $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { From 03c60f1b7db0698e3983e58889cd37dcb78f1bcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 13:55:07 +0200 Subject: [PATCH 11/20] FIX #5802 Incoterms not set --- htdocs/comm/propal/class/propal.class.php | 6 +++++- htdocs/commande/card.php | 9 ++++++++- htdocs/compta/facture.php | 9 ++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index aaa8bf123cd..fa2d214f5da 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3224,7 +3224,11 @@ class PropaleLigne extends CommonObjectLine if (empty($this->fk_fournprice)) $this->fk_fournprice=0; if (! is_numeric($this->qty)) $this->qty = 0; if (empty($this->pa_ht)) $this->pa_ht=0; - + if (empty($this->multicurrency_subprice)) $this->multicurrency_subprice=0; + if (empty($this->multicurrency_total_ht)) $this->multicurrency_total_ht=0; + if (empty($this->multicurrency_total_vat)) $this->multicurrency_total_vat=0; + if (empty($this->multicurrency_total_ttc)) $this->multicurrency_total_ttc=0; + // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0 && $pa_ht_isemptystring) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1fcab20500f..dd9a45eae3d 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1595,7 +1595,14 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a19262144eb..abce93d9d90 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2441,7 +2441,14 @@ if ($action == 'create') print ''; print ''; print ''; - print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); + $incoterm_id = GETPOST('incoterm_id'); + $incoterm_location = GETPOST('location_incoterms'); + if (empty($incoterm_id)) + { + $incoterm_id = (!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms); + $incoterm_location = (!empty($objectsrc->location_incoterms) ? $objectsrc->location_incoterms : $soc->location_incoterms); + } + print $form->select_incoterms($incoterm_id, $incoterm_location); print ''; } From 91a9cb417876fed9b0764976310574111ab218cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 14:02:24 +0200 Subject: [PATCH 12/20] Fix solution to avoid the .noexe --- htdocs/core/lib/files.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e8cb4545507..21803bc3ad4 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1049,7 +1049,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable // Security: // Disallow file with some extensions. We renamed them. // Car si on a mis le rep documents dans un rep de la racine web (pas bien), cela permet d'executer du code a la demande. - if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file)) + if (preg_match('/\.htm|\.html|\.php|\.pl|\.cgi$/i',$dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) { $file_name.= '.noexe'; } From 538274998b13fac5d9a8b973be6638f373e64720 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 14:09:41 +0200 Subject: [PATCH 13/20] FIX #5770 Dolibarr doesn't modify correctly the hour of a task --- htdocs/projet/tasks/task.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 55b286047d9..0dd08bbd342 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -92,8 +92,8 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer) $object->description = $_POST['description']; $object->fk_task_parent = $task_parent; $object->planned_workload = $planned_workload; - $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); - $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); + $object->date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear']); + $object->date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear']); $object->progress = $_POST['progress']; // Fill array 'array_options' with data from add form From 43da410b9538437366c104e46a1c6702528dfb71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 16:33:42 +0200 Subject: [PATCH 14/20] FIX #5763 Bug: Cannot Create Supplier Price Request --- htdocs/product/class/product.class.php | 14 +++++++++----- htdocs/supplier_proposal/card.php | 22 +++++++++++----------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b68193a2078..9e9eb792a79 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -195,6 +195,8 @@ class Product extends CommonObject var $buyprice; public $fourn_pu; + public $fourn_price_base_type; + /** * @deprecated * @see ref_supplier @@ -1314,7 +1316,7 @@ class Product extends CommonObject * This also set some properties on product like ->buyprice, ->fourn_pu, ... * * @param int $prodfournprice Id du tarif = rowid table product_fournisseur_price - * @param double $qty Quantity asked + * @param double $qty Quantity asked or -1 to get first entry found * @param int $product_id Filter on a particular product id * @param string $fourn_ref Filter on a supplier ref. 'none' to exclude ref in search. * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) @@ -1337,7 +1339,7 @@ class Product extends CommonObject if ($resql) { $obj = $this->db->fetch_object($resql); - if ($obj && $obj->quantity > 0) // If found + if ($obj && $obj->quantity > 0) // If we found a supplier prices from the id of supplier price { if (!empty($conf->dynamicprices->enabled) && !empty($obj->fk_supplier_price_expression)) { @@ -1355,7 +1357,8 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier + $this->fourn_price_base_type = 'HT'; // Price base type $this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier @@ -1397,8 +1400,9 @@ class Product extends CommonObject } } $this->buyprice = $obj->price; // deprecated - $this->fourn_qty = $obj->quantity; // min quantity for price - $this->fourn_pu = $obj->price / $obj->quantity; // Prix unitaire du produit pour le fournisseur $fourn_id + $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier + $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier + $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->vatrate_supplier = $obj->tva_tx; // Vat ref supplier diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 4bd141da1a7..ac98de73c47 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -596,7 +596,8 @@ if (empty($reshook)) if (preg_match('/^idprod_([0-9]+)$/',GETPOST('idprodfournprice'), $reg)) { $idprod=$reg[1]; - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); + // Call to init properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist } @@ -604,37 +605,35 @@ if (empty($reshook)) { //$idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qty); // Just to see if a price exists for the quantity. Not used to found vat. $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), -1); // We force qty to -1 to be sure to find if a supplier price exist + $res=$productsupplier->fetch($idprod); } - if ($idprod > 0) { - $res=$productsupplier->fetch($idprod); - + $pu_ht = $productsupplier->fourn_pu; + $price_base_type = $productsupplier->fourn_price_base_type; + $type = $productsupplier->type; $label = $productsupplier->label; - $desc = $productsupplier->description; if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); - $type = $productsupplier->type; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); - + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $productsupplier->id, $remise_percent, - $type, - $productsupplier->price_ttc, + $price_base_type, + $pu_ttc, $tva_npr, $type, -1, @@ -646,6 +645,7 @@ if (empty($reshook)) $array_options, $ref_fourn ); + //var_dump($tva_tx);var_dump($productsupplier->fourn_pu);var_dump($price_base_type);exit; } if ($idprod == -99 || $idprod == 0) { From cf7327a2a2a1cd6856fdcc16610d480c6b469d34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 16:41:12 +0200 Subject: [PATCH 15/20] FIX #5750 Bug: CmailFile::server_parse enters an infinite loop if $server_response is false --- htdocs/core/class/CMailFile.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 563ec168d29..03f7e39bde8 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -1105,12 +1105,12 @@ class CMailFile $_retVal = true; // Indicates if Object was created or not $server_response = ''; - while ( substr($server_response,3,1) != ' ' ) + while (substr($server_response,3,1) != ' ') { - if( !( $server_response = fgets($socket, 256) ) ) + if (! ($server_response = fgets($socket, 256)) ) { $this->error="Couldn't get mail server response codes"; - $_retVal = false; + return false; } } From b45ea754eca055f9593dcff99f1f2fba7cec6901 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 16:58:35 +0200 Subject: [PATCH 16/20] FIX #5748 Bug: Error updating to 4.0.1 with Postgresql. Field must be varchar. --- htdocs/install/mysql/migration/3.9.0-4.0.0.sql | 4 ++-- htdocs/install/mysql/tables/llx_accounting_account.sql | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql index e90205d1dc3..3e9c7b66ffd 100644 --- a/htdocs/install/mysql/migration/3.9.0-4.0.0.sql +++ b/htdocs/install/mysql/migration/3.9.0-4.0.0.sql @@ -396,8 +396,8 @@ INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, INSERT INTO llx_c_accounting_category (rowid, code, label, range_account, sens, category_type, formula, position, fk_country, active) VALUES ( 3,'MARGE',"Marge commerciale", '', 0, 1, '1 + 2', '30', 1, 1); UPDATE llx_accounting_account SET account_parent = '0' WHERE account_parent = ''; --- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent integer DEFAULT 0; --- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent TYPE integer USING account_parent::integer; +-- VMYSQL4.1 ALTER TABLE llx_accounting_account MODIFY COLUMN account_parent varchar(32) DEFAULT '0'; +-- VPGSQL8.2 ALTER TABLE llx_accounting_account ALTER COLUMN account_parent SET DEFAULT '0'; CREATE TABLE llx_accounting_journal ( diff --git a/htdocs/install/mysql/tables/llx_accounting_account.sql b/htdocs/install/mysql/tables/llx_accounting_account.sql index 1d85db2cc48..316aeca2069 100644 --- a/htdocs/install/mysql/tables/llx_accounting_account.sql +++ b/htdocs/install/mysql/tables/llx_accounting_account.sql @@ -29,7 +29,7 @@ create table llx_accounting_account pcg_type varchar(20) NOT NULL, pcg_subtype varchar(20) NOT NULL, account_number varchar(32) NOT NULL, - account_parent varchar(32) DEFAULT '', -- Hierarchic parent + account_parent varchar(32) DEFAULT '0', -- Hierarchic parent label varchar(255) NOT NULL, fk_accounting_category integer DEFAULT 0, fk_user_author integer DEFAULT NULL, From 521008a6981fa380fac78ffd74fa01bfd977d547 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 17:27:52 +0200 Subject: [PATCH 17/20] FIX #5746 chrome php Try a fix. Not sure it solved all problems reported --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/core/modules/syslog/mod_syslog_chromephp.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8320e4ec672..e1e1b833248 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5365,7 +5365,7 @@ function printCommonFooter($zone='private') print ''."\n"; print "page_y=getParameterByName('page_y', 0);"; - print "if (page_y > 0) $('html, body').scrollTop(page_y);"; + print "if (page_y > 0) $('html, body').scrollTop(page_y);\n"; print ''."\n"; print 'jQuery(".reposition").click(function() { diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index adcaa9d7f00..42a660ab0ae 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -121,7 +121,14 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); + if (is_object($langs)) // $langs may not be defined yet. + { + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); + } + else + { + $errors[] = "ErrorFailedToOpenFile ChromePhp.class.php or ChromePhp.php"; + } } return $errors; @@ -151,7 +158,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface $res = @include_once('ChromePhp.php'); if (! $res) $res=@include_once('ChromePhp.class.php'); set_include_path($oldinclude); - + ob_start(); // To be sure headers are not flushed until all page is completely processed if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); From 4dfdf29a550ef30b39c608673eb76740edcf6008 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 18:00:17 +0200 Subject: [PATCH 18/20] FIX #5742 error on project list if an extra field separator is added. --- dev/skeletons/skeleton_list.php | 2 +- htdocs/core/tpl/admin_extrafields_add.tpl.php | 39 ++++++++++++------- .../core/tpl/admin_extrafields_edit.tpl.php | 39 ++++++++++++------- htdocs/projet/list.php | 2 +- 4 files changed, 52 insertions(+), 30 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 670f13fc3f0..38aa50cf593 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -220,7 +220,7 @@ $sql.= " t.rowid,"; $sql.= " t.field1,"; $sql.= " t.field2"; // Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 25b86cdc0bf..acf7a041408 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -35,6 +35,8 @@ var unique = jQuery("#unique"); var required = jQuery("#required"); var default_value = jQuery("#default_value"); + var alwayseditable = jQuery("#alwayseditable"); + var list = jQuery("#list"); '); jQuery("#type").change(function() { @@ -80,7 +91,7 @@ - + diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 9f894095807..94132731829 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -27,6 +27,8 @@ var unique = jQuery("#unique"); var required = jQuery("#required"); var default_value = jQuery("#default_value"); + var alwayseditable = jQuery("#alwayseditable"); + var list = jQuery("#list"); - + diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 5928ca09cac..692b3038909 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -210,7 +210,7 @@ $sql.= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, $sql.= ", s.nom as name, s.rowid as socid"; $sql.= ", cls.code as opp_status_code"; // Add fields for extrafields -foreach ($extrafields->attribute_list as $key => $val) $sql.=",ef.".$key.' as options_'.$key; +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook From ea0687f613cfe94d3b1ae34ff6837954af071252 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 18:22:30 +0200 Subject: [PATCH 19/20] FIX Vat not visible in dictionnary --- .../class/html.formventilation.class.php | 19 +++++++++---------- htdocs/admin/dict.php | 13 ++++++------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 738a98bb57e..f4e255f6dba 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -62,17 +62,16 @@ class FormVentilation extends Form /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts - * @param string $htmlname Name of field in html form - * @param int $showempty Add an empty field - * @param array $event Event options - * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1) - * @param int $select_out set value returned by select 0=rowid (default), 1=account_number - * @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number - * + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form + * @param int $showempty Add an empty field + * @param array $event Event options + * @param int $select_in selectid value is a aa.rowid (0 default) or aa.account_number (1) + * @param int $select_out set value returned by select 0=rowid (default), 1=account_number + * @param string $morecss More css non HTML object * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') { + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone') { global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -123,7 +122,7 @@ class FormVentilation extends Form $options[$select_value_out] = $label; } - $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300'); + $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss); $this->db->free($resql); return $out; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3705aecf558..5379a3afd83 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1238,6 +1238,7 @@ if ($id) { foreach ($fieldlist as $field => $value) { + $showfield=1; $align="left"; $valuetoshow=$obj->{$fieldlist[$field]}; @@ -1374,20 +1375,18 @@ if ($id) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; - $align="center"; + $align="right"; } else if ($fieldlist[$field]=='localtax2_type') { if ($obj->localtax2 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; - $align="center"; + $align="right"; } else if ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - if ($obj->localtax1 == 0) - $valuetoshow = ''; - $align="right"; + $align="right"; } else if (in_array($fieldlist[$field],array('recuperableonly'))) { @@ -1567,7 +1566,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } // For state page, we do not show the country input (we link to region, not country) print ''; } elseif ($fieldlist[$field] == 'country_id') @@ -1689,7 +1688,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') if (! empty($conf->accounting->enabled)) { $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1); + print $formaccountancy->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } else { From 6f26a7390e6bdde55205f901d05cdd514918ab74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 1 Oct 2016 18:33:37 +0200 Subject: [PATCH 20/20] FIX #5752 Bug VAT NPR not propagated during proposal cloning --- htdocs/comm/propal/class/propal.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index fa2d214f5da..87108de7692 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -926,7 +926,7 @@ class Propal extends CommonObject for ($i=0;$i<$num;$i++) { - // Reset fk_parent_line for no child products and special product + // Reset fk_parent_line for line that are not child lines or special product if (($this->lines[$i]->product_type != 9 && empty($this->lines[$i]->fk_parent_line)) || $this->lines[$i]->product_type == 9) { $fk_parent_line = 0; } @@ -942,7 +942,7 @@ class Propal extends CommonObject $this->lines[$i]->remise_percent, 'HT', 0, - 0, + $this->lines[$i]->info_bits, $this->lines[$i]->product_type, $this->lines[$i]->rang, $this->lines[$i]->special_code, @@ -1158,6 +1158,7 @@ class Propal extends CommonObject $clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj); // Create clone + $result=$clonedObj->create($user); if ($result < 0) $error++; else
trans("Label"); ?>
trans("Label"); ?>
trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)
trans("Label"); ?>
trans("Label"); ?>
trans("AttributeCode"); ?>
'; $fieldname='country'; - print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth300'); + print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print '