From fb8bdefbaa6fc3d75779c1ae3d13bcd120c76d62 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 28 Apr 2020 02:10:26 +0200 Subject: [PATCH] Look and feel v12 --- htdocs/compta/facture/prelevement.php | 6 +- htdocs/compta/prelevement/bons.php | 22 ++--- .../class/bonprelevement.class.php | 3 + htdocs/compta/prelevement/list.php | 81 ++++++++++++------- htdocs/core/menus/standard/eldy.lib.php | 34 -------- .../install/mysql/migration/11.0.0-12.0.0.sql | 10 ++- .../mysql/tables/llx_prelevement_bons.sql | 6 +- .../mysql/tables/llx_prelevement_facture.sql | 3 +- .../llx_prelevement_facture_demande.sql | 3 +- htdocs/theme/eldy/global.inc.php | 2 +- 10 files changed, 88 insertions(+), 82 deletions(-) diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 337aea12033..74de1c640d4 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -24,7 +24,7 @@ /** * \file htdocs/compta/facture/prelevement.php * \ingroup facture - * \brief Gestion des prelevement d'une facture + * \brief Management of direct debit order of invoices */ require '../../main.inc.php'; @@ -32,9 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -if (!empty($conf->projet->enabled)) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (!$user->rights->facture->lire) accessforbidden(); diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 935b57e0faa..8c9203c8a58 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -31,12 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'categories', 'widthdrawals')); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -101,7 +103,10 @@ if ($result) $num = $db->num_rows($result); $i = 0; - $urladd = "&statut=".$statut; + $param = ''; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + $param .= "&statut=".urlencode($statut); $selectedfields = ''; @@ -119,10 +124,9 @@ if ($result) print ''; print ''; print ''; - print ''; print ''; - print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); + print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -141,11 +145,11 @@ if ($result) print ''; print ''; - print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', '', 'class="liste_titre"', $sortfield, $sortorder); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'class="liste_titre" align="center"', $sortfield, $sortorder); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", "", 'class="right"', $sortfield, $sortorder); - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", "", 'class="right"', $sortfield, $sortorder); - print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n"; + print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "p.amount", "", $param, '', $sortfield, $sortorder, 'right '); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n"; print "\n"; $directdebitorder = new BonPrelevement($db); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index df1ecf094ca..0a033e2df53 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -1229,6 +1229,9 @@ class BonPrelevement extends CommonObject $label = ''.$langs->trans("ShowWithdraw").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; + if (isset($this->statut)) { + $label .= '
'.$langs->trans("Status").": ".$this->getLibStatut(5); + } $url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id; diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index bbac6c6232e..5598168a436 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -32,12 +32,21 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Load translation files required by the page $langs->loadLangs(array('banks', 'withdrawals', 'companies', 'categories')); +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') + // Security check $socid = GETPOST('socid', 'int'); if ($user->socid) $socid=$user->socid; $result = restrictedArea($user, 'prelevement', '', '', 'bons'); - $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); $sortorder = GETPOST('sortorder', 'alpha'); @@ -57,7 +66,7 @@ $statut = GETPOST('statut', 'int'); $bon = new BonPrelevement($db, ""); $ligne = new LignePrelevement($db, $user); - +$company = new Societe($db); /* * Actions @@ -81,9 +90,9 @@ $form = new Form($db); llxHeader('', $langs->trans("WithdrawalsLines")); -$sql = "SELECT p.rowid, p.ref, p.statut, p.datec"; -$sql .= " ,f.rowid as facid, f.ref, f.total_ttc"; -$sql .= " , s.rowid as socid, s.nom as name, s.code_client"; +$sql = "SELECT p.rowid, p.ref, p.statut as status, p.datec"; +$sql .= " ,f.rowid as facid, f.ref as invoiceref, f.total_ttc"; +$sql .= " , s.rowid as socid, s.nom as name, s.code_client, s.email"; $sql .= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl"; @@ -124,14 +133,21 @@ if ($result) $num = $db->num_rows($result); $i = 0; - $urladd = "&statut=".$statut; - $urladd .= "&search_bon=".$search_bon; - if ($limit > 0 && $limit != $conf->liste_limit) $urladd .= '&limit='.urlencode($limit); + $param = "&statut=".urlencode($statut); + $param .= "&search_bon=".urlencode($search_bon); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); print"\n\n"; - print '
'; + print ''."\n"; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit); + print_barre_liste($langs->trans("WithdrawalsLines"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -153,13 +169,13 @@ if ($result) print ''; print ''; - print_liste_field_titre("Line", $_SERVER["PHP_SELF"]); - print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref"); - print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $urladd); - print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom"); - print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', '', 'align="center"'); - print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", "", 'align="center"'); - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", "", 'class="right"'); + print_liste_field_titre("Line", $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("WithdrawalsReceipts", $_SERVER["PHP_SELF"], "p.ref", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("Bill", $_SERVER["PHP_SELF"], "f.ref", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", '', $param, '', $sortfield, $sortorder); + print_liste_field_titre("CustomerCode", $_SERVER["PHP_SELF"], "s.code_client", '', $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center '); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "pl.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre(''); print "\n"; @@ -167,28 +183,37 @@ if ($result) { $obj = $db->fetch_object($result); - print ''; + $bon->ref = $obj->ref; + $bon->statut = $obj->status; + $company->id = $obj->socid; + $company->name = $obj->name; + $company->email = $obj->email; + $company->code_client = $obj->code_client; + + print ''; + + print ''; print $ligne->LibStatut($obj->statut_ligne, 2); print " "; - print ''; print substr('000000'.$obj->rowid_ligne, -6); print ''; print ''; + print $bon->getNomUrl(1); + print "\n"; - print $bon->LibStatut($obj->statut, 2); - print " "; - - print ''.$obj->ref."\n"; - - print ''; + print ''; + print ''; print img_object($langs->trans("ShowBill"), "bill"); - print ' '.$obj->ref."\n"; - print ''; + print ' '.$obj->invoiceref."\n"; + print ''; + print ''; - print ''.$obj->name."\n"; + print ''; + print $company->getNomUrl(1); + print "\n"; print ''.$obj->code_client."\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 01b361aa6b3..8566575e5ca 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1905,40 +1905,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu); //var_dump($newmenu->liste); // - // We update newmenu for special dynamic menus - if (!empty($user->rights->banque->lire) && $mainmenu == 'bank') // Entry for each bank account - { - require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - - $sql = "SELECT rowid, label, courant, rappro"; - $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; - $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND clos = 0"; - $sql .= " ORDER BY label"; - - $resql = $db->query($sql); - if ($resql) - { - $numr = $db->num_rows($resql); - $i = 0; - - if ($numr > 0) $newmenu->add('/compta/bank/list.php', $langs->trans("BankAccounts"), 0, $user->rights->banque->lire); - - while ($i < $numr) - { - $objp = $db->fetch_object($resql); - $newmenu->add('/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->rights->banque->lire); - if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate - { - $newmenu->add('/compta/bank/bankentries_list.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0', $langs->trans("Conciliate"), 2, $user->rights->banque->consolidate); - } - $i++; - } - } - else dol_print_error($db); - $db->free($resql); - } - if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP = 20; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 4b87b4b9ce3..4f6a5b7c4e6 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -261,4 +261,12 @@ ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer; ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid); ---Dictionary of package type because filename in V11 was incomplete + +-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN fk_facture INTEGER NULL; +-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture_demande ALTER COLUMN fk_facture DROP NOT NULL; +ALTER TABLE llx_prelevement_facture_demande ADD COLUMN fk_facture_fourn INTEGER NULL; + +-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture MODIFY COLUMN fk_facture INTEGER NULL; +-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture ALTER COLUMN fk_facture DROP NOT NULL; +ALTER TABLE llx_prelevement_facture ADD COLUMN fk_facture_fourn INTEGER NULL; + diff --git a/htdocs/install/mysql/tables/llx_prelevement_bons.sql b/htdocs/install/mysql/tables/llx_prelevement_bons.sql index 2a8fd114440..e7e0b9a89f1 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_bons.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_bons.sql @@ -18,10 +18,10 @@ -- =================================================================== -- --- Bons de prelevement +-- Direct debit or credit orders -- --- statut 1 : transmis a la banque --- statut 2 : credite +-- statut 1 : sent to the bank +-- statut 2 : paid -- create table llx_prelevement_bons ( diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture.sql b/htdocs/install/mysql/tables/llx_prelevement_facture.sql index 2524f854a9c..dbe2cb85f84 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_facture.sql @@ -19,7 +19,8 @@ create table llx_prelevement_facture ( rowid integer AUTO_INCREMENT PRIMARY KEY, - fk_facture integer NOT NULL, + fk_facture integer NULL, + fk_facture_foun integer NULL, fk_prelevement_lignes integer NOT NULL )ENGINE=innodb; diff --git a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql index b1f625de872..4e1f37c6d3f 100644 --- a/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql +++ b/htdocs/install/mysql/tables/llx_prelevement_facture_demande.sql @@ -21,7 +21,8 @@ create table llx_prelevement_facture_demande ( rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, - fk_facture integer NOT NULL, + fk_facture integer NULL, + fk_facture_fourn integer NULL, sourcetype varchar(32), amount double(24,8) NOT NULL, date_demande datetime NOT NULL, diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index e495a3bb4bc..9a152fdb91f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -149,7 +149,7 @@ input[name=duration_value] { margin-right: 4px; } -input[type=submit] { +input[type=submit], input[type=submit]:hover { margin-left: 5px; } input, input.flat, form.flat select, select, select.flat, .dataTables_length label select {