From c362e7cf2dc6c104213469446737480faaca09a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:10:07 +0100 Subject: [PATCH 01/29] FIX #6043 - Payment mode not visible on supplier invoice list --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 47841195c83..89dfb083ea0 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -247,9 +247,9 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:Factur $sql = "SELECT"; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; +$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement,"; $sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; -$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " p.rowid as project_id, p.ref as project_ref"; From 8b569f9dfe7550844be487fe17f6f7de4b75266a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:17:29 +0100 Subject: [PATCH 02/29] Try a fix for #6024 --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2acb57665a6..2a1f1dab8bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1765,7 +1765,7 @@ else print ''; $paymentstatic->id=$objp->rowid; $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; + $paymentstatic->ref=($objp->ref ? $objp->ref : $objp->rowid); $paymentstatic->num_paiement=$objp->num_paiement; $paymentstatic->payment_code=$objp->payment_code; print $paymentstatic->getNomUrl(1); From b2ed3f30535871b0f313d7b51b2051845f8ac772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 16:32:14 +0100 Subject: [PATCH 03/29] Fix translation --- htdocs/langs/en_US/bills.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index f89e4f1121e..65a93b573e3 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -41,7 +41,7 @@ ConsumedBy=Consumed by NotConsumed=Not consumed NoReplacableInvoice=No replacable invoices NoInvoiceToCorrect=No invoice to correct -InvoiceHasAvoir=Corrected by one or several invoices +InvoiceHasAvoir=Was source of one or several credit notes CardBill=Invoice card PredefinedInvoices=Predefined Invoices Invoice=Invoice From 196428edf5dbb1d6a21e5abc3446d263a1a04dee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 16:34:38 +0100 Subject: [PATCH 04/29] FIX #6051 --- htdocs/societe/consumption.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index ea2cb899893..c31b4513ef5 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -250,6 +250,7 @@ if ($type_element == 'supplier_invoice') $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='supplier'; @@ -262,6 +263,7 @@ if ($type_element == 'supplier_order') $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='supplier'; @@ -275,6 +277,7 @@ if ($type_element == 'contract') $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_contrat = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='customer'; From 6e439109324dd66cc1add4ee608d9e6bdd0e3a15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 18:38:48 +0100 Subject: [PATCH 05/29] FIX Filter was wrong or lost during navigation --- htdocs/compta/resultat/clientfourn.php | 164 +++++++++++++++++-------- 1 file changed, 110 insertions(+), 54 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 95ea2bfe46c..63071794caa 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -52,6 +52,17 @@ if ($user->societe_id > 0) $socid = $user->societe_id; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='s.nom, s.rowid'; +if (! $sortorder) $sortorder='ASC'; + // Date range $year=GETPOST("year"); if (empty($year)) @@ -150,12 +161,23 @@ $hselected = 'report'; report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); // Show report array +$param='&modecompta='.$modecompta; +if ($date_startday) $param.='&date_startday='.$date_startday; +if ($date_startmonth) $param.='&date_startmonth='.$date_startmonth; +if ($date_startyear) $param.='&date_startyear='.$date_startyear; +if ($date_endday) $param.='&date_endday='.$date_endday; +if ($date_endmonth) $param.='&date_endmonth='.$date_endmonth; +if ($date_endyear) $param.='&date_endyear='.$date_startyear; + print ''; print ''; -print ''; +print_liste_field_titre(''); +print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); if ($modecompta == 'CREANCES-DETTES') - print ""; -print ""; +{ + print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder); +} +print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder); print "\n"; /* @@ -197,7 +219,7 @@ else $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.nom, s.rowid"; -$sql.= " ORDER BY s.nom, s.rowid"; +$sql.= $db->order($sortfield, $sortorder); dol_syslog("get customer invoices", LOG_DEBUG); $result = $db->query($sql); @@ -323,7 +345,7 @@ else $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql .= " GROUP BY s.nom, s.rowid"; -$sql .= " ORDER BY s.nom, s.rowid"; +$sql.= $db->order($sortfield, $sortorder); print ''; @@ -408,7 +430,11 @@ else } $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, c.id"; -$sql.= " ORDER BY c.libelle, c.id"; +$newsortfield = $sortfield; +if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id'; +if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; +if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; +$sql.= $db->order($newsortfield, $sortorder); dol_syslog("get social contributions deductible=0", LOG_DEBUG); $result=$db->query($sql); @@ -468,8 +494,6 @@ if ($modecompta == 'CREANCES-DETTES') if (! empty($date_start) && ! empty($date_end)) $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " GROUP BY c.libelle, c.id"; - $sql.= " ORDER BY c.libelle, c.id"; } else { @@ -483,9 +507,13 @@ else if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " GROUP BY c.libelle, c.id"; - $sql.= " ORDER BY c.libelle, c.id"; } +$sql.= " GROUP BY c.libelle, c.id"; +$newsortfield = $sortfield; +if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id'; +if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; +if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; +$sql.= $db->order($newsortfield, $sortorder); dol_syslog("get social contributions deductible=1", LOG_DEBUG); $result=$db->query($sql); @@ -569,8 +597,12 @@ if (! empty($conf->salaries->enabled)) $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; - $sql.= " ORDER BY u.firstname"; - + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'u.firstname, u.lastname'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); + dol_syslog("get payment salaries"); $result=$db->query($sql); $subtotal_ht = 0; @@ -638,7 +670,7 @@ if (! empty($conf->expensereport->enabled)) $column='p.date_valid'; } else { - $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc"; + $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht, sum(p.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; @@ -652,55 +684,59 @@ if (! empty($conf->expensereport->enabled)) print ''; if (! empty($date_start) && ! empty($date_end)) + { $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; + } + + $sql.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.ref'; + $sql.= $db->order($newsortfield, $sortorder); - $sql.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; - $sql.= " ORDER BY p.ref"; - - dol_syslog("get expense report outcome"); - $result=$db->query($sql); - $subtotal_ht = 0; - $subtotal_ttc = 0; - if ($result) + dol_syslog("get expense report outcome"); + $result=$db->query($sql); + $subtotal_ht = 0; + $subtotal_ttc = 0; + if ($result) + { + $num = $db->num_rows($result); + $var=true; + if ($num) { - $num = $db->num_rows($result); - $var=true; - if ($num) + while ($obj = $db->fetch_object($result)) { - while ($obj = $db->fetch_object($result)) - { - $total_ht -= $obj->amount_ht; - $total_ttc -= $obj->amount_ttc; - $subtotal_ht += $obj->amount_ht; - $subtotal_ttc += $obj->amount_ttc; + $total_ht -= $obj->amount_ht; + $total_ttc -= $obj->amount_ttc; + $subtotal_ht += $obj->amount_ht; + $subtotal_ttc += $obj->amount_ttc; - $var = !$var; - print ""; - - print "\n"; - - if ($modecompta == 'CREANCES-DETTES') print ''; - print ''; - print ''; - } - } - else - { $var = !$var; print ""; - print ''; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; print ''; } } else { - dol_print_error($db); - } - print ''; - if ($modecompta == 'CREANCES-DETTES') - print ''; - print ''; + $var = !$var; + print ""; + print ''; print ''; + } + } + else + { + dol_print_error($db); + } + print ''; + if ($modecompta == 'CREANCES-DETTES') + print ''; + print ''; + print ''; } /* @@ -720,7 +756,11 @@ if (! empty($conf->don->enabled)) if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; - $sql.= " ORDER BY p.societe, p.firstname, p.lastname, dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get dunning"); $result=$db->query($sql); @@ -795,7 +835,11 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); @@ -840,7 +884,11 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat received back", LOG_DEBUG); $result=$db->query($sql); @@ -884,7 +932,11 @@ else $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'"; $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); @@ -925,7 +977,11 @@ else $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'"; $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); From f6734be1a17d3be5875138701fc1c5cb2831cf7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:08:44 +0100 Subject: [PATCH 06/29] Fix security hole. Add quick and fast hack to fix it --- htdocs/cron/admin/cron.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 697b24fcc1e..5b517857c7c 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -88,9 +88,20 @@ print ""; print ''; print ''; -print ''; print ''; print ''; From 711961ed1825407064125ad918a341f527e773ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:24:40 +0100 Subject: [PATCH 07/29] Fix missing translation --- htdocs/admin/ihm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 3147538c8fe..1a9ad5f317a 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -38,6 +38,7 @@ $langs->load("products"); $langs->load("members"); $langs->load("projects"); $langs->load("hrm"); +$langs->load("agenda"); if (! $user->admin) accessforbidden(); From c23919c51a110dfff2acab42bc69b40c6cdddd9f Mon Sep 17 00:00:00 2001 From: BENKE Charlie Date: Wed, 30 Nov 2016 09:41:33 +0100 Subject: [PATCH 08/29] 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 81e60f36e7dbabe2ac46f0054f7d28853e04d9d1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 14:17:03 +0100 Subject: [PATCH 09/29] Fix: message should not have color of warning --- htdocs/theme/eldy/style.css.php | 6 +++--- htdocs/theme/md/style.css.php | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 6685b0cc745..16a6151858b 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3041,14 +3041,14 @@ div.error { /* Info admin */ div.info { - color: #302010; + color: #303020; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #DFBF9A; + border: 1px solid #AAAAAA; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #EFCFAA; + background: #D0DAD4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 43e5398b13e..968fedfb51f 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2944,14 +2944,14 @@ div.error { /* Info admin */ div.info { - color: #302010; + color: #303020; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #DFBF9A; - -moz-border-radius:3px; - -webkit-border-radius: 3px; - border-radius:3px; - background: #EFCFAA; + border: 1px solid #AAAAAA; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + background: #D0DAD4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } From b518e60ff5cb9f69d888dd475a808137f035a72f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 15:04:45 +0100 Subject: [PATCH 10/29] Fix: message should not have color of warning --- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 16a6151858b..b00dbc174e6 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3048,7 +3048,7 @@ div.info { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #D0DAD4; + background: #E0EAE4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 968fedfb51f..e192501354d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2951,7 +2951,7 @@ div.info { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; - background: #D0DAD4; + background: #E0EAE4; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); } From e846d746549b3244c6ecf17c3313b56615f61d38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 15:19:16 +0100 Subject: [PATCH 11/29] Fix sort on invlice list --- htdocs/compta/facture/list.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 79342baf293..d9e5ae8ce23 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -130,7 +130,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search $fieldstosearchall = array( 'f.facnumber'=>'Ref', 'f.ref_client'=>'RefCustomer', - 'fd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'f.note_public'=>'NotePublic', ); @@ -152,7 +152,7 @@ $arrayfields=array( 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0), + 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -648,7 +648,9 @@ $sql.= ' f.datec as date_creation, f.tms as date_update,'; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; -if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status +// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) +// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. +if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed'; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -662,7 +664,6 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)"; if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; -else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; // We'll need this table joined to the select in order to filter by sale @@ -1018,8 +1019,8 @@ if ($resql) if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1038,7 +1039,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -1135,7 +1136,7 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { print ''; @@ -1369,9 +1370,9 @@ if ($resql) $totalarray['totalttc'] += $obj->total_ttc; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $paiement; @@ -1379,7 +1380,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; From 37d0e7a2e8562d86975cc503efe9d7c23e76fb37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 16:17:54 +0100 Subject: [PATCH 12/29] Doxygen --- htdocs/accountancy/class/accountingaccount.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index b63d7ce2fda..9749e38007f 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -60,10 +60,10 @@ class AccountingAccount extends CommonObject /** * Load record in memory * - * @param int $rowid Id - * @param string $account_number Account number - * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system - * @return int <0 if KO, >0 if OK + * @param int $rowid Id + * @param string $account_number Account number + * @param int $limittocurrentchart 1=Do not load record if it is into another accounting system + * @return int <0 if KO, Id of record if OK and found */ function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) { global $conf; From c17d354367937f9b9271cdc4807ab9ac1a6c350a Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 30 Nov 2016 16:48:27 +0100 Subject: [PATCH 13/29] Fix propal updateline oldcopy extrafields --- htdocs/comm/propal/class/propal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6c5fdcbbec4..d94932d10c8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -651,6 +651,7 @@ class Propal extends CommonObject //Fetch current line from the database and then clone the object and set it in $oldline property $line = new PropaleLigne($this->db); $line->fetch($rowid); + $line->fetch_optionals(); // Fetch extrafields for oldcopy $staticline = clone $line; From 317df1cf9168849e583b69f40916b1e6832d8afa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 20:24:36 +0100 Subject: [PATCH 14/29] 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 '
  ".$langs->trans("AmountHT")."".$langs->trans("AmountTTC")."
