From aade7309e097bb43ad3dee602bf4f9c411c08e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 15:56:57 +0100 Subject: [PATCH 1/9] Update boxes.php --- htdocs/admin/boxes.php | 203 +++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 97 deletions(-) diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c12e913e9c1..7c9c8aa2ef1 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -51,88 +51,90 @@ if ($action == 'addconst') dolibarr_set_const($db, "MAIN_BOXES_MAXLINES",$_POST["MAIN_BOXES_MAXLINES"],'',0,'',$conf->entity); } -if ($action == 'add') -{ +if ($action == 'add') { $error=0; - $db->begin(); + if (isset($_POST['boxid']) && is_array($_POST['boxid'])) { + foreach($_POST['boxid'] as $boxid) { + if ($boxid['active']=='on') { + $pos = $boxid['pos']; - // Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") - $distinctfkuser=array(); - if (! $error) - { - $sql = "SELECT fk_user"; - $sql.= " FROM ".MAIN_DB_PREFIX."user_param"; - $sql.= " WHERE param = 'MAIN_BOXES_".$db->escape(GETPOST("pos","alpha"))."' AND value = '1'"; - $sql.= " AND entity = ".$conf->entity; + // Initialize distinct fkuser with all already existing values of fk_user (user that use a personalized view of boxes for page "pos") + $distinctfkuser=array(); + if (! $error) + { + $sql = "SELECT fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."user_param"; + $sql.= " WHERE param = 'MAIN_BOXES_".$db->escape($pos)."' AND value = '1'"; + $sql.= " AND entity = ".$conf->entity; + dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i=0; + while ($i < $num) + { + $obj=$db->fetch_object($resql); + $distinctfkuser[$obj->fk_user]=$obj->fk_user; + $i++; + } + } + else + { + setEventMessage($db->lasterror(), 'errors'); + $error++; + } + } - dol_syslog("boxes.php search fk_user to activate box for", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) - { - $num = $db->num_rows($resql); - $i=0; - while ($i < $num) - { - $obj=$db->fetch_object($resql); - $distinctfkuser[$obj->fk_user]=$obj->fk_user; - $i++; - } - } - else - { - setEventMessage($db->lasterror(), 'errors'); - $error++; - } - } + $distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val - $distinctfkuser['0']='0'; // Add entry for fk_user = 0. We must use string as key and val + foreach($distinctfkuser as $fk_user) + { + if (! $error && $fk_user != '') + { + $nbboxonleft=$nbboxonright=0; + $sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".$pos." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; + dol_syslog("boxes.php activate box", LOG_DEBUG); + $resql = $db->query($sql); + if ($resql) + { + while($obj = $db->fetch_object($resql)) + { + $boxorder=$obj->box_order; + if (preg_match('/A/',$boxorder)) $nbboxonleft++; + if (preg_match('/B/',$boxorder)) $nbboxonright++; + } + } + else dol_print_error($db); - foreach($distinctfkuser as $fk_user) - { - if (! $error && $fk_user != '') - { - $nbboxonleft=$nbboxonright=0; - $sql = "SELECT box_order FROM ".MAIN_DB_PREFIX."boxes WHERE position = ".GETPOST("pos","alpha")." AND fk_user = ".$fk_user." AND entity = ".$conf->entity; - dol_syslog("boxes.php activate box", LOG_DEBUG); - $resql = $db->query($sql); - if ($resql) - { - while($obj = $db->fetch_object($resql)) - { - $boxorder=$obj->box_order; - if (preg_match('/A/',$boxorder)) $nbboxonleft++; - if (preg_match('/B/',$boxorder)) $nbboxonright++; - } - } - else dol_print_error($db); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; + $sql.= "box_id, position, box_order, fk_user, entity"; + $sql.= ") values ("; + $sql.= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; + $sql.= ")"; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; - $sql.= "box_id, position, box_order, fk_user, entity"; - $sql.= ") values ("; - $sql.= GETPOST("boxid","int").", ".GETPOST("pos","alpha").", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; - $sql.= ")"; - - dol_syslog("boxes.php activate box", LOG_DEBUG); - $resql = $db->query($sql); - if (! $resql) - { - setEventMessage($db->lasterror(), 'errors'); - $error++; - } - } - } - - if (! $error) - { - header("Location: boxes.php"); - $db->commit(); - exit; - } - else - { - $db->rollback(); - } + dol_syslog("boxes.php activate box", LOG_DEBUG); + $resql = $db->query($sql); + if (! $resql) + { + setEventMessage($db->lasterror(), 'errors'); + $error++; + } + } + } + } + } + } + if (! $error) + { + $db->commit(); + $action=''; + } + else + { + $db->rollback(); + } } if ($action == 'delete') @@ -317,14 +319,18 @@ if ($resql) $boxtoadd=InfoBox::listBoxes($db,'available',-1,null,$actives); print "
\n"; +print "\n\n".''."\n"; print_titre($langs->trans("BoxesAvailable")); -print ''; +print ''."\n"; +print ''."\n"; +print ''."\n"; +print '
'."\n"; print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; $var=true; foreach($boxtoadd as $box) @@ -341,12 +347,10 @@ foreach($boxtoadd as $box) } print "\n".''."\n"; - print ''; - print ''; - print ''; + print ''."\n"; print ''; + print ''."\n"; print ''; - print ''; + print ''."\n"; + print ''."\n"; // Pour chaque position possible, on affiche un lien d'activation si boite non deja active pour cette position - print ''; - print ''; - print ''; + print ''."\n"; } -print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").''.$langs->trans("SourceFile").''.$langs->trans("ActivateOn").''.$langs->trans("ActivateOn").'
'.img_object("",$logo).' '.$langs->transnoentitiesnoconv($box->boxlabel); if (! empty($box->class) && preg_match('/graph_/',$box->class)) print ' ('.$langs->trans("Graph").')'; - print ''; if ($box->note == '(WarningUsingThisBoxSlowDown)') { @@ -354,22 +358,25 @@ foreach($boxtoadd as $box) print $langs->trans("WarningUsingThisBoxSlowDown"); } else print ($box->note?$box->note:' '); - print '' . $box->sourcefile . '' . $box->sourcefile . ''; - print $form->selectarray("pos",$pos_name,0,0,0,0,'',1); - print ''; - print ''; - print ' '; + print ''; + print $form->selectarray("boxid[".$box->box_id."][pos]",$pos_name,0,0,0,0,'',1)."\n"; + print ''."\n"; + print ''."\n"; print '
'; +print ''."\n"; +print '
'; +print ''; +print '
'."\n"; +print ''; +print "\n".''."\n"; // Activated boxes @@ -421,8 +428,8 @@ foreach($boxactivated as $key => $box) $hasprevious=($key != 0); print ''.($key+1).''; print ''; - print ($hasnext?''.img_down().' ':''); - print ($hasprevious?''.img_up().'':''); + print ($hasnext?''.img_down().' ':''); + print ($hasprevious?''.img_up().'':''); print ''; print ''; print ''.img_delete().''; @@ -436,13 +443,14 @@ print '
'; // Other parameters +print "\n\n".''."\n"; print_titre($langs->trans("Other")); -print ''; - -$var=false; print ''; print ''; print ''; +print '
'; + +$var=false; print ''; print ''; print ''; @@ -459,9 +467,10 @@ print ''."\n"; print ''; -print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").''; print ''; print '
'; +print ''; +print "\n".''."\n"; llxFooter(); From f1fa7e720aa419dcf0b7611c2e37c70aa7b7a5bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 18:33:00 +0100 Subject: [PATCH 2/9] Fix missing --- htdocs/core/tpl/login.tpl.php | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 61c26244692..8b7e5e08830 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -49,7 +49,6 @@ $(document).ready(function () {
'; } - ?>
- + - - - @@ -216,21 +211,17 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file -
+ + +
- - - global->MAIN_HTML_FOOTER)) print $conf->global->MAIN_HTML_FOOTER; ?> - google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) @@ -276,10 +267,8 @@ if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AD_CLI } } ?> - - - + From ddee145c66e1abf98de8b0eb16aaffe8885c1ae8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 20:28:41 +0100 Subject: [PATCH 3/9] Update objectline_view.tpl.php --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 1c8bb07f560..3d2ea127b85 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -45,7 +45,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0; global->MAIN_VIEW_LINE_NUMBER)) { ?> -
+
info_bits & 2) == 2) { ?> Date: Sun, 30 Nov 2014 21:57:10 +0100 Subject: [PATCH 4/9] Update card.php --- htdocs/product/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 4b3c0a4cd48..9ff2d6b08a3 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1547,7 +1547,9 @@ else } // Note - print ''.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).''; + print ' '."\n"; + print ''.$langs->trans("Note").''.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).''."\n"; + print ' '."\n"; print "\n"; From dd18c980fc8e517ce6f47bb0a4b2b494a18cca40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 22:00:16 +0100 Subject: [PATCH 5/9] Update html.form.class.php --- htdocs/core/class/html.form.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b70820463b0..32f3b6d999d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2978,12 +2978,13 @@ class Form // Show JQuery confirm box. Note that global var $useglobalvars is used inside this template $formconfirm.= ''; + $formconfirm.= ''."\n"; - $formconfirm.= ''; + $formconfirm.= "\n"; } else { $formconfirm.= "\n\n"; $formconfirm.= '
'."\n"; - $formconfirm.= ''; + $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; $formconfirm.= ''."\n"; From a3d843f69875127f7748394a90c67d3f5ed4aff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 22:06:58 +0100 Subject: [PATCH 6/9] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1b0438bdea1..f4634c91e5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3603,7 +3603,7 @@ abstract class CommonObject break; } - $out .= ''."\n"; + $out .= ''; if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) $out .= ''; else $out .= ''; @@ -3611,7 +3611,6 @@ abstract class CommonObject } } $out .= "\n"; - $out .= ' '; $out .= ' '; + '."\n"; + $out .= ' '."\n"; } return $out; } From b3418b92a36208ee99641fe00a9b83bb2ce28bc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 23:05:30 +0100 Subject: [PATCH 7/9] Update main.inc.php --- htdocs/main.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 15f2281cc1f..8bd0c876389 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1534,8 +1534,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me // Instantiate hooks of thirdparty module $hookmanager->initHooks(array('searchform','leftblock')); - if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".'
'."\n"; - else print '
'; + if (empty($conf->dol_use_jmobile) && ! empty($conf->use_javascript_ajax) && ! empty($conf->global->MAIN_MENU_USE_JQUERY_LAYOUT)) print "\n".''."\n".'
'."\n"; + else print "\n".''."\n".'
'."\n"; print "\n"; From 3e3dbb12807f1a7c2d703532431633830da86f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 30 Nov 2014 23:53:51 +0100 Subject: [PATCH 8/9] Update main.inc.php --- htdocs/main.inc.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8bd0c876389..2920dc2e436 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1543,33 +1543,33 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname', 'T'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/societe/societe.php', DOL_URL_ROOT.'/societe/societe.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname', 'T', 'searchleft'); } if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire) { $langs->load("companies"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname', '', 'searchleft'); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleft'); } if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER)) { $langs->load("products"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', img_object('','product').' '.$langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchleft'); } if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire) { $langs->load("members"); - $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'M'); + $searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'M', 'searchleft'); } // Execute hook printSearchForm @@ -1806,9 +1806,10 @@ function getHelpParamFor($helppagename,$langs) * @param string $htmlmodesearch Value to set into parameter "mode_search" ('soc','contact','products','member',...) * @param string $htmlinputname Field Name input form * @param string $accesskey Accesskey + * @param string $idname Complement for id to avoid multiple same id in the page * @return string */ -function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='') +function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinputname,$accesskey='', $idname='') { global $conf,$langs; @@ -1828,7 +1829,7 @@ function printSearchForm($urlaction,$urlobject,$title,$htmlmodesearch,$htmlinput $ret.=($accesskey?' accesskey="'.$accesskey.'"':''); if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $ret.=' placeholder="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; else $ret.=' title="'.$langs->trans("SearchOf").''.strip_tags($title).'"'; - $ret.=' name="'.$htmlinputname.'" id="'.$htmlinputname.'" size="10" />'; + $ret.=' name="'.$htmlinputname.'" id="'.$idname.$htmlinputname.'" size="10" />'; $ret.=''; $ret.="\n"; return $ret; From 3c12d5f420eb522fa61ca8a6b505d56716aba2e4 Mon Sep 17 00:00:00 2001 From: BENKE Charles Date: Tue, 2 Dec 2014 10:36:48 +0100 Subject: [PATCH 9/9] Update supplierinvoice_extrafields.php add orders translation files for correct menu translation error --- htdocs/admin/supplierinvoice_extrafields.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/supplierinvoice_extrafields.php b/htdocs/admin/supplierinvoice_extrafields.php index ba584bdae8c..40494f9c286 100644 --- a/htdocs/admin/supplierinvoice_extrafields.php +++ b/htdocs/admin/supplierinvoice_extrafields.php @@ -38,6 +38,7 @@ if (!$user->admin) $langs->load("admin"); $langs->load("other"); $langs->load("bills"); +$langs->load("orders"); $langs->load("suppliers"); $extrafields = new ExtraFields($db);