From 935b30470d18ea76ded001a0739db6e15cd2e5fe Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Feb 2014 20:09:25 +0100 Subject: [PATCH 1/5] Fix: Missing nowrap --- htdocs/core/tpl/objectline_add.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/tpl/objectline_add.tpl.php b/htdocs/core/tpl/objectline_add.tpl.php index de72eced350..abad23bb4c4 100644 --- a/htdocs/core/tpl/objectline_add.tpl.php +++ b/htdocs/core/tpl/objectline_add.tpl.php @@ -190,10 +190,10 @@ if (! empty($conf->margin->enabled)) { if ($user->rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { - echo '%'; + echo '%'; } elseif (! empty($conf->global->DISPLAY_MARK_RATES)) { - echo '%'; + echo '%'; } } else From abc96b51fa815cd039f340984927e14b768aeead Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 16 Feb 2014 23:51:29 +0100 Subject: [PATCH 2/5] Enable extrafields for customer order, proposal and invoice lines. This feature was developed for 3.5 but was disabled (hidden) because of a bug not possible to fix enough quickly for 3.5.0 release. --- ChangeLog | 3 + htdocs/comm/propal.php | 2 +- htdocs/commande/fiche.php | 12 ++-- htdocs/compta/facture.php | 4 +- htdocs/core/class/commonobject.class.php | 9 +-- htdocs/core/class/extrafields.class.php | 55 ++++++++++--------- htdocs/core/lib/invoice.lib.php | 3 - htdocs/core/lib/order.lib.php | 3 - htdocs/core/lib/propal.lib.php | 3 - .../core/tpl/freeproductline_create.tpl.php | 9 ++- .../tpl/predefinedproductline_create.tpl.php | 9 ++- 11 files changed, 62 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90b6922d60b..22a2884e5fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,9 @@ Fix: Page load not ending when large number of thirdparies. We combo feature that is root cause of problem. Fix: [ bug #1231 ] PDF always generated in interventions Fix: Be sure there is no duplicate default rib. +Fix: Enable extrafields for customer order, proposal and invoice lines. This feature + was developed for 3.5 but was disabled (hidden) because of a bug not possible to + fix enough quickly for 3.5.0 release. ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index ef37fa534bd..48cd8531a69 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -665,7 +665,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- //Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef); //Unset extrafield if (is_array($extralabelsline)) { diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 4c400f37a7f..7a5b74165bb 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -599,7 +599,7 @@ else if ($action == 'addline' && $user->rights->commande->creer) //Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef); //Unset extrafield if (is_array($extralabelsline)) { @@ -613,12 +613,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) if ((empty($idprod) || GETPOST('usenewaddlineform')) && ($price_ht < 0) && ($qty < 0)) { setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && GETPOST('type') < 0) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors'); - $error = true; + $error++; } if ((empty($idprod) || GETPOST('usenewaddlineform')) && (!($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not '' { @@ -628,12 +628,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) if ($qty == '') { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors'); - $error = true; + $error++; } if (empty($idprod) && empty($product_desc)) { setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors'); - $error = true; + $error++; } if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) @@ -2484,7 +2484,7 @@ else } // Create bill and Classify billed - // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" + // Note: Even if module invoice is not enabled, we should be able to use button "Classified billed" if ($object->statut > 0 && ! $object->billed) { if (! empty($conf->facture->enabled) && $user->rights->facture->creer && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a03dddfc515..9a665578c28 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1157,13 +1157,13 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights- //Extrafields $extrafieldsline = new ExtraFields($db); $extralabelsline =$extrafieldsline->fetch_name_optionals_label($object->table_element_line); - $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline); + $array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline,$predef); //Unset extrafield if (is_array($extralabelsline)) { // Get extra fields foreach ($extralabelsline as $key => $value) { - unset($_POST["options_".$key]); + unset($_POST["options_".$key.$predef]); } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8f45a53e059..2581151a649 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2236,13 +2236,14 @@ abstract class CommonObject /** * Function to show lines of extrafields with output datas * - * @param object $extrafields extrafield Object + * @param object $extrafields Extrafield Object * @param string $mode Show output (view) or input (edit) for extrafield - * @param array $params optionnal parameters + * @param array $params Optionnal parameters + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * * @return string */ - function showOptionals($extrafields,$mode='view',$params=0) + function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') { global $_POST; @@ -2310,7 +2311,7 @@ abstract class CommonObject $out .= $extrafields->showOutputField($key,$value); break; case "edit": - $out .= $extrafields->showInputField($key,$value); + $out .= $extrafields->showInputField($key,$value,'',$keyprefix); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 8227bfbc0e7..399a87d30af 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -571,14 +571,15 @@ class ExtraFields /** - * Return HTML string to put an input field into a page + * Return HTML string to put an input field into a page * - * @param string $key Key of attribute - * @param string $value Value to show (for date type it must be in timestamp format) - * @param string $moreparam To add more parametes on html input tag - * @return void + * @param string $key Key of attribute + * @param string $value Value to show (for date type it must be in timestamp format) + * @param string $moreparam To add more parametes on html input tag + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) + * @return void */ - function showInputField($key,$value,$moreparam='') + function showInputField($key,$value,$moreparam='',$keyprefix='') { global $conf,$langs; @@ -620,23 +621,23 @@ class ExtraFields if(!$required && $value == '') $value = '-1'; - $out = $formstat->select_date($value, 'options_'.$key, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1); - //$out=''; + $out = $formstat->select_date($value, 'options_'.$key.$keyprefix, $showtime, $showtime, $required, '', 1, 1, 1, 0, 1); + // TODO Missing to add $moreparam } elseif (in_array($type,array('int'))) { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif ($type == 'varchar') { - $out=''; + $out=''; } elseif ($type == 'text') { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('options_'.$key,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100); + $doleditor=new DolEditor('options_'.$key.$keyprefix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,5,100); $out=$doleditor->Create(1); } elseif ($type == 'boolean') @@ -647,30 +648,30 @@ class ExtraFields } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'mail') { - $out=''; + $out=''; } elseif ($type == 'phone') { - $out=''; + $out=''; } elseif ($type == 'price') { - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { if (!empty($value)) { $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { - $out=''; foreach ($param['options'] as $key=>$val ) { list($val, $parent) = explode('|', $val); @@ -683,7 +684,7 @@ class ExtraFields } elseif ($type == 'sellist') { - $out=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); @@ -820,7 +821,7 @@ class ExtraFields foreach ($param['options'] as $keyopt=>$val ) { - $out.='$val ) { - $out.=''; @@ -1085,9 +1086,10 @@ class ExtraFields * return array_options array for object by extrafields value (using for data send by forms) * * @param array $extralabels $array of extrafields + * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @return int 1 if array_options set / 0 if no value */ - function getOptionalsFromPost($extralabels) + function getOptionalsFromPost($extralabels,$keyprefix='') { global $_POST; @@ -1102,23 +1104,24 @@ class ExtraFields if (in_array($key_type,array('date','datetime'))) { // Clean parameters - $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); + $value_key=dol_mktime($_POST["options_".$key.$keyprefix."hour"], $_POST["options_".$key.$keyprefix."min"], 0, $_POST["options_".$key.$keyprefix."month"], $_POST["options_".$key.$keyprefix."day"], $_POST["options_".$key.$keyprefix."year"]); } else if (in_array($key_type,array('checkbox'))) { - $value_arr=GETPOST("options_".$key); + $value_arr=GETPOST("options_".$key.$keyprefix); $value_key=implode($value_arr,','); } else if (in_array($key_type,array('price','double'))) { - $value_arr=GETPOST("options_".$key); + $value_arr=GETPOST("options_".$key.$keyprefix); $value_key=price2num($value_arr); } else { - $value_key=GETPOST("options_".$key); + $value_key=GETPOST("options_".$key.$keyprefix); } - $array_options["options_".$key]=$value_key; + + $array_options["options_".$key]=$value_key; // No keyprefix here. keyprefix is used only for read. } return $array_options; diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index b3983a0c5ab..0142bfae113 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -132,13 +132,10 @@ function invoice_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name - { $head[$h][0] = DOL_URL_ROOT.'/compta/facture/admin/facturedet_cust_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; - } complete_head_from_modules($conf,$langs,$object,$head,$h,'invoice_admin','remove'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 46dca55fb3a..216887139d4 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -138,13 +138,10 @@ function order_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name - { $head[$h][0] = DOL_URL_ROOT.'/admin/orderdet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; - } complete_head_from_modules($conf,$langs,$object,$head,$h,'order_admin','remove'); diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 8f5e61eecee..d43885adf95 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -136,13 +136,10 @@ function propal_admin_prepare_head($object) $head[$h][2] = 'attributes'; $h++; - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) // FIXME This feature will works when form for predefined and free product will be merged, otherwise there is duplicate fields with same name - { $head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][2] = 'attributeslines'; $h++; - } complete_head_from_modules($conf,$langs,$object,$head,$h,'propal_admin','remove'); diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index f88d7741ed8..41eccdddda9 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -126,13 +126,20 @@ else { "> rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { echo '%'; + $colspan++; + $coldisplay++; } if (! empty($conf->global->DISPLAY_MARK_RATES)) { echo '%'; + $colspan++; + $coldisplay++; } } else @@ -164,7 +171,7 @@ else { $newline = new FactureLigne($this->db); } if (is_object($newline)) { - print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+8)); + print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay+8)); } } ?> diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index ec430015135..acd06c807d3 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -134,13 +134,20 @@ else { "> rights->margins->creer) { if (! empty($conf->global->DISPLAY_MARGIN_RATES)) { echo '%'; + $colspan++; + $coldisplay++; } if (! empty($conf->global->DISPLAY_MARK_RATES)) { echo '%'; + $colspan++; + $coldisplay++; } } else @@ -172,7 +179,7 @@ else { $newline = new FactureLigne($this->db); } if (is_object($newline)) { - print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5)); + print $newline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var],'colspan'=>$coldisplay+5), '_predef'); } } ?> From de64ce5b2adb300b24f3163bf4bc3a231d5bb034 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2014 00:09:48 +0100 Subject: [PATCH 3/5] Fix: user right on Holiday for month report nor working --- ChangeLog | 1 + htdocs/core/menus/init_menu_auguria.sql | 2 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22a2884e5fe..aaf50f6452b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ Fix: Be sure there is no duplicate default rib. Fix: Enable extrafields for customer order, proposal and invoice lines. This feature was developed for 3.5 but was disabled (hidden) because of a bug not possible to fix enough quickly for 3.5.0 release. +Fix: user right on Holiday for month report nor working. ***** ChangeLog for 3.5 compared to 3.4.* ***** For users: diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 282cc4e8236..a1ceb50a7c2 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -281,5 +281,5 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5001__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/fiche.php?&action=request', 'MenuAddCP', 1, 'holiday', '$user->rights->holiday->write', '', 0, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5002__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/define_holiday.php?&action=request', 'MenuConfCP', 1, 'holiday', '$user->rights->holiday->define_holiday', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5003__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/view_log.php?&action=request', 'MenuLogCP', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->view_log', '', 0, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->holiday->enabled', __HANDLER__, 'left', 5004__+MAX_llx_menu__, 'hrm', '', 5000__+MAX_llx_menu__, '/holiday/month_report.php?&action=request', 'MenuReportMonth', 1, 'holiday', '$user->rights->holiday->month_report', '', 0, 4, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 954cdc1c2d1..3f059d7dc76 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1090,7 +1090,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/holiday/fiche.php?&action=request", $langs->trans("MenuAddCP"), 1,$user->rights->holiday->write); $newmenu->add("/holiday/define_holiday.php?&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->view_log); - $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->view_log); + $newmenu->add("/holiday/month_report.php?&action=request", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->month_report); } } From fa7e7c75bf298ac752931efa18219284a9ec5e61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2014 11:48:57 +0100 Subject: [PATCH 4/5] Fix: Add a protection if user has no option to edit stock --- htdocs/cashdesk/index_verif.php | 15 +++++++++++++++ htdocs/langs/en_US/cashdesk.lang | 3 ++- htdocs/langs/fr_FR/cashdesk.lang | 1 + htdocs/user/class/user.class.php | 6 ++++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 94ec87edea0..9f7e0332046 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -65,6 +65,21 @@ if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && exit; } +// If stock decrease on bill validation, check user has stock edit permissions +if (! empty($conf->stock->enabled) && $conf->global->STOCK_CALCULATE_ON_BILL && ! empty($username)) +{ + $testuser=new User($db); + $testuser->fetch(0,$username); + $testuser->getrights('stock'); + if (empty($testuser->rights->stock->creer)) + { + $retour=$langs->trans("UserNeedPermissionToEditStockToUsePos"); + header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid.'&bankid_cash='.$bankid_cash.'&bankid_cheque='.$bankid_cheque.'&bankid_cb='.$bankid_cb); + exit; + } +} + + /* if (! empty($_POST['txtUsername']) && ! empty($conf->banque->enabled) && (empty($conf_fkaccount_cash) && empty($conf_fkaccount_cheque) && empty($conf_fkaccount_cb))) { diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index ea617c19583..22cc717df1a 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -36,4 +36,5 @@ BankToPay=Charge Account ShowCompany=Show company ShowStock=Show warehouse DeleteArticle=Click to remove this article -FilterRefOrLabelOrBC=Search (Ref/Label) \ No newline at end of file +FilterRefOrLabelOrBC=Search (Ref/Label) +UserNeedPermissionToEditStockToUsePos=You ask to decrease stock on invoice creation, so user that use POS need to have permission to edit stock. \ No newline at end of file diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index ceab9ef95d1..5dd2fe6ec57 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -37,3 +37,4 @@ ShowCompany=Voir société ShowStock=Voir entrepôt DeleteArticle=Cliquez pour enlever cet article FilterRefOrLabelOrBC=Recherche (Ref/Lib.) +UserNeedPermissionToEditStockToUsePos=La configuration du module stock demande une réduction du stock sur facturation, aussi l'utilisateur du Point De Vente doit avoir les droits de modifier les stocks \ No newline at end of file diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 479f211eaef..25fc77311ac 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -488,6 +488,7 @@ class User extends CommonObject * Clear all permissions array of user * * @return void + * @see getrights */ function clearrights() { @@ -503,6 +504,7 @@ class User extends CommonObject * * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) * @return void + * @see clearrights */ function getrights($moduletag='') { @@ -1013,7 +1015,7 @@ class User extends CommonObject { $newpass=$this->setPassword($user,$this->pass); if (is_numeric($newpass) && $newpass < 0) $result=-2; - + if ($result > 0 && $member->fk_soc) // If member is linked to a thirdparty { $sql = "UPDATE ".MAIN_DB_PREFIX."user"; From 8839ae38d31c448a8c9bd51b0fb83df1ab5c3396 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 17 Feb 2014 15:21:19 +0100 Subject: [PATCH 5/5] Fix: [ bug #1241 ] error in request in select_paper file /core/class/html.formadmin.class.php --- htdocs/core/class/html.formadmin.class.php | 20 ++- test/phpunit/FormAdminTest.php | 139 +++++++++++++++++++++ 2 files changed, 153 insertions(+), 6 deletions(-) create mode 100644 test/phpunit/FormAdminTest.php diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index ccd3e038f74..6d570b70880 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Patrick Raguin * @@ -146,7 +146,7 @@ class FormAdmin if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i',$file)) continue; // We exclude all menu manager files - + $filelib=preg_replace('/\.php$/i','',$file); $prefix=''; // 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other @@ -324,7 +324,7 @@ class FormAdmin * * @param string $selected Paper format pre-selected * @param string $htmlname Name of HTML select field - * @param string $filter Key to filter + * @param string $filter Value to filter on code * @param int $showempty Add empty value * @return string Return HTML output */ @@ -332,8 +332,12 @@ class FormAdmin { global $langs; - $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format where active=1"; - if ($filter) $sql.=" WHERE code LIKE '%".$filter."%'"; + $langs->load("dict"); + + $sql = "SELECT code, label, width, height, unit"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_paper_format"; + $sql.= " WHERE active=1"; + if ($filter) $sql.=" AND code LIKE '%".$this->db->escape($filter)."%'"; $resql=$this->db->query($sql); if ($resql) @@ -350,7 +354,11 @@ class FormAdmin $i++; } } - else dol_print_error($this->db); + else + { + dol_print_error($this->db); + return ''; + } $out=''; $out.= ''); + print __METHOD__." result=".$result."\n"; + return $result; + } + +} +?> \ No newline at end of file