'.$langs->trans("SuppliersInvoices").'
'.$langs->trans("ExpenseReport").'
 ".$langs->trans("ExpenseReport")." userid."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount_ht).''.price(-$obj->amount_ttc).'
 '.$langs->trans("None").'".$langs->trans("ExpenseReport")." userid."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount_ht).''.price(-$obj->amount_ttc).'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
 '.$langs->trans("None").'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
'.$langs->trans("KeyForCronAccess").''; -if (! empty($conf->use_javascript_ajax)) - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +$disabled=''; +if (! empty($conf->global->CRON_DISABLE_KEY_CHANGE)) $disabled=' disabled="disabled"'; +print ''; +if (empty($conf->global->CRON_DISABLE_KEY_CHANGE)) +{ + print ''; + if (! empty($conf->use_javascript_ajax)) + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +} +else +{ + print (! empty($conf->global->CRON_KEY)?$conf->global->CRON_KEY:''); + print ''; +} print ' 
'; print ''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').'
'; $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 ''; $sql = "SELECT sum(p.amount) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " WHERE p.fk_expensereport = ".$chid; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e"; + $sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$chid; + $sql.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php index 31c2d985840..eba616d2620 100644 --- a/htdocs/expensereport/synchro_compta.php +++ b/htdocs/expensereport/synchro_compta.php @@ -139,6 +139,7 @@ else: $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.fk_statut = 6"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.date_valid DESC"; $resql=$db->query($sql); From 7a3b3090139e9300504d4f3ad4cd43911523a361 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:22:26 +0100 Subject: [PATCH 19/29] Fix width --- htdocs/compta/paiement/cheque/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index ebfd598ee0b..9ea4d6eb1e0 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -160,7 +160,7 @@ if ($resql) print ''; print ''; print ''; print ''; print '"; // Num ref cheque - print ''; } @@ -847,20 +853,33 @@ foreach ($listofreferent as $key => $value) // Amount inc tax if (empty($value['disableamount'])) { + $total_ttc_by_line=null; if ($tablename == 'don') $total_ttc_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $defaultvat = get_default_tva($mysoc, $mysoc); - $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + if (! empty($conf->salaries->enabled)) + { + // TODO Permission to read daily rate + $defaultvat = get_default_tva($mysoc, $mysoc); + $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + } + else + { + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); + } } else { $total_ttc_by_line=$element->total_ttc; } print ''; } @@ -923,15 +942,25 @@ foreach ($listofreferent as $key => $value) if ($breakline) print $breakline; + // Total print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; print ''; print ''; } From fb2f33cfac34b58c0001d35475c84def4ca8f686 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 19:48:08 +0100 Subject: [PATCH 21/29] FIX Clean corrupted data --- htdocs/install/mysql/migration/repair.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index d487217cb9a..44560366c6c 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -294,3 +294,19 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m drop table tmp_c_shipment_mode; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; + From 17bc24e83e008b84b55e6ad93a59e6a724d18832 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 20:05:49 +0100 Subject: [PATCH 22/29] Complete repair --- htdocs/install/mysql/migration/repair.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 44560366c6c..df17ce38e68 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -296,9 +296,9 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; --- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; --- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; @@ -306,7 +306,7 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; --- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_fin where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; --- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_fin where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; From 888c4cd2add8d33791800a7e00ae5a44c650be9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 20:15:56 +0100 Subject: [PATCH 23/29] Fix corrupted value for pointoftax field --- htdocs/install/mysql/migration/repair.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index df17ce38e68..9f192a0d9cc 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -21,6 +21,13 @@ +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL; + + + -- Requests to clean corrupted database From 2b8fbf200a9a1533d4c718d62ede0412ef4375fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 21:29:49 +0100 Subject: [PATCH 24/29] Complete work on the new dol_banner --- htdocs/comm/propal/contact.php | 1 + htdocs/comm/propal/info.php | 12 +- htdocs/commande/contact.php | 107 +++--- htdocs/commande/document.php | 73 +++- htdocs/commande/info.php | 80 ++++- htdocs/commande/note.php | 85 +++-- htdocs/core/tpl/notes.tpl.php | 4 +- htdocs/expedition/shipment.php | 592 ++++++++++++++++++++------------ htdocs/langs/en_US/orders.lang | 1 + htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 5 + 11 files changed, 634 insertions(+), 328 deletions(-) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index f82732a49ff..8588bfc5749 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("facture"); $langs->load("orders"); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index c4f3a3e4f4e..14a4911b80f 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -32,12 +32,21 @@ $langs->load('propal'); $langs->load('compta'); $id=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); $socid=GETPOST('socid','int'); // Security check if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'propal', $id); +$object = new Propal($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); + exit; +} + + /* * View @@ -47,8 +56,6 @@ $form = new Form($db); llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); -$object = new Propal($db); -$object->fetch($id); $object->fetch_thirdparty(); $head = propal_prepare_head($object); @@ -112,7 +119,6 @@ print '
'; dol_print_object_info($object); -print ''; print ''; dol_fiche_end(); diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index da584f9197c..dfa137f231e 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("orders"); $langs->load("sendings"); @@ -139,6 +140,8 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref) > 0) { + $object->fetch_thirdparty(); + $soc = new Societe($db); $soc->fetch($object->socid); @@ -146,62 +149,60 @@ if ($id > 0 || ! empty($ref)) $head = commande_prepare_head($object); dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order'); + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - /* - * Facture synthese pour rappel - */ - 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 15/29] 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 411e82b7a3b528072438143e88cd4c309fa95f38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:52:38 +0100 Subject: [PATCH 16/29] Fix button set to paid not always visible when it should. --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d3b25d2277f..9112f8ee99b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1999,7 +1999,8 @@ if ($action != 'create' && $action != 'edit') // If bank module is not used if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) { - if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + if ($object->paid == 0) { print '"; } From 33139dd57abc8b8ab02ffc4f0c0c254d826051b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 17:46:59 +0100 Subject: [PATCH 17/29] 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.
'; - From a75577516d1bf37c69418258b2dc5e9beec821ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:13:04 +0100 Subject: [PATCH 18/29] Fix pb with multicompany on expense report --- htdocs/expensereport/export_csv.php | 1 + htdocs/expensereport/index.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/payment/card.php | 2 +- htdocs/expensereport/payment/payment.php | 5 +++-- htdocs/expensereport/synchro_compta.php | 1 + 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php index 3cf520c6739..d55e262e2e4 100644 --- a/htdocs/expensereport/export_csv.php +++ b/htdocs/expensereport/export_csv.php @@ -128,6 +128,7 @@ if (isset($_POST['action'])) $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.rowid"; $result = $db->query($sql); diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 117ecc5e3c4..83e45d2a1b7 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -147,7 +147,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u" if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user_author"; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND d.fk_user_author IN ('.join(',',$childids).')'; -//$sql.= " AND d.entity = ".$conf->entity; +$sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND d.fk_user_author = ".$socid; $sql.= $db->order($sortfield,$sortorder); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b857b9c92d4..476ef2224f5 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -133,7 +133,7 @@ $sql.= " d.date_debut, d.date_fin, d.date_valid,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; -$sql.= " WHERE d.entity = ".$conf->entity; +$sql.= ' WHERE d.entity IN ('.getEntity('expensereport', 1).')'; // Search all if (!empty($sall)) { diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 19d5b3206f7..f9ba5af3dc0 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -199,7 +199,7 @@ $disable_delete = 0; $sql = 'SELECT er.rowid as did, er.paid, er.total_ttc, per.amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as per,'.MAIN_DB_PREFIX.'expensereport as er'; $sql.= ' WHERE per.fk_expensereport = er.rowid'; -$sql.= ' AND er.entity = '.$conf->entity; +$sql.= ' AND er.entity IN ('.getEntity('expensereport', 1).')'; $sql.= ' AND per.rowid = '.$id; dol_syslog("expensereport/payment/card.php", LOG_DEBUG); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index c4351e4d038..e361a9954c0 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -193,8 +193,9 @@ if (GETPOST("action") == 'create') print '
'.$langs->trans("Amount").''.price($expensereport->total_ttc,0,$outputlangs,1,-1,-1,$conf->currency).'
 '; - print ''; + print ''; print ''; @@ -179,7 +179,7 @@ if ($resql) print "
