From c23919c51a110dfff2acab42bc69b40c6cdddd9f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 30 Nov 2016 09:41:33 +0100 Subject: [PATCH 1/4] change left menu name of categorie It is impossible to add sub-menus to other categories left menus if not... --- htdocs/core/menus/standard/eldy.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 629db07eb77..d6e84403c15 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -681,15 +681,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $menutoshow=$langs->trans("CustomersCategoriesShort"); if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $menutoshow=$langs->trans("ProspectsCategoriesShort"); $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $menutoshow, 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); + $newmenu->add("/categories/card.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact - $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); + $newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); $newmenu->add("/categories/card.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); // Categories suppliers if (! empty($conf->fournisseur->enabled)) { - $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); + $newmenu->add("/categories/index.php?leftmenu=catfournish&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); $newmenu->add("/categories/card.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } //if ($usemenuhider || empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/list.php", $langs->trans("List"), 1, $user->rights->categorie->lire); From 317df1cf9168849e583b69f40916b1e6832d8afa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 20:24:36 +0100 Subject: [PATCH 2/4] Complete work on use of the new ol_banner_tab. --- htdocs/core/lib/expensereport.lib.php | 12 +++ htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/document.php | 27 +++--- htdocs/expensereport/info.php | 23 ++++- htdocs/expensereport/note.php | 119 ++++++++++++++++++++++++++ 5 files changed, 167 insertions(+), 16 deletions(-) create mode 100644 htdocs/expensereport/note.php diff --git a/htdocs/core/lib/expensereport.lib.php b/htdocs/core/lib/expensereport.lib.php index bc5641b2593..cc60f9feb13 100644 --- a/htdocs/core/lib/expensereport.lib.php +++ b/htdocs/core/lib/expensereport.lib.php @@ -56,6 +56,18 @@ function expensereport_prepare_head($object) $head[$h][2] = 'documents'; $h++; + if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) + { + $nbNote = 0; + if(!empty($object->note_private)) $nbNote++; + if(!empty($object->note_public)) $nbNote++; + $head[$h][0] = DOL_URL_ROOT.'/expensereport/note.php?id='.$object->id; + $head[$h][1] = $langs->trans('Notes'); + if ($nbNote > 0) $head[$h][1].= ' '.$nbNote.''; + $head[$h][2] = 'note'; + $h++; + } + $head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id; $head[$h][1] = $langs->trans("Info"); $head[$h][2] = 'info'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1e0e4239763..01c23ce70f6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2585,7 +2585,7 @@ function img_warning($titlealt = 'default', $morealt = '') if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); - return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($morealt ? ($morealt == '1' ? ' style="float: right"' : ' '.$morealt): '')); } /** diff --git a/htdocs/expensereport/document.php b/htdocs/expensereport/document.php index 9ff90982c3e..0ada24ed89e 100644 --- a/htdocs/expensereport/document.php +++ b/htdocs/expensereport/document.php @@ -93,7 +93,15 @@ if ($object->id) dol_fiche_head($head, 'documents', $langs->trans("ExpenseReport"), 0, 'trip'); - + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; @@ -102,25 +110,22 @@ if ($object->id) $totalsize+=$file['size']; } - + print '
'; + print '
'; + print ''; $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; - - // Societe - //print ""; - - print ''; + print ''; print ''; print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
".$langs->trans("Company")."".$object->client->getNomUrl(1)."
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print '
'; + dol_fiche_end(); + + $modulepart = 'expensereport'; $permission = $user->rights->expensereport->creer; $permtoedit = $user->rights->expensereport->creer; diff --git a/htdocs/expensereport/info.php b/htdocs/expensereport/info.php index b3ebbc153ef..476a547c8f0 100644 --- a/htdocs/expensereport/info.php +++ b/htdocs/expensereport/info.php @@ -43,21 +43,36 @@ $title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Info"); $helpurl="EN:Module_Expense_Reports"; llxHeader("",$title,$helpurl); -if ($id) +if ($id > 0 || ! empty($ref)) { $object = new ExpenseReport($db); - $object->fetch($id); - $object->info($id); + $object->fetch($id,$ref); + $object->info($object->id); $head = expensereport_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("ExpenseReport"), 0, 'trip'); - print '
'; + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + + print '
'; + + print '
'; dol_print_object_info($object); print '
'; print '
'; + + dol_fiche_end(); } llxFooter(); diff --git a/htdocs/expensereport/note.php b/htdocs/expensereport/note.php new file mode 100644 index 00000000000..71ba4eb32dd --- /dev/null +++ b/htdocs/expensereport/note.php @@ -0,0 +1,119 @@ + + * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2013 Florian Henry + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/commande/note.php + * \ingroup commande + * \brief Fiche de notes sur une commande + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + +$langs->load("trips"); +$langs->load("companies"); +$langs->load("bills"); +$langs->load("orders"); + +$id = GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); +$socid=GETPOST('socid','int'); +$action=GETPOST('action','alpha'); + +// Security check +$socid=0; +if ($user->societe_id) $socid=$user->societe_id; +$result=restrictedArea($user,'expensereport',$id,''); + + +$object = new ExpenseReport($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); +} + +$permissionnote=$user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php + + +/* + * Actions + */ + +include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once + + +/* + * View + */ +$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Note"); +$helpurl="EN:Module_Expense_Reports"; +llxHeader("",$title,$helpurl); + +$form = new Form($db); + +if ($id > 0 || ! empty($ref)) +{ + $object = new ExpenseReport($db); + $object->fetch($id, $ref); + $object->info($object->id); + + $head = expensereport_prepare_head($object); + + dol_fiche_head($head, 'note', $langs->trans("ExpenseReport"), 0, 'trip'); + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + /* + print ''; + + // Ref + print '"; + + print "
'.$langs->trans("Ref").''; + print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); + print "
"; + + print '
'; + */ + + print '
'; + print '
'; + + $cssclass="titlefield"; + include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; + + print '
'; + + dol_fiche_end(); + +} + + +llxFooter(); +$db->close(); From 495ba00cb63b73b496ed3c7f5751102c14303afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:21:46 +0100 Subject: [PATCH 3/4] Fix: Slurp, database corruption due to missing unique key on main key. --- .../install/mysql/migration/4.0.0-5.0.0.sql | 11 ++++++ .../mysql/tables/llx_expensereport.key.sql | 36 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_expensereport.key.sql diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 4d653644f39..9b65050b663 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -219,6 +219,15 @@ create table llx_user_employment )ENGINE=innodb; +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; @@ -230,5 +239,7 @@ drop table tmp_links_double; ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_expensereport.key.sql b/htdocs/install/mysql/tables/llx_expensereport.key.sql new file mode 100644 index 00000000000..a7e4fd54425 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expensereport.key.sql @@ -0,0 +1,36 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2008-2010 Regis Houssin +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_approve FOREIGN KEY (fk_user_approve) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_refuse FOREIGN KEY (fk_user_refuse) REFERENCES llx_user (rowid); + From 33139dd57abc8b8ab02ffc4f0c0c254d826051b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 17:46:59 +0100 Subject: [PATCH 4/4] Fix missing translation of page "disabled" and "offline". --- htdocs/cache.manifest | 4 ++-- htdocs/disabled.php | 29 ----------------------- htdocs/public/notice.php | 50 +++++++++++++++++++++++++++++++++++++++ htdocs/public/offline.php | 37 ----------------------------- 4 files changed, 52 insertions(+), 68 deletions(-) delete mode 100644 htdocs/disabled.php create mode 100644 htdocs/public/notice.php delete mode 100644 htdocs/public/offline.php diff --git a/htdocs/cache.manifest b/htdocs/cache.manifest index 9119290941b..a3d1b1c554f 100644 --- a/htdocs/cache.manifest +++ b/htdocs/cache.manifest @@ -33,5 +33,5 @@ NETWORK: # If the browser is unable to retrieve the original content, the fallback resource will be used. # In the example above, we display a static image in case the dynamic one is unavailable. FALLBACK: -#/ public/offline.php -#theme/amarok/img/* theme/eldy/img/ +#/ public/notice.php +#theme/eldy/img/* theme/md/img/* diff --git a/htdocs/disabled.php b/htdocs/disabled.php deleted file mode 100644 index 43c650466a6..00000000000 --- a/htdocs/disabled.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * 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 - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ - */ - -/** - * \file htdocs/disabled.php - * \brief Page to use to replace index.php to disable all software - */ -?> - - -This feature has been disabled on this test server.
-Cette fonctionnalité a été désactivée sur ce serveur de test.
- - diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php new file mode 100644 index 00000000000..623baa2020a --- /dev/null +++ b/htdocs/public/notice.php @@ -0,0 +1,50 @@ + + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/notice.php + * \brief Dolibarr page to show a notice. + * Default notice is a message to say network connection is off. + * You can also call this page with URL: + * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) + * /public/notice.php?transphrase=url_encoded_sentence_to_show + */ + +define('NOCSRFCHECK',1); +define('NOLOGIN',1); + +require '../main.inc.php'; + + +/** + * View + */ + +if (! GETPOST('transkey') && ! GETPOST('transphrase')) +{ + print 'Sorry, it seems your internet connexion is off.
'; + print 'You need to be connected to network to use this software.
'; +} +else +{ + $langs->load("error"); + $langs->load("other"); + + if (GETPOST('transphrase')) print GETPOST('transphrase'); + if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); +} + diff --git a/htdocs/public/offline.php b/htdocs/public/offline.php deleted file mode 100644 index 043da4ac9c7..00000000000 --- a/htdocs/public/offline.php +++ /dev/null @@ -1,37 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/public/offline.php - * \brief Dolibarr offline page - */ - -define('NOCSRFCHECK',1); -define('NOLOGIN',1); - -require '../main.inc.php'; - -/** - * View - */ - -print 'Sorry, it seems your internet connexion is off.
'; -print 'You need to be connected to network to use this software.
'; -