'; + print ''; $checkdepositstatic->id=$objp->rowid; $checkdepositstatic->ref=($objp->ref?$objp->ref:$objp->rowid); $checkdepositstatic->statut=$objp->statut; From 69b5baebc53450ce9a3fb6c12c3a5da60903266d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:54:06 +0100 Subject: [PATCH 20/29] FIX rendering of output of estimated amount on project overview page. --- htdocs/projet/element.php | 55 ++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cbd22856e4c..1d9ffd61a99 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -812,6 +812,8 @@ foreach ($listofreferent as $key => $value) $warning=''; if (empty($value['disableamount'])) { + $total_ht_by_line=null; + $othermessage=''; if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { @@ -828,7 +830,7 @@ foreach ($listofreferent as $key => $value) } else { - print $langs->trans("ModuleDisabled"); + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } } else @@ -836,9 +838,13 @@ foreach ($listofreferent as $key => $value) $total_ht_by_line=$element->total_ht; } print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ht_by_line)?price($total_ht_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ht_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ttc_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print '
'.$langs->trans("Number").': '.$i.''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''.$langs->trans("TotalHT").' : '.price($total_ht).''; + if (empty($value['disableamount'])) + { + if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + } + print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; + if (empty($value['disableamount'])) + { + + if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + } + print ' 
'; + // Order card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - // Ref - print '"; - - // Ref commande client - print ''; - print ''; - - // Customer - if (is_null($object->thirdparty)) $object->fetch_thirdparty(); - - print ""; - print ''; - - // Delivery address - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - print ''; - } - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
".$langs->trans("Company")."'.$object->thirdparty->getNomUrl(1).'
'; - print ''; - - if ($action != 'editdelivery_address' && $object->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'
'; - print '
'; - - if ($action == 'editdelivery_address') - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','commande',$object->id); - } - else - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id); - } - print '
"; - - print ''; + dol_fiche_end(); print '
'; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index a05a6e0061d..b687e577a33 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -94,30 +94,79 @@ if ($id > 0 || ! empty($ref)) $head = commande_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); - // 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; foreach($filearray as $key => $file) { - $totalsize+=$file['size']; + $totalsize+=$file['size']; } - - + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - print ''; print ''; print ''; + print "
'.$langs->trans('Ref').''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; + print "
\n"; + + print dol_fiche_end(); $modulepart = 'commande'; $permission = $user->rights->commande->creer; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index ae0dd789064..ddf30b290be 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -32,12 +32,21 @@ if (!$user->rights->commande->lire) accessforbidden(); $langs->load("orders"); $langs->load("sendings"); -// Security check $socid=0; $comid = GETPOST("id",'int'); +$id = GETPOST("id",'int'); +$ref=GETPOST('ref','alpha'); + +// Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$comid,''); +$object = new Commande($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); + exit; +} /* @@ -46,21 +55,76 @@ $result=restrictedArea($user,'commande',$comid,''); llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); -$commande = new Commande($db); -$commande->fetch($comid); -$commande->info($comid); -$soc = new Societe($db); -$soc->fetch($commande->socid); +$object->fetch_thirdparty(); +$object->info($object->id); -$head = commande_prepare_head($commande); +$soc = new Societe($db); +$soc->fetch($object->thirdparty->id); + +$head = commande_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); +// Order card + +$linkback = '' . $langs->trans("BackToList") . ''; + + +$morehtmlref='
'; +// Ref customer +$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + +print '
'; +print '
'; + +print '
'; print '
'; -dol_print_object_info($commande); +dol_print_object_info($object); print '
'; print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index e6bf504bec7..8af3447734d 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -48,6 +48,7 @@ $object = new Commande($db); if (! $object->fetch($id, $ref) > 0) { dol_print_error($db); + exit; } $permissionnote=$user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php @@ -77,38 +78,66 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), 0, 'order'); - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print '"; - - // Ref commande client - print ''; - print ''; - - // Customer - print ""; - print ''; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
".$langs->trans("Company")."'.$soc->getNomUrl(1).'
"; - - print '
'; - + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; + + dol_fiche_end(); } diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index c971a49148f..01d0ba7b33c 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -72,13 +72,13 @@ else $typeofdata='textarea:12:95%';
-
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
societe_id)) { ?>
-
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 4674a2a4583..887b5805533 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -31,7 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -53,108 +56,165 @@ $socid=0; if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$id); +$object = new Commande($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once + + + /* * Actions */ -// Categorisation dans projet -if ($action == 'classin') +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $commande = new Commande($db); - $commande->fetch($id); - $commande->setProject(GETPOST('projectid','int')); + // Categorisation dans projet + if ($action == 'classin') + { + $object = new Commande($db); + $object->fetch($id); + $object->setProject(GETPOST('projectid','int')); + } + + if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') + { + $object = new Commande($db); + $object->fetch($id); + $result = $object->cloture($user); + } + + // Positionne ref commande client + else if ($action == 'setref_client' && $user->rights->commande->creer) { + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'setdatedelivery' && $user->rights->commande->creer) + { + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); + + $object = new Commande($db); + $object->fetch($id); + $result=$object->set_date_livraison($user,$datelivraison); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $object->setDeliveryAddress(GETPOST('delivery_address_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setmode' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setavailability' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->availability(GETPOST('availability_id')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setdemandreason' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->demand_reason(GETPOST('demand_reason_id')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setconditions' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + // shipping method + if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + // warehouse + if ($action == 'setwarehouse' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'update_extras') + { + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + + if (! $error) + { + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('orderdao')); + $parameters = array('id' => $object->id); + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by + // some hooks + if (empty($reshook)) { + $result = $object->insertExtraFields(); + if ($result < 0) { + $error++; + } + } else if ($reshook < 0) + $error++; + } + + if ($error) + $action = 'edit_extras'; + } + + if ($action == 'set_thirdparty' && $user->rights->commande->creer) + { + $object->fetch($id); + $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); + + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); + exit(); + } + + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + } -if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') -{ - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->cloture($user); -} - -// Positionne ref commande client -if ($action == 'setrefcustomer' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $commande->set_ref_client($user,GETPOST('ref_customer','alpha')); -} - -if ($action == 'setdatedelivery' && $user->rights->commande->creer) -{ - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); - - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->set_date_livraison($user,$datelivraison); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $commande->setDeliveryAddress(GETPOST('delivery_address_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setmode' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setavailability' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->availability(GETPOST('availability_id')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setdemandreason' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->demand_reason(GETPOST('demand_reason_id')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setconditions' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -// shipping method -if ($action == 'setshippingmethod' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -// warehouse -if ($action == 'setwarehouse' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->setWarehouse(GETPOST('warehouse_id', 'int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - - /* * View */ @@ -162,81 +222,109 @@ if ($action == 'setwarehouse' && $user->rights->commande->creer) { $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } llxHeader('',$langs->trans('OrderCard'),''); if ($id > 0 || ! empty($ref)) { - $commande = new Commande($db); - if ( $commande->fetch($id,$ref) > 0) + $object = new Commande($db); + if ( $object->fetch($id,$ref) > 0) { - $commande->loadExpeditions(1); + $object->loadExpeditions(1); $product_static=new Product($db); $soc = new Societe($db); - $soc->fetch($commande->socid); + $soc->fetch($object->socid); $author = new User($db); - $author->fetch($commande->user_author_id); + $author->fetch($object->user_author_id); - $head = commande_prepare_head($commande); + $res = $object->fetch_optionals($object->id, $extralabels); + + $head = commande_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), 0, 'order'); - /* - * Confirmation de la validation - */ + + $formconfirm = ''; + + // Confirm validation if ($action == 'cloture') { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); } - // Onglet commande - //$nbrow=8; - //if (! empty($conf->projet->enabled)) $nbrow++; - - print ''; - - // Ref - print ''; - print ''; - print ''; - - // Ref commande client - print ''; - print ''; + + // Print form confirm + print $formconfirm; + + + // Order card - // Third party - print ''; - print ''; - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'.$langs->trans('Ref').''; - print $form->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'; - print ''; - if ($action != 'RefCustomerOrder' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->commande->creer && $action == 'RefCustomerOrder') - { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } - else - { - print $commande->ref_client; - } - print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'; // Discounts for third party - print ''; print ''; print ''; @@ -281,29 +369,29 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('DateDeliveryPlanned'); print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -246,7 +334,7 @@ if ($id > 0 || ! empty($ref)) $absolute_creditnote=price2num($absolute_creditnote,'MT'); if ($absolute_discount) { - if ($commande->statut > Commande::STATUS_DRAFT) + if ($object->statut > Commande::STATUS_DRAFT) { print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); } @@ -255,7 +343,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); } } if ($absolute_creditnote) @@ -268,9 +356,9 @@ if ($id > 0 || ! empty($ref)) // Date print '
'.$langs->trans('Date').''; - print dol_print_date($commande->date,'daytext'); - if ($commande->hasDelay() && empty($commande->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning"); + print dol_print_date($object->date,'daytext'); + if ($object->hasDelay() && empty($object->date_livraison)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; print ''; if ($action == 'editdate_livraison') { - print '
'; + print ''; print ''; print ''; - $form->select_date($commande->date_livraison>0?$commande->date_livraison:-1,'liv_','','','',"setdatedelivery"); + $form->select_date($object->date_livraison>0?$object->date_livraison:-1,'liv_','','','',"setdatedelivery"); print ''; print '
'; } else { - print dol_print_date($commande->date_livraison,'daytext'); - if ($commande->hasDelay() && ! empty($commande->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning"); + print dol_print_date($object->date_livraison,'daytext'); + if ($object->hasDelay() && ! empty($object->date_livraison)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } print ''; // Note on several rows //print ''.$langs->trans('NotePublic').' :
'; - //print nl2br($commande->note_public); + //print nl2br($object->note_public); //print ''; print ''; @@ -313,13 +401,13 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('SendingMethod'); print ''; if ($action != 'editshippingmethod' && $user->rights->expedition->creer) - print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).''; + print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).''; print ''; print ''; if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); } print ''; print ''; @@ -333,34 +421,35 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Warehouse'); print ''; if ($action != 'editwarehouse' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).''; + print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).''; print ''; print ''; if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none'); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); } print ''; print ''; } // Terms of payment + /* print ''; print ''; - if ($action != 'editconditions' && ! empty($commande->brouillon)) print ''; + if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); } print ''; @@ -369,18 +458,18 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmode' && ! empty($commande->brouillon)) print ''; + if ($action != 'editmode' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); } - print ''; + print '';*/ // Availability print ''; @@ -388,13 +477,13 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('AvailabilityPeriod'); print ''; if ($action != 'editavailability') - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; print ''; if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'availability_id', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'none', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); } print ''; @@ -404,63 +493,124 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Source'); print ''; if ($action != 'editdemandreason') - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; print ''; if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); } - // Project - if (! empty($conf->projet->enabled)) + $tmparray=$object->getTotalWeightVolume(); + $totalWeight=$tmparray['weight']; + $totalVolume=$tmparray['volume']; + if ($totalWeight || $totalVolume) { - $langs->load('projects'); - print ''; - print ''; - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project'); - print ''.img_edit($langs->trans('SetProject')).'
'; - print ''; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid', 0, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none', 0, 0); - } - print ''; + print ''.$langs->trans("CalculatedWeight").''; + print ''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); + print ''; + print ''.$langs->trans("CalculatedVolume").''; + print ''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); + print ''; } + + // TODO How record was recorded OrderMode (llx_c_input_method) + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->commande->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print ''; + print ''; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - // Lignes de 3 colonnes + print ''; + print '
'; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Total HT - print ''; - print ''; + print ''; + print ''; print ''; - // Total TVA - print ''; + // Total VAT + print ''; print ''; + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 + { + print ''; + print ''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF + { + print ''; + print ''; + } + // Total TTC - print ''; + print ''; print ''; - // Statut - print ''; - print ''; - print ''; - - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans('AmountHT').''.price($commande->total_ht, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountHT').''.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($commande->total_tva, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').''.price($commande->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'

'; - + print ''; + print '
'; + print '
'; + print ''; + + print '

'; + + + /** * Lines or orders with quantity shipped and remain to ship - * Note: Qty shipped are already available into $commande->expeditions[fk_product] + * Note: Qty shipped are already available into $object->expeditions[fk_product] */ print ''; @@ -472,7 +622,7 @@ if ($id > 0 || ! empty($ref)) $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - $sql.= " WHERE cd.fk_commande = ".$commande->id; + $sql.= " WHERE cd.fk_commande = ".$object->id; $sql.= " ORDER BY cd.rang, cd.rowid"; //print $sql; @@ -522,7 +672,7 @@ if ($id > 0 || ! empty($ref)) // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $commande->fetch_thirdparty(); + $object->fetch_thirdparty(); $prod = new Product($db); $prod->id = $objp->fk_product; @@ -532,7 +682,7 @@ if ($id > 0 || ! empty($ref)) $outputlangs = $langs; $newlang=''; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$commande->thirdparty->default_lang; + if (empty($newlang)) $newlang=$object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); @@ -594,7 +744,7 @@ if ($id > 0 || ! empty($ref)) $qtyProdCom=$objp->qty; print ''; @@ -691,7 +841,7 @@ if ($id > 0 || ! empty($ref)) print '
'; // Bouton expedier sans gestion des stocks - if (empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED)) + if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if ($user->rights->expedition->creer) { @@ -712,12 +862,12 @@ if ($id > 0 || ! empty($ref)) // Bouton expedier avec gestion des stocks - if (! empty($conf->stock->enabled) && $commande->statut == Commande::STATUS_DRAFT) + if (! empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) { print $langs->trans("ValidateOrderFirstBeforeShipment"); } - if (! empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED)) + if (! empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if ($user->rights->expedition->creer) { @@ -726,10 +876,10 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - //print ''; - print ''; + //print ''; + print ''; print ''; - print ''; + print ''; //print '
'; // Nb of sending products for this line of order - $qtyAlreadyShipped = (! empty($commande->expeditions[$objp->rowid])?$commande->expeditions[$objp->rowid]:0); + $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); print $qtyAlreadyShipped; print '
'; $langs->load("stocks"); @@ -742,7 +892,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans("WarehouseSource"); //print ''; //print ''; print ''; print ''; @@ -862,8 +839,10 @@ if ($resql) { if ($action == 'editline' && GETPOST('lineid','int') == $pdluo->id) { //Current line edit - print "\n".''; } else @@ -901,7 +881,7 @@ if ($resql) else dol_print_error($db); print ''; -print ''; +print ''; print '';
'; - print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); + print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); if (count($formproduct->cache_warehouses) <= 0) { print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; @@ -773,7 +923,7 @@ if ($id > 0 || ! empty($ref)) } } - show_list_sending_receive('commande',$commande->id); + show_list_sending_receive('commande',$object->id); } else { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 62ffb02bbcf..b752426b452 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -53,6 +53,7 @@ StatusOrderBilled=Billed StatusOrderReceivedPartially=Partially received StatusOrderReceivedAll=Everything received ShippingExist=A shipment exists +QtyOrdered=Qty ordered ProductQtyInDraft=Product quantity into draft orders ProductQtyInDraftOrWaitingApproved=Product quantity into draft or approved orders, not yet ordered MenuOrdersToBill=Orders delivered diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b00dbc174e6..c53221b3951 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2380,7 +2380,7 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border vertical-align: middle; } div .tdtop { - vertical-align: top; + vertical-align: top !important; padding-top: 5px !important; padding-bottom: 0px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index e192501354d..997b7d33dcd 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2768,6 +2768,11 @@ div.tabBar .noborder { -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; box-shadow: 0px 0px 0px #f4f4f4 !important; } +div .tdtop { + vertical-align: top !important; + padding-top: 5px !important; + padding-bottom: 0px; +} #tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { border-bottom: 1px solid #AAA !important; From 8c428ac5b750255c82cf9b6827c15876e0f10b68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 00:51:15 +0100 Subject: [PATCH 25/29] Fix responsive design --- htdocs/admin/company.php | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 4ebbd2096f9..f114e117b6d 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -306,12 +306,12 @@ if ($action == 'edit' || $action == 'updateedit') $var=true; print ''; - print ''."\n"; + print ''."\n"; // Name $var=!$var; print ''."\n"; + print ''."\n"; // Addresse $var=!$var; @@ -320,11 +320,11 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''."\n"; + print ''."\n"; $var=!$var; print ''."\n"; + print ''."\n"; // Country $var=!$var; @@ -356,20 +356,20 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; + print ''; print ''."\n"; // Web $var=!$var; print ''; + print ''; print ''."\n"; // Barcode if (! empty($conf->barcode->enabled)) { $var=!$var; print ''; + print ''; print ''; } @@ -377,7 +377,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($conf->global->PRODUCT_USE_UNITS) print ''; print ''; @@ -1606,7 +1608,7 @@ else } // Ligne en mode update else - { + { // Ligne carac print ""; print ' +global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; } 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 9b65050b663..2fd59793a09 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 @@ -243,3 +243,6 @@ ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, en UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); + +ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer; + diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index f229f020bf6..60a6b574d44 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -38,6 +38,7 @@ create table llx_contrat fk_commercial_signature integer, -- obsolete fk_commercial_suivi integer, -- obsolete fk_user_author integer NOT NULL default 0, + fk_user_modif integer, fk_user_mise_en_service integer, fk_user_cloture integer, note_private text, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 19f6dfe9d81..82ff69fe88a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -231,7 +231,7 @@ SpaceX=Space X SpaceY=Space Y FontSize=Font size Content=Content -NoticePeriod=Notice +NoticePeriod=Notice period NewByMonth=New by month Emails=E-mails EMailsSetup=E-mails setup diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 9aae20a6300..09f1604e931 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -674,14 +674,12 @@ elseif ($object->id > 0) } - print ''; print ''; print ''; print ''; print ''; - $head=project_prepare_head($object); dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project')); From 4b831537e501afdcbefe909edb87ffda713db083 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 21:27:08 +0100 Subject: [PATCH 28/29] Fix several problem in notes management of template invoices. --- htdocs/compta/facture.php | 48 ++++++- htdocs/compta/facture/class/facture.class.php | 39 +++++- htdocs/compta/facture/fiche-rec.php | 130 ++++++++++-------- htdocs/contrat/card.php | 2 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/langs/en_US/bills.lang | 2 +- 6 files changed, 159 insertions(+), 63 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 07cb56b830b..839841e4cf9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -898,7 +898,7 @@ if (empty($reshook)) } } - // Standard or deposit or proforma invoice + // Standard or deposit or proforma invoice, not from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && GETPOST('fac_rec') <= 0) { if (GETPOST('socid', 'int') < 1) @@ -2075,6 +2075,8 @@ if ($action == 'create') } print '' . "\n"; + $exampletemplateinvoice=new FactureRec($db); + // Overwrite value if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0) { @@ -2109,7 +2111,10 @@ if ($action == 'create') $objp = $db->fetch_object($resql); print ''; $i ++; } @@ -2387,9 +2392,10 @@ if ($action == 'create') print ''; } + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + // Date invoice print ''; @@ -2474,9 +2480,39 @@ if ($action == 'create') print ''; } + // Help of substitution key + $htmltext=''; + if (GETPOST('fac_rec','int') > 0) + { + $dateexample=dol_now(); + if (! empty($datefacture?$datefacture:$dateinvoice)) $dateexample=($datefacture?$datefacture:$dateinvoice); + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + } + // Public note print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - // Note public - print ''; + $note_public=GETPOST('note_public')?GETPOST('note_public'):$object->note_public; + $note_private=GETPOST('note_private')?GETPOST('note_private'):$object->note_private; - // Note private - print ''; + // Help of substitution key + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + + // Public note + print ''; + print ''; + print ''; + print ''; + print ''; + } // Author print ""; @@ -941,7 +980,7 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) { - $projectid = $object->fk_project; + $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; $langs->load('projects'); print '"; // First date of execution for cron @@ -1130,21 +1169,6 @@ else print '
'; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; print ''; print ''; @@ -410,13 +410,13 @@ if ($action == 'edit' || $action == 'updateedit') // Managing Director(s) $var=!$var; - print ''; + print ''; // Capital $var=!$var; - print ''; + print ''; // Juridical Status $var=!$var; @@ -432,10 +432,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''; // Object of the company $var=!$var; - print ''; print ''; @@ -543,12 +543,12 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print '
'; - print ''; + print ''; print ''; if (! empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; @@ -393,7 +393,7 @@ if ($action == 'edit' || $action == 'updateedit') // Note $var=!$var; - print '
'; + print '
'; print '
'; - print '
'; + print '
'; - print '
'; + print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -448,10 +448,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -464,10 +464,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -480,10 +480,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -496,10 +496,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -512,10 +512,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -526,13 +526,13 @@ if ($action == 'edit' || $action == 'updateedit') // TVA Intra $var=!$var; - print '
'; - print ''; + print '
'; + print ''; print '
'; + print '
'; print '
'; print ''; - print ''; + print ''; print "\n"; $var=true; $var=!$var; - print ''; print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; + print '
'; print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '
"; @@ -558,7 +558,7 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; From 211436b436cdf6560900c775eb99593712c28774 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 01:12:52 +0100 Subject: [PATCH 26/29] Better responsive --- htdocs/admin/company.php | 64 +++++++++++++++++---------------- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f114e117b6d..3d7202d5c70 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -699,19 +699,19 @@ else $var=true; $var=!$var; - print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; print ''; $var=!$var; - print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; // Web $var=!$var; - print ''; + print ''; // Barcode if (! empty($conf->barcode->enabled)) { $var=!$var; - print ''; + print ''; } // Logo $var=!$var; - print ''; $var=!$var; - print ''; + print ''; print '
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'.$langs->trans("CompanyName").''; + print '
'.$langs->trans("CompanyName").''; if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).''; print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyCountry").''; @@ -731,7 +731,7 @@ else print '
'.$langs->trans("CompanyCurrency").''; + print '
'.$langs->trans("CompanyCurrency").''; print currency_name($conf->currency,1); print ' ('.$conf->currency; print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : ''); @@ -739,52 +739,54 @@ else print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Logo").''; + print '
'.$langs->trans("Logo").''; - print '
'; + $tagtd='tagtd '; + if ($conf->browser->layout == 'phone') $tagtd=''; + print '
'; print $mysoc->logo; - print '
'; + print '
'; // It offers the generation of the thumbnail if it does not exist if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo)) { - print 'logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; + print '  '; } else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print ''; + print ''; } else { - print ''; + print ''; } - print '
'; + print ''; print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; @@ -796,22 +798,22 @@ else print ''; print ''; print ''; - print ''; + print ''; $var=true; // Managing Director(s) $var=!$var; - print ''; // Capital $var=!$var; - print ''; // Juridical Status $var=!$var; - print ''; @@ -819,7 +821,7 @@ else if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''; $var=!$var; - print ''; + print ''; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("ManagingDirectors").''; + print '
'.$langs->trans("ManagingDirectors").''; print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '
'.$langs->trans("Capital").''; + print '
'.$langs->trans("Capital").''; print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; + print '
'.$langs->trans("JuridicalStatus").''; print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; @@ -835,7 +837,7 @@ else if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; @@ -851,7 +853,7 @@ else if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; @@ -867,7 +869,7 @@ else if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; @@ -883,7 +885,7 @@ else if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; @@ -899,7 +901,7 @@ else if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; @@ -950,7 +952,7 @@ else print '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'; print ''; @@ -961,12 +963,12 @@ else print '
'; print ''; print ''; - print ''; + print ''; print "\n"; $var=true; $var=!$var; - print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c53221b3951..5de31c6ee59 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1439,7 +1439,7 @@ table.login_table_securitycode tr td { #img_securitycode { border: 1px solid #DDDDDD; } -#img_logo { +#img_logo, .img_logo { max-width: 200px; max-height: 100px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 997b7d33dcd..0edf06380f5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1479,7 +1479,7 @@ table.login_table_securitycode tr td { #img_securitycode { border: 1px solid #f4f4f4; } -#img_logo { +#img_logo, .img-logo { max-width: 200px; max-height: 100px; } From 788cbf9a01198eccb58e1da6f91d8840ed5441cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 13:30:17 +0100 Subject: [PATCH 27/29] Complete work on dol_banner on contracts --- htdocs/contrat/card.php | 164 +++++++++--------- htdocs/contrat/class/contrat.class.php | 3 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 5 +- htdocs/core/lib/functions.lib.php | 5 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- .../install/mysql/migration/4.0.0-5.0.0.sql | 3 + htdocs/install/mysql/tables/llx_contrat.sql | 1 + htdocs/langs/en_US/admin.lang | 2 +- htdocs/projet/card.php | 2 - 10 files changed, 97 insertions(+), 92 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c6e9a12e338..2d53eb6abbb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (! GETPOST('dateend')) @@ -999,7 +999,8 @@ llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); - +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); + $objectlignestatic=new ContratLigne($db); // Load object modContract @@ -1086,34 +1087,36 @@ if ($action == 'create') print '
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'.$langs->trans("FiscalMonthStart").''; + print '
'.$langs->trans("FiscalMonthStart").''; $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1; print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '
'; // Ref + print ''; + print $tmpcode; + print ''; // Ref customer print ''; - print ''; + print ''; // Ref supplier print ''; - print ''; + print ''; // Thirdparty print ''; print ''; if ($socid>0) { - print ''; } else { - print ''; } @@ -1122,7 +1125,7 @@ if ($action == 'create') if($socid>0) { // Ligne info remises tiers - print ''; if (empty($user->societe_id)) { @@ -1293,47 +1294,75 @@ else print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - print '
'.$langs->trans('Ref').''; if (! empty($modCodeContract->code_auto)) { $tmpcode=$langs->trans("Draft"); } else { - $tmpcode=''; + $tmpcode=''; } - print '
'.$langs->trans('Ref').''.$tmpcode.'
'.$langs->trans('RefCustomer').'
'.$langs->trans('RefSupplier').'
'.$langs->trans('ThirdParty').''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print $form->select_company('','socid','','SelectThirdParty',1); print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -1158,11 +1161,9 @@ if ($action == 'create') } print '
'.$langs->trans("NotePublic").''; - - $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); print $doleditor->Create(1); - + print '
'; + // Contract card $linkback = ''.$langs->trans("BackToList").''; - // Ref du contrat - if (! empty($modCodeContract->code_auto)) { - print '"; - } else { - print ''; - print ''; - print ''; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $morehtmlref=''; + if (! empty($modCodeContract->code_auto)) { + $morehtmlref.=$object->ref; + } else { + $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,3); + $morehtmlref.=$form->editfieldval("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,2); + } + + $morehtmlref.='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); + // Ref supplier + $morehtmlref.='
'; + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->contrat->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - // Customer - print ""; - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); + + + print '
'; + print '
'; + + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print "
'; - print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print '
".$langs->trans("Customer")."'.$object->thirdparty->getNomUrl(1).'
'; + // Ligne info remises tiers - print ''; - // Statut contrat - print '"; - // Date print ''; - print ''; print ''; - /* print ''; - print '\n";*/ - // Projet - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print '"; - } // Other attributes $cols = 3; @@ -1388,12 +1388,14 @@ else print "
'.$langs->trans('Discount').''; + print '
'.$langs->trans('Discount').''; if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$object->thirdparty->getAvailableDiscounts(); @@ -1343,44 +1372,15 @@ else print '.'; print '
'.$langs->trans("Status").''; - if ($object->statut==0) print $object->getLibStatut(2); - else print $object->getLibStatut(4); - print "
'; + print ''; print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer,'datehourpicker'); print '
'.$langs->trans("Date").''.dol_print_date($object->date_contrat,"dayhour")."
'; - print ''; - if ($action != "classify" && $user->rights->projet->creer) print ''; - print '
'; - print $langs->trans("Project"); - print 'id.'">'.img_edit($langs->trans("SetProject")).'
'; - print '
'; - if ($action == "classify") - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "projectid", 1, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "none", 0, 0); - } - print "
"; + print ''; + if (! empty($object->brouillon) && $user->rights->contrat->creer) { print ''; } - echo '
'; + //echo '
'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1457,8 +1459,8 @@ else print '
'.$langs->trans("ServiceNb",$cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").'
'; @@ -1927,8 +1929,6 @@ else '; - print '
'; - print '
'; print ''; // Array with (n*2)+1 lines diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a8f84731650..52a32e00067 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -45,7 +45,8 @@ class Contrat extends CommonObject public $table_element_line='contratdet'; public $fk_element='fk_contrat'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='contract'; + /** * {@inheritdoc} */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 05fae4f7637..de42ced0997 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3301,7 +3301,7 @@ abstract class CommonObject } // VAT - print ''; + print ''; // Price HT print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f8c81249ed1..ee5bb19bc9a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -78,9 +78,9 @@ class Form * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL* + * @param string $moreparam More param to add on a href URL. * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':' + * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @return string HTML edit field */ function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0) @@ -119,6 +119,7 @@ class Form if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'.$langs->trans('VAT').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''; if ($htmlname && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; if (! empty($notabletag) && $notabletag == 1) $ret.=' : '; + if (! empty($notabletag) && $notabletag == 3) $ret.=' '; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 01c23ce70f6..f330fb92e84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1061,9 +1061,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } - elseif ($object->element == 'facturerec') + elseif ($object->element == 'contrat') { - $morehtmlstatus.=''; + if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); + else $morehtmlstatus.=$object->getLibStatut(4); } else { // Generic case $tmptxt=$object->getLibStatut(6); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 62866e31ea1..c01f16293b6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -107,7 +107,7 @@ if ($nolinesbefore) { -
' . $langs->trans('DateInvoice') . ''; - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); print '
' . $langs->trans('NotePublic') . ''; + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -2485,7 +2521,9 @@ if ($action == 'create') if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . ''; + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e02ec4541ef..8e443e5f556 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -296,6 +296,10 @@ class Facture extends CommonInvoice $this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id; $this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account; + // Set here to have this defined for substitution into notes, should be recalculated after adding lines to get same result + $this->total_ht = $_facrec->total_ht; + $this->total_ttc = $_facrec->total_ttc; + // Fields always coming from template $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; @@ -314,7 +318,7 @@ class Facture extends CommonInvoice $this->brouillon = 1; $this->linked_objects = $_facrec->linkedObjectsIds; - + $forceduedate = $this->calculate_date_lim_reglement(); // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice @@ -327,6 +331,39 @@ class Facture extends CommonInvoice //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. $result = $_facrec->setNextDate($next_date,1); } + + // Define lang of customer + $outputlangs = $langs; + $newlang=''; + + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->thirdparty->default_lang)) $newlang=$this->thirdparty->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->default_lang)) $newlang=$this->default_lang; // for thirdparty + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) + $substitutionarray=array( + '__TOTAL_HT__' => price($this->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code), + '__TOTAL_TTC__' => price($this->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code), + '__INVOICE_PREVIOUS_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m'), + '__INVOICE_MONTH__' => dol_print_date($this->date, '%m'), + '__INVOICE_NEXT_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%m'), + '__INVOICE_PREVIOUS_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%B'), + '__INVOICE_MONTH_TEXT__' => dol_print_date($this->date, '%B'), + '__INVOICE_NEXT_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B'), + '__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'), + '__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'), + '__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'), + ); + + $substitutionisok=true; + complete_substitutions_array($substitutionarray, $outputlangs); + + $this->note_public=make_substitutions($this->note_public,$substitutionarray); + $this->note_private=make_substitutions($this->note_private,$substitutionarray); } // Define due date if not already defined diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fccb1d00106..83d4535660d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -37,6 +37,7 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $langs->load('bills'); $langs->load('compta'); @@ -915,15 +916,53 @@ if ($action == 'create') print '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
'.$langs->trans("NotePublic").''; - print ''; - print '
'.$langs->trans("NotePrivate").''; - print ''; - print '
'; + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print ''; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + + // Private note + if (empty($user->societe_id)) + { + print '
'; + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print ''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ' + print '
".$langs->trans("Author")."".$user->getFullName($langs)."
' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); @@ -970,7 +1009,7 @@ if ($action == 'create') // Frequency print '
'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')).""; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); + print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); print "
'; - - // Ref - /* - print ''; - print ''; - - print ''; - print ''; - */ print '"; @@ -1200,9 +1224,33 @@ else } print ''; + // Help of substitution key + $dateexample=dol_now(); + if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when; + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + // Note public print ''; @@ -1210,39 +1258,11 @@ else // Note private print ''; print ''; - - // Project - /* - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - print ''; - }*/ // Bank Account print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f330fb92e84..082177b5cbc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1216,6 +1216,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false) * "%d %b %Y", * "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M:%S", + * "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat" * @param string $tzoutput true or 'gmt' => string is for Greenwich location * false or 'tzserver' => output string is for local PHP server TZ usage diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index d1648be1d1b..1e4a745621c 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -321,7 +321,7 @@ ListOfNextSituationInvoices=List of next situation invoices FrequencyPer_d=Every %s days FrequencyPer_m=Every %s months FrequencyPer_y=Every %s years -toolTipFrequency=Examples:
Set 7 / day: give a new invoice every 7 days
Set 3 / month: give a new invoice every 3 month +toolTipFrequency=Examples:
Set 7, Day: give a new invoice every 7 days
Set 3, Month: give a new invoice every 3 month NextDateToExecution=Date for next invoice generation DateLastGeneration=Date of latest generation MaxPeriodNumber=Max nb of invoice generation From f3bf5f82f8c7b0100bd4864fb6254d1623ac362b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 11:18:54 +0100 Subject: [PATCH 29/29] FIX Minor fix on stock rounding for float qty before output on screen. --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/product.php | 48 ++++++------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 36599833c2d..1538e47a9d1 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -578,7 +578,7 @@ class Entrepot extends CommonObject */ function getNomUrl($withpicto=0, $option='',$showfullpath=0, $notooltip=0) { - global $langs; + global $conf, $langs; $langs->load("stocks"); if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7a0068fdda8..2cec79d7020 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -613,14 +613,16 @@ if ($id > 0 || $ref) print ''; - print ''; print ''; + $stocktheo = price2num($object->stock_theorique, 'MS'); + // Calculating a theorical value print ''; - print "'; print ''; @@ -703,44 +705,19 @@ if ($id > 0 || $ref) dol_fiche_end(); } - /* - * Correct stock - */ + // Correct stock if ($action == "correction") { include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stockcorrection.tpl.php'; print '

'; } - /* - * Transfer of units - */ + // Transfer of units if ($action == "transfert") { include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stocktransfer.tpl.php'; print '

'; } - - /* - * Set initial stock - */ - /* - if ($_GET["action"] == "definir") - { - print load_fiche_titre($langs->trans("SetStock")); - print "id\" method=\"post\">\n"; - print ''; - print ''; - print '
'; - //print $langs->trans('Ref'); - print $form->editfieldkey($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer); - print ''; - $morehtmlref = $form->editfieldval($langs->trans("Ref"), 'ref', $object->ref, $object, $user->rights->facture->creer, 'string'); - print $form->showrefnav($object, 'ref', $linkback, 1, 'titre', 'none', $morehtmlref); - print '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
'.$langs->trans("Author").''.$author->getFullName($langs)."
'; - print $form->editfieldkey($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext), 'note_public', $object->note_public, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print '
'; - print $form->editfieldkey($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext), 'note_private', $object->note_private, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print '
'; - - print ''; - if ($action != 'classify') { - print ''; - } - print '
'; - print $langs->trans('Project'); - print 'id . '">'; - print img_edit($langs->trans('SetProject'), 1); - print '
'; - - print '
'; - if ($action == 'classify') { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } else { - $form->form_project($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0); - } - print '
'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 2d53eb6abbb..3bb65cd0826 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1693,7 +1693,7 @@ else if ($object->statut > 0) { print '


'; print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); print ''.$object->stock_reel; + print ''.price2num($object->stock_reel, 'MS'); if ($object->seuil_stock_alerte != '' && ($object->stock_reel < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
'.$langs->trans("VirtualStock").'".(empty($object->stock_theorique)?0:$object->stock_theorique); + print "".(empty($stocktheo)?0:$stocktheo); if ($object->seuil_stock_alerte != '' && ($object->stock_theorique < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
'; - print ''; - print ''; - print '
'.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses('','id_entrepot','',1); - print ''.$langs->trans("NumberOfUnit").'
 '; - print '
'; - print ''; - } - */ } else { @@ -831,7 +808,7 @@ if ($resql) $entrepotstatic->id=$obj->rowid; $entrepotstatic->libelle=$obj->label; $entrepotstatic->lieu=$obj->lieu; - $stock_real = round($obj->reel, 10); + $stock_real = price2num($obj->reel, 'MS'); print '
'.$entrepotstatic->getNomUrl(1).''.$stock_real.($stock_real < 0 ?' '.img_warning():'').'
'; - print '
'; + print "\n".''; + print '
'; + print ''; + print ''; print ''; print ''; print ''; - print '
'; $form->select_date($pdluo->eatby,'eatby','','',1,'',1,0,1); @@ -874,7 +853,8 @@ if ($resql) print ''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').''; print '
'; + print '
'; + print ''; print '
'.$langs->trans("Total").':'.$total.''.price2num($total, 'MS').''; print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):' '); // This value may have rounding errors print '