From 938d997e51f8930b73a906a39162d12108dc2a82 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:33:33 +0100 Subject: [PATCH 001/105] NEW Propal list - Add date start & date end --- htdocs/comm/propal/list.php | 153 +++++++++++++++++++----------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index bccc742aa8e..9a2721a51ea 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1,18 +1,19 @@ - * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2004 Eric Seigne - * Copyright (C) 2005 Marc Barilley / Ocebo - * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2010-2011 Juanjo Menent - * Copyright (C) 2010-2011 Philippe Grand - * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2016-2018 Ferran Marcet - * Copyright (C) 2017-2018 Charlene Benke - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (C) 2001-2007 Rodolphe Quiedeville + * Copyright (C) 2004-2016 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005 Marc Barilley / Ocebo + * Copyright (C) 2005-2013 Regis Houssin + * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2011 Philippe Grand + * Copyright (C) 2012 Christophe Battarel + * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2016-2018 Ferran Marcet + * Copyright (C) 2017-2018 Charlene Benke + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2019 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,15 +76,12 @@ $search_zip=GETPOST('search_zip', 'alpha'); $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); -$search_day=GETPOST("search_day", "int"); -$search_month=GETPOST("search_month", "int"); -$search_year=GETPOST("search_year", "int"); -$search_dayfin=GETPOST("search_dayfin", "int"); -$search_month_end=GETPOST("search_month_end", "int"); -$search_yearfin=GETPOST("search_yearfin", "int"); -$search_daydelivery=GETPOST("search_daydelivery", "int"); -$search_monthdelivery=GETPOST("search_monthdelivery", "int"); -$search_yeardelivery=GETPOST("search_yeardelivery", "int"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_dateend_start = dol_mktime(0, 0, 0, GETPOST('search_dateend_startmonth', 'int'), GETPOST('search_dateend_startday', 'int'), GETPOST('search_dateend_startyear', 'int')); +$search_dateend_end = dol_mktime(23, 59, 59, GETPOST('search_dateend_endmonth', 'int'), GETPOST('search_dateend_endday', 'int'), GETPOST('search_dateend_endyear', 'int')); +$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_availability=GETPOST('search_availability', 'int'); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); @@ -219,15 +217,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_year=''; - $search_month=''; - $search_day=''; - $search_yearfin=''; - $search_month_end=''; - $search_dayfin=''; - $search_yeardelivery=''; - $search_monthdelivery=''; - $search_daydelivery=''; + $search_date_start=''; + $search_date_end=''; + $search_dateend_start=''; + $search_dateend_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_availability=''; $viewstatut=''; $object_statut=''; @@ -313,38 +308,41 @@ if (! $user->rights->societe->client->voir && ! $socid) //restriction { $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; } -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_ref) $sql .= natural_search('p.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); -if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); -if ($search_project) $sql .= natural_search('pr.title', $search_project); -if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('p.ref_client', $search_refcustomer); +if ($search_refproject) $sql .= natural_search('pr.ref', $search_refproject); +if ($search_project) $sql .= natural_search('pr.title', $search_project); +if ($search_availability) $sql .= " AND p.fk_availability IN (".$db->escape($search_availability).')'; -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_login) $sql .= natural_search("u.login", $search_login); -if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); -if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_login) $sql .= natural_search("u.login", $search_login); +if ($search_montant_ht != '') $sql.= natural_search("p.total_ht", $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search("p.tva", $search_montant_vat, 1); +if ($search_montant_ttc != '') $sql.= natural_search("p.total", $search_montant_ttc, 1); if ($sall) { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); -if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; +if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$db->escape($search_product_category); +if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; } -$sql.= dolSqlDateFilter("p.datep", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("p.fin_validite", $search_dayfin, $search_month_end, $search_yearfin); -$sql.= dolSqlDateFilter("p.date_livraison", $search_daydelivery, $search_monthdelivery, $search_yeardelivery); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); +if ($search_date_start) $sql.= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_dateend_start) $sql.= " AND p.fin_validite >= '" . $db->idate($search_dateend_start) . "'"; +if ($search_dateend_end) $sql.= " AND p.fin_validite <= '" . $db->idate($search_dateend_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND p.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND p.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$db->escape($search_sale); if ($search_user > 0) { $sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$db->escape($search_user); @@ -594,34 +592,43 @@ if ($resql) // Date if (! empty($arrayfields['p.date']['checked'])) { - print ''; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_year, 'search_year', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } // Date end if (! empty($arrayfields['p.fin_validite']['checked'])) { - print ''; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yearfin, 'search_yearfin', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateend_start?$search_dateend_start:-1, 'search_dateend_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateend_end?$search_dateend_end:-1, 'search_dateend_end', 0, 0, 1); + print '
'; print ''; } // Date delivery if (! empty($arrayfields['p.date_livraison']['checked'])) { - print ''; - //print $langs->trans('Month').': '; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - //print ' '.$langs->trans('Year').': '; - $formother->select_year($search_yeardelivery, 'search_yeardelivery', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print ''; } // Availability From e60b7a67fa61bea4591920739c16571f2f542555 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 06:35:58 +0100 Subject: [PATCH 002/105] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 108 ++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 75945106b72..2d06fa1f557 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -13,6 +13,7 @@ * Copyright (C) 2015-2016 Ferran Marcet * Copyright (C) 2017 Josep Lluís Amador * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2019 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,12 +99,10 @@ $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); -$search_day = GETPOST('search_day', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_year = GETPOST('search_year', 'int'); -$search_day_lim = GETPOST('search_day_lim', 'int'); -$search_month_lim = GETPOST('search_month_lim', 'int'); -$search_year_lim = GETPOST('search_year_lim', 'int'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); +$search_datelimit_start = dol_mktime(0, 0, 0, GETPOST('search_datelimit_startmonth', 'int'), GETPOST('search_datelimit_startday', 'int'), GETPOST('search_datelimit_startyear', 'int')); +$search_datelimit_end = dol_mktime(23, 59, 59, GETPOST('search_datelimit_endmonth', 'int'), GETPOST('search_datelimit_endday', 'int'), GETPOST('search_datelimit_endyear', 'int')); $search_categ_cus=trim(GETPOST("search_categ_cus", 'int')); $search_btn=GETPOST('button_search', 'alpha'); $search_remove_btn=GETPOST('button_removefilter', 'alpha'); @@ -248,14 +247,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_type=''; $search_country=''; $search_type_thirdparty=''; - $search_day=''; - $search_year=''; - $search_month=''; + $search_date_start=''; + $search_date_end=''; + $search_datelimit_start=''; + $search_datelimit_end=''; $option=''; $filter=''; - $search_day_lim=''; - $search_year_lim=''; - $search_month_lim=''; $toselect=''; $search_array_options=array(); $search_categ_cus=0; @@ -445,47 +442,49 @@ if ($filtre) $sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1])); } } -if ($search_ref) $sql .= natural_search('f.ref', $search_ref); -if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); +if ($search_ref) $sql .= natural_search('f.ref', $search_ref); +if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")"; -if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); -if ($search_project) $sql .= natural_search('p.title', $search_project); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); -if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); +if ($search_project_ref) $sql .= natural_search('p.ref', $search_project_ref); +if ($search_project) $sql .= natural_search('p.title', $search_project); +if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); +if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_localtax1 != '') $sql.= natural_search('f.localtax1', $search_montant_localtax1, 1); if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $search_montant_localtax2, 1); -if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; if ($search_status != '-1' && $search_status != '') { if (is_numeric($search_status) && $search_status >= 0) { - if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft - if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed - if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) - if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned } else { $sql.= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } -if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); -if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); -if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); -if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); -$sql.= dolSqlDateFilter("f.datef", $search_day, $search_month, $search_year); -$sql.= dolSqlDateFilter("f.date_lim_reglement", $search_day_lim, $search_month_lim, $search_year_lim); -if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; +if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); +if ($search_paymentterms > 0) $sql .= " AND f.fk_cond_reglement = ".$db->escape($search_paymentterms); +if ($search_module_source) $sql .= natural_search("f.module_source", $search_module_source); +if ($search_pos_source) $sql .= natural_search("f.pos_source", $search_pos_source); +if ($search_date_start) $sql.= " AND f.datef >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; +if ($search_datelimit_start) $sql.= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'"; +if ($search_datelimit_end) $sql.= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'"; +if ($option == 'late') $sql.=" AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->client->warning_delay)."'"; +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .(int) $search_sale; if ($search_user > 0) { $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='facture' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user; @@ -752,20 +751,29 @@ if ($resql) // Date invoice if (! empty($arrayfields['f.date']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year?$search_year:-1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } // Date due if (! empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_year_lim?$search_year_lim:-1, 'search_year_lim', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); - print '
'.$langs->trans("Alert"); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datelimit_start?$search_datelimit_start:-1, 'search_datelimit_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datelimit_end?$search_datelimit_end:-1, 'search_datelimit_end', 0, 0, 1); + print '
'; print ''; } // Project ref @@ -778,7 +786,7 @@ if ($resql) { print ''; } - // Thirpdarty + // Thirdparty if (! empty($arrayfields['s.nom']['checked'])) { print ''; From 5cf111120431d22f10a57b755c7bddc671171185 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 08:44:09 +0100 Subject: [PATCH 003/105] NEW Salaries list - Add date start & date end --- htdocs/salaries/list.php | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index 51fd8462180..ec859678911 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -40,6 +40,8 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount = GETPOST('search_amount', 'alpha'); $search_account = GETPOST('search_account', 'int'); @@ -80,7 +82,10 @@ else if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers { $search_ref=""; + $search_user=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount=""; $search_account=''; $typeid=""; @@ -111,11 +116,13 @@ $sql.= " WHERE u.rowid = s.fk_user"; $sql.= " AND s.entity = ".$conf->entity; // Search criteria -if ($search_ref) $sql.=" AND s.rowid=".$search_ref; -if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); -if ($search_label) $sql.=natural_search(array('s.label'), $search_label); -if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); -if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; +if ($search_ref) $sql.=" AND s.rowid=".$search_ref; +if ($search_user) $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname', 'u.email'), $search_user); +if ($search_label) $sql.=natural_search(array('s.label'), $search_label); +if ($search_date_start) $sql.= " AND s.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND s.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1); +if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -171,7 +178,7 @@ if ($result) print ''; // Ref - print ''; + print ''; print ''; print ''; // Employee @@ -181,9 +188,18 @@ if ($result) // Label print ''; // Date - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; + print ''; // Type - print ''; + print ''; $form->select_types_paiements($typeid, 'typeid', '', 0, 1, 1, 16); print ''; // Account @@ -239,7 +255,7 @@ if ($result) // Label payment print "".dol_trunc($obj->label, 40)."\n"; // Date payment - print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; + print ''.dol_print_date($db->jdate($obj->datep), 'day')."\n"; // Type print ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; // Account @@ -269,7 +285,7 @@ if ($result) print ''; } // Amount - print ''.price($obj->amount).''; + print ''.price($obj->amount).''; print ''; print "\n"; @@ -281,7 +297,7 @@ if ($result) $colspan=5; if (! empty($conf->banque->enabled)) $colspan++; print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; From b85dc0c5e5556618c0c3a328dc20fc32d3fbabfb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 09:19:48 +0100 Subject: [PATCH 004/105] NEW Various payment list - Add search date start & date end & subledger_account --- htdocs/compta/bank/various_payment/list.php | 96 +++++++++++++-------- 1 file changed, 62 insertions(+), 34 deletions(-) diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index d73d6d8a391..205df51d6a6 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2019 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * @@ -44,11 +44,15 @@ $limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit; $search_ref = GETPOST('search_ref', 'int'); $search_user = GETPOST('search_user', 'alpha'); $search_label = GETPOST('search_label', 'alpha'); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_amount_deb = GETPOST('search_amount_deb', 'alpha'); $search_amount_cred = GETPOST('search_amount_cred', 'alpha'); $search_account = GETPOST('search_account', 'int'); -$search_date = dol_mktime(0, 0, 0, GETPOST('date_docmonth', 'int'), GETPOST('date_docday', 'int'), GETPOST('date_docyear', 'int')); -$search_accountancy_code = GETPOST("search_accountancy_code"); +$search_accountancy_account = GETPOST("search_accountancy_account"); +if ($search_accountancy_account == - 1) $search_accountancy_account = ''; +$search_accountancy_subledger = GETPOST("search_accountancy_subledger"); +if ($search_accountancy_subledger == - 1) $search_accountancy_subledger = ''; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -81,12 +85,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' { $search_ref=""; $search_label=""; + $search_date_start=''; + $search_date_end=''; $search_amount_deb=""; $search_amount_cred=""; $search_account=''; + $search_accountancy_account = ''; + $search_accountancy_subledger = ''; $typeid=""; - $search_date = ''; - $search_accountancy_code = ''; } /* @@ -100,7 +106,7 @@ $formaccounting = new FormAccounting($db); $variousstatic = new PaymentVarious($db); $accountstatic = new Account($db); -$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code,"; +$sql = "SELECT v.rowid, v.sens, v.amount, v.label, v.datep as datep, v.datev as datev, v.fk_typepayment as type, v.num_payment, v.fk_bank, v.accountancy_code, v.subledger_account,"; $sql.= " ba.rowid as bid, ba.ref as bref, ba.number as bnumber, ba.account_number as bank_account_number, ba.fk_accountancy_journal as accountancy_journal, ba.label as blabel,"; $sql.= " pst.code as payment_code"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; @@ -110,14 +116,16 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$db->escape($search_ref); -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); -if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$db->escape($search_account); -if ($search_date) $sql.=" AND v.datep = '".$db->idate($search_date)."'"; -if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$db->escape($search_accountancy_code); -if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; +if ($search_ref) $sql.= " AND v.rowid=".$db->escape($search_ref); +if ($search_label) $sql.= natural_search(array('v.label'), $search_label); +if ($search_date_start) $sql.= " AND v.datep >= '" . $db->idate($search_date_start) . "'"; +if ($search_date_end) $sql.= " AND v.datep <= '" . $db->idate($search_date_end) . "'"; +if ($search_amount_deb) $sql.= natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.= natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql.= " AND b.fk_account=".$db->escape($search_account); +if ($search_accountancy_account > 0) $sql.= " AND v.accountancy_code=".$db->escape($search_accountancy_account); +if ($search_accountancy_subledger > 0) $sql.= " AND v.subledger_account=".$db->escape($search_accountancy_subledger); +if ($typeid > 0) $sql.= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":", "=", $filtre); $sql .= " AND ".$filtre; @@ -143,14 +151,16 @@ if ($result) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_label) $param.='&search_label='.urlencode($search_label); - if ($typeid > 0) $param.='&typeid='.urlencode($typeid); - if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); - if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); - if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); - //if ($search_date) $param.='&search_date='.$search_date; - if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($search_date_start) $param.='&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end='.urlencode($search_date_end); + if ($typeid > 0) $param.='&typeid='.urlencode($typeid); + if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); + if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); + if ($search_accountancy_account > 0) $param.='&search_accountancy_account='.urlencode($search_accountancy_account); + if ($search_accountancy_subledger > 0) $param.='&search_accountancy_subledger='.urlencode($search_accountancy_subledger); if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); @@ -190,7 +200,13 @@ if ($result) // Date print ''; print '
'; - print $form->selectDate($search_date, 'date_doc', 0, 0, 1); + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; @@ -207,12 +223,20 @@ if ($result) print ''; } - // Accounting account + if (! empty($conf->accounting->enabled)) { + // Accounting account print ''; print '
'; - print $formaccounting->select_account($search_accountancy_code, 'search_accountancy_code', 1, array (), 1, 1, 'maxwidth200'); + print $formaccounting->select_account($search_accountancy_account, 'search_accountancy_account', 1, array (), 1, 1, 'maxwidth200'); + print '
'; + print ''; + + // Subledger account + print ''; + print '
'; + print $formaccounting->select_auxaccount($search_accountancy_subledger, 'search_accountancy_subledger', 1, array (), 1, 1, 'maxwidth200'); print '
'; print ''; } @@ -237,7 +261,8 @@ if ($result) print_liste_field_titre("DatePayment", $_SERVER["PHP_SELF"], "v.datep,v.rowid", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("PaymentMode", $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'left '); if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount", $_SERVER["PHP_SELF"], "ba.label", "", $param, "", $sortfield, $sortorder); - if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccountingShort", $_SERVER["PHP_SELF"], "v.accountancy_code", "", $param, '', $sortfield, $sortorder, 'left '); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("SubledgerAccount", $_SERVER["PHP_SELF"], "v.subledger_account", "", $param, '', $sortfield, $sortorder, 'left '); print_liste_field_titre("Debit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre("Credit", $_SERVER["PHP_SELF"], "v.amount", "", $param, '', $sortfield, $sortorder, 'right '); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); @@ -305,8 +330,15 @@ if ($result) if (! $i) $totalarray['nbfield']++; } + // Accounting subledger account + if (! empty($conf->accounting->enabled)) + { + print '' . length_accounta($obj->subledger_account) . ''; + if (! $i) $totalarray['nbfield']++; + } + // Debit - print ""; + print ''; if ($obj->sens == 0) { print price($obj->amount); @@ -314,10 +346,10 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_deb'; - print ""; + print ''; // Credit - print ""; + print ''; if ($obj->sens == 1) { print price($obj->amount); @@ -325,17 +357,13 @@ if ($result) } if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='total_cred'; - print ""; + print ''; print ""; $i++; } - $colspan=4; - if (! empty($conf->banque->enabled)) $colspan++; - if (! empty($conf->accounting->enabled)) $colspan++; - // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; From 9ff10d430b643772d239b9889a113e3e17273483 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 13:57:04 +0100 Subject: [PATCH 005/105] NEW Customer command list - Add date start & date end --- htdocs/commande/list.php | 136 ++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 65 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index dadc25737b6..a66731885a8 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -56,12 +56,10 @@ $confirm=GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'orderlist'; -$search_orderyear=GETPOST("search_orderyear", "int"); -$search_ordermonth=GETPOST("search_ordermonth", "int"); -$search_orderday=GETPOST("search_orderday", "int"); -$search_deliveryyear=GETPOST("search_deliveryyear", "int"); -$search_deliverymonth=GETPOST("search_deliverymonth", "int"); -$search_deliveryday=GETPOST("search_deliveryday", "int"); +$search_dateorder_start= dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int')); +$search_dateorder_end= dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int')); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); $search_product_category=GETPOST('search_product_category', 'int'); $search_ref=GETPOST('search_ref', 'alpha')!=''?GETPOST('search_ref', 'alpha'):GETPOST('sref', 'alpha'); $search_ref_customer=GETPOST('search_ref_customer', 'alpha'); @@ -197,12 +195,10 @@ if (empty($reshook)) $search_total_ht=''; $search_total_vat=''; $search_total_ttc=''; - $search_orderyear=''; - $search_ordermonth=''; - $search_orderday=''; - $search_deliveryday=''; - $search_deliverymonth=''; - $search_deliveryyear=''; + $search_dateorder_start=''; + $search_dateorder_end=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; $search_project_ref=''; $search_project=''; $viewstatut=''; @@ -311,22 +307,24 @@ if ($viewstatut <> '') $sql .= ' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))'; // validated, in process or closed but not billed } } -$sql.= dolSqlDateFilter("c.date_commande", $search_orderday, $search_ordermonth, $search_orderyear); -$sql.= dolSqlDateFilter("c.date_livraison", $search_deliveryday, $search_deliverymonth, $search_deliveryyear); -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; -if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; -if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); -if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); -if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); -if ($search_project != '') $sql.= natural_search("p.title", $search_project); -if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); -if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_dateorder_start) $sql.= " AND c.date_commande >= '" . $db->idate($search_dateorder_start) . "'"; +if ($search_dateorder_end) $sql.= " AND c.date_commande <= '" . $db->idate($search_dateorder_end) . "'"; +if ($search_datedelivery_start) $sql.= " AND c.date_livraison >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND c.date_livraison <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_company) $sql .= natural_search('s.nom', $search_company); +if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; +if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user; +if ($search_total_ht != '') $sql.= natural_search('c.total_ht', $search_total_ht, 1); +if ($search_total_ttc != '') $sql.= natural_search('c.total_ttc', $search_total_ttc, 1); +if ($search_project_ref != '') $sql.= natural_search("p.ref", $search_project_ref); +if ($search_project != '') $sql.= natural_search("p.title", $search_project); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks @@ -402,34 +400,32 @@ if ($resql) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($socid > 0) $param.='&socid='.urlencode($socid); - if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); - if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); - if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); - if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); - if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); - if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); - if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_company) $param.='&search_company='.urlencode($search_company); - if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); - if ($search_user > 0) $param.='&search_user='.urlencode($search_user); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); - if ($search_town != '') $param.='&search_town='.urlencode($search_town); - if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); - if ($search_state != '') $param.='&search_state='.urlencode($search_state); - if ($search_country != '') $param.='&search_country='.urlencode($search_country); + if ($sall) $param.='&sall='.urlencode($sall); + if ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_dateorder_start) $param.='&search_dateorder_start=' . urlencode($search_dateorder_start); + if ($search_dateorder_end) $param.='&search_dateorder_end=' . urlencode($search_dateorder_end); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($search_town != '') $param.='&search_town='.urlencode($search_town); + if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip); + if ($search_state != '') $param.='&search_state='.urlencode($search_state); + if ($search_country != '') $param.='&search_country='.urlencode($search_country); if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); if ($search_product_category != '') $param.='&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); - if ($show_files) $param.='&show_files=' .urlencode($show_files); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($billed != '') $param.='&billed='.urlencode($billed); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -646,18 +642,28 @@ if ($resql) // Date order if (! empty($arrayfields['c.date_commande']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_orderyear?$search_orderyear:-1, 'search_orderyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_dateorder_start?$search_dateorder_start:-1, 'search_dateorder_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_dateorder_end?$search_dateorder_end:-1, 'search_dateorder_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.date_delivery']['checked'])) { - print ''; - if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; - $formother->select_year($search_deliveryyear?$search_deliveryyear:-1, 'search_deliveryyear', 1, 20, 5); + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_datedelivery_start?$search_datedelivery_start:-1, 'search_datedelivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_datedelivery_end?$search_datedelivery_end:-1, 'search_datedelivery_end', 0, 0, 1); + print '
'; print ''; } if (! empty($arrayfields['c.total_ht']['checked'])) @@ -1044,7 +1050,7 @@ if ($resql) print ''; if (! $i) $totalarray['nbfield']++; } - // Plannned date of delivery + // Planned date of delivery if (! empty($arrayfields['c.date_delivery']['checked'])) { print ''; @@ -1055,7 +1061,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['c.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ht'; $totalarray['val']['c.total_ht'] += $obj->total_ht; @@ -1063,7 +1069,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; + print ''.price($obj->total_tva)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_tva'; $totalarray['val']['c.total_tva'] += $obj->total_tva; @@ -1071,7 +1077,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['pos'][$totalarray['nbfield']]='c.total_ttc'; $totalarray['val']['c.total_ttc'] += $obj->total_ttc; From 55e3d7b89983f7af3b37da096793434ee0f77d41 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 7 Nov 2019 14:21:11 +0100 Subject: [PATCH 006/105] NEW Expedition list - Add date start & date end --- htdocs/expedition/list.php | 77 +++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 21 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index eeb05e8926c..961afb0191d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -59,6 +59,10 @@ $search_state=trim(GETPOST("search_state")); $search_country=GETPOST("search_country", 'int'); $search_type_thirdparty=GETPOST("search_type_thirdparty", 'int'); $search_billed=GETPOST("search_billed", 'int'); +$search_datedelivery_start= dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); +$search_datedelivery_end= dol_mktime(23, 59, 59, GETPOST('search_datedelivery_endmonth', 'int'), GETPOST('search_datedelivery_endday', 'int'), GETPOST('search_datedelivery_endyear', 'int')); +$search_datereceipt_start= dol_mktime(0, 0, 0, GETPOST('search_datereceipt_startmonth', 'int'), GETPOST('search_datereceipt_startday', 'int'), GETPOST('search_datereceipt_startyear', 'int')); +$search_datereceipt_end= dol_mktime(23, 59, 59, GETPOST('search_datereceipt_endmonth', 'int'), GETPOST('search_datereceipt_endday', 'int'), GETPOST('search_datereceipt_endyear', 'int')); $sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); $optioncss = GETPOST('optioncss', 'alpha'); @@ -156,6 +160,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_country=''; $search_type_thirdparty=''; $search_billed=''; + $search_datedelivery_start=''; + $search_datedelivery_end=''; + $search_datereceipt_start=''; + $search_datereceipt_end=''; $viewstatut=''; $toselect = ''; $search_array_options=array(); @@ -224,17 +232,22 @@ if ($socid) if ($viewstatut <> '' && $viewstatut >= 0) { $sql.= " AND e.fk_statut = ".$viewstatut; } -if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); +if ($search_ref_customer != '') $sql.=natural_search('e.ref_customer', $search_ref_customer); if ($search_billed != '' && $search_billed >= 0) $sql.=' AND e.billed = '.$search_billed; -if ($search_town) $sql.= natural_search('s.town', $search_town); -if ($search_zip) $sql.= natural_search("s.zip", $search_zip); -if ($search_state) $sql.= natural_search("state.nom", $search_state); -if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; -if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; -if ($search_ref_exp) $sql .= natural_search('e.ref', $search_ref_exp); -if ($search_ref_liv) $sql .= natural_search('l.ref', $search_ref_liv); -if ($search_company) $sql .= natural_search('s.nom', $search_company); -if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +if ($search_town) $sql.= natural_search('s.town', $search_town); +if ($search_zip) $sql.= natural_search("s.zip", $search_zip); +if ($search_state) $sql.= natural_search("state.nom", $search_state); +if ($search_country) $sql.= " AND s.fk_pays IN (".$search_country.')'; +if ($search_type_thirdparty) $sql.= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_ref_exp) $sql.= natural_search('e.ref', $search_ref_exp); +if ($search_ref_liv) $sql.= natural_search('l.ref', $search_ref_liv); +if ($search_company) $sql.= natural_search('s.nom', $search_company); +if ($search_datedelivery_start) $sql.= " AND e.date_delivery >= '" . $db->idate($search_datedelivery_start) . "'"; +if ($search_datedelivery_end) $sql.= " AND e.date_delivery <= '" . $db->idate($search_datedelivery_end) . "'"; +if ($search_datereceipt_start) $sql.= " AND l.date_delivery >= '" . $db->idate($search_datereceipt_start) . "'"; +if ($search_datereceipt_end) $sql.= " AND l.date_delivery <= '" . $db->idate($search_datereceipt_end) . "'"; + +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; @@ -273,15 +286,19 @@ if ($resql) $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.= "&sall=".urlencode($sall); - if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); - if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); - if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); - if ($search_company) $param.= "&search_company=".urlencode($search_company); - if ($search_town) $param.= '&search_town='.urlencode($search_town); - if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); - if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($sall) $param.= "&sall=".urlencode($sall); + if ($search_ref_exp) $param.= "&search_ref_exp=".urlencode($search_ref_exp); + if ($search_ref_liv) $param.= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_ref_customer) $param.= "&search_ref_customer=".urlencode($search_ref_customer); + if ($search_company) $param.= "&search_company=".urlencode($search_company); + if ($search_town) $param.= '&search_town='.urlencode($search_town); + if ($search_zip) $param.= '&search_zip='.urlencode($search_zip); + if ($search_datedelivery_start) $param.='&search_datedelivery_start=' . urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param.='&search_datedelivery_end=' . urlencode($search_datedelivery_end); + if ($search_datereceipt_start) $param.='&search_datereceipt_start=' . urlencode($search_datereceipt_start); + if ($search_datereceipt_end) $param.='&search_datereceipt_end=' . urlencode($search_datereceipt_end); + if ($viewstatut != '') $param.= '&viewstatut='.urlencode($viewstatut); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -391,7 +408,16 @@ if ($resql) // Date delivery planned if (! empty($arrayfields['e.date_delivery']['checked'])) { - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_delivery_start?$search_delivery_start:-1, 'search_delivery_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_delivery_end?$search_delivery_end:-1, 'search_delivery_end', 0, 0, 1); + print '
'; + print ''; } if (! empty($arrayfields['l.ref']['checked'])) { @@ -403,7 +429,16 @@ if ($resql) if (! empty($arrayfields['l.date_delivery']['checked'])) { // Date received - print ' '; + print ''; + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_receipt_start?$search_receipt_start:-1, 'search_receipt_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_receipt_end?$search_receipt_end:-1, 'search_receipt_end', 0, 0, 1); + print '
'; + print ''; } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; From 86b90b115fec5c0171c95accc1ca40926213217d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 9 Nov 2019 05:20:13 +0100 Subject: [PATCH 007/105] NEW Invoice list - Add date start & date end --- htdocs/compta/facture/list.php | 56 ++++++++++++++++------------------ 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 2d06fa1f557..8440b514f24 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -569,38 +569,36 @@ if ($resql) $param='&socid='.$socid; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($search_day) $param.='&search_day='.urlencode($search_day); - if ($search_month) $param.='&search_month='.urlencode($search_month); - if ($search_year) $param.='&search_year=' .urlencode($search_year); - if ($search_day_lim) $param.='&search_day_lim='.urlencode($search_day_lim); - if ($search_month_lim) $param.='&search_month_lim='.urlencode($search_month_lim); - if ($search_year_lim) $param.='&search_year_lim=' .urlencode($search_year_lim); - if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); - if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); - if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); - if ($search_project) $param.='&search_project='.urlencode($search_project); - if ($search_type != '') $param.='&search_type='.urlencode($search_type); - if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); - if ($search_town) $param.='&search_town='.urlencode($search_town); - if ($search_zip) $param.='&search_zip='.urlencode($search_zip); - if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); - if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); + if ($sall) $param.='&sall='.urlencode($sall); + if ($search_date_start) $param.='&search_date_start=' . urlencode($search_date_start); + if ($search_date_end) $param.='&search_date_end=' . urlencode($search_date_end); + if ($search_datelimit_start) $param.='&search_datelimit_start=' . urlencode($search_datelimit_start); + if ($search_datelimit_end) $param.='&search_datelimit_end=' . urlencode($search_datelimit_end); + if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); + if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); + if ($search_project_ref) $param.='&search_project_ref='.urlencode($search_project_ref); + if ($search_project) $param.='&search_project='.urlencode($search_project); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); + if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); + if ($search_town) $param.='&search_town='.urlencode($search_town); + if ($search_zip) $param.='&search_zip='.urlencode($search_zip); + if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); + if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_product_category > 0) $param.='&search_product_category=' .urlencode($search_product_category); - if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); - if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); + if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); + if ($search_montant_vat != '') $param.='&search_montant_vat='.urlencode($search_montant_vat); if ($search_montant_localtax1 != '') $param.='&search_montant_localtax1='.urlencode($search_montant_localtax1); if ($search_montant_localtax2 != '') $param.='&search_montant_localtax2='.urlencode($search_montant_localtax2); - if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); - if ($search_status != '') $param.='&search_status='.urlencode($search_status); - if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); - if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); - if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); - if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); - if ($show_files) $param.='&show_files='.urlencode($show_files); - if ($option) $param.="&search_option=".urlencode($option); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); + if ($search_montant_ttc != '') $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_paymentmode > 0) $param.='&search_paymentmode='.urlencode($search_paymentmode); + if ($search_paymentterms > 0) $param.='&search_paymentterms='.urlencode($search_paymentterms); + if ($search_module_source) $param.='&search_module_source='.urlencode($search_module_source); + if ($search_pos_source) $param.='&search_pos_source='.urlencode($search_pos_source); + if ($show_files) $param.='&show_files='.urlencode($show_files); + if ($option) $param.="&search_option=".urlencode($option); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; From 812c0327547d08bd9309876d8d4a7f973cac0e18 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 12 Nov 2019 15:56:11 +0100 Subject: [PATCH 008/105] NEW French new regions --- .../install/mysql/data/llx_10_c_regions.sql | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index be485ddb6b1..bbb7af35bb7 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -45,25 +45,16 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 6,'97601',3,'Mayotte'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 11,'75056',1,'Île-de-France'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 21,'51108',0,'Champagne-Ardenne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 22,'80021',0,'Picardie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 23,'76540',0,'Haute-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 25,'14118',0,'Basse-Normandie'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 26,'21231',0,'Bourgogne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 31,'59350',2,'Nord-Pas-de-Calais'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 41,'57463',0,'Lorraine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 42,'67482',1,'Alsace'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 43,'25056',0,'Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 24,'45234',2,'Centre-Val de Loire'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 27,'21231',0,'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 28,'76540',0,'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 32,'59350',4,'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 44,'67482',2,'Grand Est'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 52,'44109',4,'Pays de la Loire'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 53,'35238',0,'Bretagne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 54,'86194',2,'Poitou-Charentes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 72,'33063',1,'Aquitaine'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 73,'31555',0,'Midi-Pyrénées'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 74,'87085',2,'Limousin'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 82,'69123',2,'Rhône-Alpes'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 83,'63113',1,'Auvergne'); -insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 91,'34172',2,'Languedoc-Roussillon'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 75,'33063',0,'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 76,'31355',1,'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 84,'69123',1,'Auvergne-Rhône-Alpes'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 93,'13055',0,'Provence-Alpes-Côte d''Azur'); insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values ( 1, 94,'2A004',0,'Corse'); From 05ab4f79efe7a672d558066703fd4d8fe585e254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 18:44:11 +0100 Subject: [PATCH 009/105] categories for actioncomm --- htdocs/categories/class/categorie.class.php | 8 + htdocs/categories/index.php | 8 +- htdocs/core/modules/modAgenda.class.php | 327 ++++++++++-------- .../install/mysql/migration/10.0.0-11.0.0.sql | 14 + htdocs/langs/en_US/categories.lang | 3 +- 5 files changed, 215 insertions(+), 145 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index f184f1b433f..e42f0fe32ff 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -54,6 +54,7 @@ class Categorie extends CommonObject const TYPE_ACCOUNT = 'bank_account'; const TYPE_BANK_LINE = 'bank_line'; const TYPE_WAREHOUSE = 'warehouse'; + const TYPE_ACTIONCOMM = 'actioncomm'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -77,6 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, + 'actioncomm' => 9, ); /** @@ -93,6 +95,7 @@ class Categorie extends CommonObject 7 => 'user', 8 => 'bank_line', 9 => 'warehouse', + 10 => 'actioncomm', ); /** @@ -111,6 +114,7 @@ class Categorie extends CommonObject 'bank_account' => 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'actioncomm', ); /** @@ -129,6 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', + 'actioncomm' => 'warehouse', ); /** @@ -147,6 +152,7 @@ class Categorie extends CommonObject 'bank_account' => 'Account', 'project' => 'Project', 'warehouse'=> 'Entrepot', + 'actioncomm' => 'ActionComm', ); /** @@ -164,6 +170,7 @@ class Categorie extends CommonObject 'account' => 'bank_account', 'project' => 'projet', 'warehouse'=> 'entrepot', + 'actioncomm' => 'actioncomm', ); /** @@ -214,6 +221,7 @@ class Categorie extends CommonObject * @see Categorie::TYPE_PROJECT * @see Categorie::TYPE_BANK_LINE * @see Categorie::TYPE_WAREHOUSE + * @see Categorie::TYPE_ACTIONCOMM */ public $type; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e0886da002c..59d3cef3a4d 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -59,7 +59,13 @@ elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCate elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; } elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; } elseif ($type == Categorie::TYPE_WAREHOUSE) { $title=$langs->trans("StocksCategoriesArea"); $typetext='warehouse'; } -else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; } +elseif ($type == Categorie::TYPE_ACTIONCOMM) { + $title = $langs->trans("ActionCommCategoriesArea"); + $typetext = 'actioncomm'; +} else { + $title = $langs->trans("CategoriesArea"); + $typetext = 'unknown'; +} $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 13e47abbc74..7d2b00a17d1 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -219,165 +219,206 @@ class modAgenda extends DolibarrModules ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=0', - 'type'=>'left', - 'titre'=>'Actions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>100, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=0', + 'type'=>'left', + 'titre'=>'Actions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>100, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2, + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'NewAction', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', - 'langs'=>'commercial', - 'position'=>101, - 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'NewAction', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create', + 'langs'=>'commercial', + 'position'=>101, + 'perms'=>'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; // Calendar - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Calendar', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>140, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Calendar', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>140, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>141, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>141, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>142, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>142, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>143, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>143, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=3', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>144, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=3', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>144, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); // List $r++; - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'List', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>110, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'List', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>110, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', - 'langs'=>'agenda', - 'position'=>111, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine', + 'langs'=>'agenda', + 'position'=>111, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneMyActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', - 'langs'=>'agenda', - 'position'=>112, - 'perms'=>'$user->rights->agenda->myactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneMyActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine', + 'langs'=>'agenda', + 'position'=>112, + 'perms'=>'$user->rights->agenda->myactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuToDoActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', - 'langs'=>'agenda', - 'position'=>113, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuToDoActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1', + 'langs'=>'agenda', + 'position'=>113, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; - $this->menu[$r]=array('fk_menu'=>'r=8', - 'type'=>'left', - 'titre'=>'MenuDoneActions', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', - 'langs'=>'agenda', - 'position'=>114, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$user->rights->agenda->allactions->read', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=8', + 'type'=>'left', + 'titre'=>'MenuDoneActions', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1', + 'langs'=>'agenda', + 'position'=>114, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$user->rights->agenda->allactions->read', + 'target'=>'', + 'user'=>2 + ); $r++; // Reports - $this->menu[$r]=array('fk_menu'=>'r=1', - 'type'=>'left', - 'titre'=>'Reportings', - 'mainmenu'=>'agenda', - 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', - 'langs'=>'agenda', - 'position'=>160, - 'perms'=>'$user->rights->agenda->allactions->read', - 'enabled'=>'$conf->agenda->enabled', - 'target'=>'', - 'user'=>2); + $this->menu[$r]=array( + 'fk_menu'=>'r=1', + 'type'=>'left', + 'titre'=>'Reportings', + 'mainmenu'=>'agenda', + 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda', + 'langs'=>'agenda', + 'position'=>160, + 'perms'=>'$user->rights->agenda->allactions->read', + 'enabled'=>'$conf->agenda->enabled', + 'target'=>'', + 'user'=>2 + ); + $r++; + // Categories + $this->menu[$r]=array( + 'fk_menu' => 'r=1', + 'type' => 'left', + 'titre' => 'Categories', + 'mainmenu' => 'agenda', + 'url'=>'/categories/index.php?mainmenu=agenda&leftmenu=agenda&type=10', + 'langs' => 'agenda', + 'position' => 170, + 'perms' => '$user->rights->agenda->allactions->read', + 'enabled' => '$conf->categorie->enabled&&$conf->categorie->enabled', + 'target' => '', + 'user' => 2 + ); $r++; diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9c52044291d..7fe182d6fab 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -498,3 +498,17 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index d5a4ba16bf0..7207bbacc38 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -90,4 +90,5 @@ ShowCategory=Show tag/category ByDefaultInList=By default in list ChooseCategory=Choose category StocksCategoriesArea=Warehouses Categories Area -UseOrOperatorForCategories=Use or operator for categories \ No newline at end of file +ActionCommCategoriesArea=Events Categories Area +UseOrOperatorForCategories=Use or operator for categories From 2ea58b11cad4a11c3e152dd225a5ced7e8c1a661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:36:32 +0100 Subject: [PATCH 010/105] wip --- htdocs/categories/class/categorie.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e42f0fe32ff..dd136383221 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -78,7 +78,7 @@ class Categorie extends CommonObject 'user' => 7, 'bank_line' => 8, 'warehouse' => 9, - 'actioncomm' => 9, + 'actioncomm' => 10, ); /** @@ -133,7 +133,7 @@ class Categorie extends CommonObject 'bank_account'=> 'account', 'project' => 'project', 'warehouse'=> 'warehouse', - 'actioncomm' => 'warehouse', + 'actioncomm' => 'actioncomm', ); /** From 9dcf53c65e3d161e00502b4d5507698b297390cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 20:56:36 +0100 Subject: [PATCH 011/105] add tables --- .../tables/llx_categorie_actioncomm.key.sql | 25 ++++++++++++++++++ .../mysql/tables/llx_categorie_actioncomm.sql | 26 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_actioncomm.sql diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql new file mode 100644 index 00000000000..30357eb87bc --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.key.sql @@ -0,0 +1,25 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 Frédéric France +-- +-- 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_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); diff --git a/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql new file mode 100644 index 00000000000..52aa2a2c95d --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_actioncomm.sql @@ -0,0 +1,26 @@ +-- ============================================================================ +-- Copyright (C) 2016 Charlie Benke +-- Copyright (C) 2016-2019 Frédéric France +-- +-- 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 . +-- +-- Table to link actioncomm tag/categories with actioncomms +-- =========================================================================== + +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; From 9040f6d9c7e248dde2906e91b5e719b9de796cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 13 Nov 2019 21:18:34 +0100 Subject: [PATCH 012/105] can tag actioncomm --- htdocs/comm/action/card.php | 36 +++++++++++++++ htdocs/comm/action/class/actioncomm.class.php | 44 +++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 09c8e344794..dc33a189be2 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -44,6 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("companies", "other", "commercial", "bills", "orders", "agenda")); @@ -374,6 +375,10 @@ if (empty($reshook) && $action == 'add') { if (! $object->error) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $moreparam=''; @@ -595,6 +600,10 @@ if (empty($reshook) && $action == 'update') if ($result > 0) { + // Category association + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + unset($_SESSION['assignedtouser']); $db->commit(); @@ -1000,6 +1009,14 @@ if ($action == 'create') print ''; } + if ($conf->categorie->enabled) { + // Categories + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + print $form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, '', 0, '100%'); + print ""; + } + print ''; @@ -1411,6 +1428,19 @@ if ($id > 0) print $form->select_dolusers($object->userdoneid> 0?$object->userdoneid:-1, 'doneby', 1); print ''; } + // Tags-Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACTIONCOMM, '', 'parent', 64, 0, 1); + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_ACTIONCOMM); + $arrayselected = array(); + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); + print ""; + } print ''; @@ -1716,6 +1746,12 @@ if ($id > 0) } print ''; } + // Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id, 'actioncomm', 1); + print ""; + } print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 97d3c4e397e..3e84c23dbc3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1501,6 +1501,50 @@ class ActionComm extends CommonObject return $result; } + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + // Handle single category + if (! is_array($categories)) { + $categories = array($categories); + } + + // Get current categories + include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $c = new Categorie($this->db); + $existing = $c->containing($this->id, Categorie::TYPE_ACTIONCOMM, 'id'); + + // Diff + if (is_array($existing)) { + $to_del = array_diff($existing, $categories); + $to_add = array_diff($categories, $existing); + } else { + $to_del = array(); // Nothing to delete + $to_add = $categories; + } + + // Process + foreach($to_del as $del) { + if ($c->fetch($del) > 0) { + $c->del_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + foreach ($to_add as $add) { + if ($c->fetch($add) > 0) { + $c->add_type($this, Categorie::TYPE_ACTIONCOMM); + } + } + return; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** From 1a9c430e0075285578dfbbb159b136c5d03093b8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 14 Nov 2019 04:53:13 +0100 Subject: [PATCH 013/105] Add migration --- .../mysql/data/llx_20_c_departements.sql | 130 +++++++++--------- .../install/mysql/migration/11.0.0-12.0.0.sql | 65 +++++++++ 2 files changed, 130 insertions(+), 65 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index 7e9417b487b..46d9b4d712e 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -42,97 +42,97 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 4,'974','97411',3,'REUNION','Réunion'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values ( 6,'976','97601',3,'MAYOTTE','Mayotte'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'01','01053',5,'AIN','Ain'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'02','02408',5,'AISNE','Aisne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'03','03190',5,'ALLIER','Allier'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'01','01053',5,'AIN','Ain'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'02','02408',5,'AISNE','Aisne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'03','03190',5,'ALLIER','Allier'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'04','04070',4,'ALPES-DE-HAUTE-PROVENCE','Alpes-de-Haute-Provence'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'05','05061',4,'HAUTES-ALPES','Hautes-Alpes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'06','06088',4,'ALPES-MARITIMES','Alpes-Maritimes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'07','07186',5,'ARDECHE','Ardèche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'08','08105',4,'ARDENNES','Ardennes'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'09','09122',5,'ARIEGE','Ariège'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'10','10387',5,'AUBE','Aube'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'11','11069',5,'AUDE','Aude'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'12','12202',5,'AVEYRON','Aveyron'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'07','07186',5,'ARDECHE','Ardèche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'08','08105',4,'ARDENNES','Ardennes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'09','09122',5,'ARIEGE','Ariège'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'10','10387',5,'AUBE','Aube'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'11','11069',5,'AUDE','Aude'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'12','12202',5,'AVEYRON','Aveyron'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'13','13055',4,'BOUCHES-DU-RHONE','Bouches-du-Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'14','14118',2,'CALVADOS','Calvados'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'15','15014',2,'CANTAL','Cantal'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'16','16015',3,'CHARENTE','Charente'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'14','14118',2,'CALVADOS','Calvados'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'15','15014',2,'CANTAL','Cantal'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'16','16015',3,'CHARENTE','Charente'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'17','17300',3,'CHARENTE-MARITIME','Charente-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'18','18033',2,'CHER','Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'19','19272',3,'CORREZE','Corrèze'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'19','19272',3,'CORREZE','Corrèze'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2A','2A004',3,'CORSE-DU-SUD','Corse-du-Sud'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (94,'2B','2B033',3,'HAUTE-CORSE','Haute-Corse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'21','21231',3,'COTE-D OR','Côte-d Or'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'21','21231',3,'COTE-D OR','Côte-d Or'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'22','22278',4,'COTES-D ARMOR','Côtes-d Armor'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'23','23096',3,'CREUSE','Creuse'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'24','24322',3,'DORDOGNE','Dordogne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'25','25056',2,'DOUBS','Doubs'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'26','26362',3,'DROME','Drôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'27','27229',5,'EURE','Eure'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'23','23096',3,'CREUSE','Creuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'24','24322',3,'DORDOGNE','Dordogne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'25','25056',2,'DOUBS','Doubs'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'26','26362',3,'DROME','Drôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'27','27229',5,'EURE','Eure'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'28','28085',1,'EURE-ET-LOIR','Eure-et-Loir'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'29','29232',2,'FINISTERE','Finistère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'30','30189',2,'GARD','Gard'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'32','32013',2,'GERS','Gers'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'33','33063',3,'GIRONDE','Gironde'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'34','34172',5,'HERAULT','Hérault'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'30','30189',2,'GARD','Gard'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'31','31555',3,'HAUTE-GARONNE','Haute-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'32','32013',2,'GERS','Gers'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'33','33063',3,'GIRONDE','Gironde'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'34','34172',5,'HERAULT','Hérault'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'35','35238',1,'ILLE-ET-VILAINE','Ille-et-Vilaine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'36','36044',5,'INDRE','Indre'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'37','37261',1,'INDRE-ET-LOIRE','Indre-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'38','38185',5,'ISERE','Isère'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'39','39300',2,'JURA','Jura'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'40','40192',4,'LANDES','Landes'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'38','38185',5,'ISERE','Isère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'39','39300',2,'JURA','Jura'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'40','40192',4,'LANDES','Landes'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'41','41018',0,'LOIR-ET-CHER','Loir-et-Cher'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'42','42218',3,'LOIRE','Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'42','42218',3,'LOIRE','Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'43','43157',3,'HAUTE-LOIRE','Haute-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'44','44109',3,'LOIRE-ATLANTIQUE','Loire-Atlantique'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (24,'45','45234',2,'LOIRET','Loiret'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'46','46042',2,'LOT','Lot'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'48','48095',3,'LOZERE','Lozère'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'46','46042',2,'LOT','Lot'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'47','47001',0,'LOT-ET-GARONNE','Lot-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'48','48095',3,'LOZERE','Lozère'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'49','49007',0,'MAINE-ET-LOIRE','Maine-et-Loire'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'50','50502',3,'MANCHE','Manche'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'51','51108',3,'MARNE','Marne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (21,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'50','50502',3,'MANCHE','Manche'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'51','51108',3,'MARNE','Marne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'52','52121',3,'HAUTE-MARNE','Haute-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'53','53130',3,'MAYENNE','Mayenne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'55','55029',3,'MEUSE','Meuse'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'54','54395',0,'MEURTHE-ET-MOSELLE','Meurthe-et-Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'55','55029',3,'MEUSE','Meuse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (53,'56','56260',2,'MORBIHAN','Morbihan'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'57','57463',3,'MOSELLE','Moselle'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'58','58194',3,'NIEVRE','Nièvre'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'59','59350',2,'NORD','Nord'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'60','60057',5,'OISE','Oise'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (25,'61','61001',5,'ORNE','Orne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (31,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (83,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (72,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (91,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'67','67482',2,'BAS-RHIN','Bas-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (42,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'69','69123',2,'RHONE','Rhône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'57','57463',3,'MOSELLE','Moselle'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'58','58194',3,'NIEVRE','Nièvre'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'59','59350',2,'NORD','Nord'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'60','60057',5,'OISE','Oise'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'61','61001',5,'ORNE','Orne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'62','62041',2,'PAS-DE-CALAIS','Pas-de-Calais'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'63','63113',2,'PUY-DE-DOME','Puy-de-Dôme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'64','64445',4,'PYRENEES-ATLANTIQUES','Pyrénées-Atlantiques'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'65','65440',4,'HAUTES-PYRENEES','Hautes-Pyrénées'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'66','66136',4,'PYRENEES-ORIENTALES','Pyrénées-Orientales'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'67','67482',2,'BAS-RHIN','Bas-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'68','68066',2,'HAUT-RHIN','Haut-Rhin'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'69','69123',2,'RHONE','Rhône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'70','70550',3,'HAUTE-SAONE','Haute-Saône'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'71','71270',0,'SAONE-ET-LOIRE','Saône-et-Loire'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'72','72181',3,'SARTHE','Sarthe'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'73','73065',3,'SAVOIE','Savoie'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (82,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'73','73065',3,'SAVOIE','Savoie'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (84,'74','74010',3,'HAUTE-SAVOIE','Haute-Savoie'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'75','75056',0,'PARIS','Paris'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (23,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (28,'76','76540',3,'SEINE-MARITIME','Seine-Maritime'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'77','77288',0,'SEINE-ET-MARNE','Seine-et-Marne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'78','78646',4,'YVELINES','Yvelines'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (22,'80','80021',3,'SOMME','Somme'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'81','81004',2,'TARN','Tarn'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (73,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'79','79191',4,'DEUX-SEVRES','Deux-Sèvres'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (32,'80','80021',3,'SOMME','Somme'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'81','81004',2,'TARN','Tarn'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (76,'82','82121',0,'TARN-ET-GARONNE','Tarn-et-Garonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'83','83137',2,'VAR','Var'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (93,'84','84007',0,'VAUCLUSE','Vaucluse'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (52,'85','85191',3,'VENDEE','Vendée'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (54,'86','86194',3,'VIENNE','Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (74,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (41,'88','88160',4,'VOSGES','Vosges'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (26,'89','89024',5,'YONNE','Yonne'); -insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (43,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'86','86194',3,'VIENNE','Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (75,'87','87085',3,'HAUTE-VIENNE','Haute-Vienne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (44,'88','88160',4,'VOSGES','Vosges'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'89','89024',5,'YONNE','Yonne'); +insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (27,'90','90010',0,'TERRITOIRE DE BELFORT','Territoire de Belfort'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'91','91228',5,'ESSONNE','Essonne'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'92','92050',4,'HAUTS-DE-SEINE','Hauts-de-Seine'); insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (11,'93','93008',3,'SEINE-SAINT-DENIS','Seine-Saint-Denis'); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..52e421f8205 --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,65 @@ +-- +-- Be carefull to requests order. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have default value. + + +-- Migration to the new regions (France) +UPDATE llx_c_regions set nom = 'Centre-Val de Loire' WHERE fk_pays = 1 AND code_region = 24; +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 27, '21231', 0, 'Bourgogne-Franche-Comté'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 28, '76540', 0, 'Normandie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 32, '59350', 4, 'Hauts-de-France'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 44, '67482', 2, 'Grand Est'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 75, '33063', 0, 'Nouvelle-Aquitaine'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 76, '31355', 1, 'Occitanie'); +insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (1, 84, '69123', 1, 'Auvergne-Rhône-Alpes'); + +UPDATE llx_c_departements set fk_region = 27 WHERE fk_region = 26 OR fk_region = 43; +UPDATE llx_c_departements set fk_region = 28 WHERE fk_region = 25 OR fk_region = 23; +UPDATE llx_c_departements set fk_region = 32 WHERE fk_region = 22 OR fk_region = 31; +UPDATE llx_c_departements set fk_region = 44 WHERE fk_region = 21 OR fk_region = 41 OR fk_region = 42; +UPDATE llx_c_departements set fk_region = 75 WHERE fk_region = 54 OR fk_region = 74 OR fk_region = 72; +UPDATE llx_c_departements set fk_region = 76 WHERE fk_region = 73 OR fk_region = 91; +UPDATE llx_c_departements set fk_region = 84 WHERE fk_region = 82 OR fk_region = 83; + +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 21; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 22; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 23; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 25; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 26; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 31; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 41; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 42; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 43; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 54; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 72; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 73; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 74; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 82; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 83; +DELETE FROM llx_c_regions WHERE fk_pays = 1 AND code_region = 91; + From 3bac051521deb2f77df97c60fdb519471f1f5210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:07:16 +0100 Subject: [PATCH 014/105] use class CONST --- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription.php | 2 +- htdocs/comm/action/card.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 417d4cd2c99..8f13769aa3e 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1753,7 +1753,7 @@ else { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b591a29a6e9..85fd04c1325 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -532,7 +532,7 @@ if ($rowid > 0) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'member', 1); + print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); print ''; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index dc33a189be2..640569a5da1 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1749,7 +1749,7 @@ if ($id > 0) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'actioncomm', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACTIONCOMM, 1); print ""; } From 446c66da6203a5ef2d3f07ca9d3db48790025876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 08:15:39 +0100 Subject: [PATCH 015/105] use class CONST --- htdocs/comm/card.php | 2 +- htdocs/compta/bank/card.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/fourn/card.php | 2 +- htdocs/product/card.php | 2 +- htdocs/product/stock/card.php | 2 +- htdocs/projet/card.php | 2 +- htdocs/projet/comment.php | 2 +- htdocs/projet/contact.php | 2 +- htdocs/projet/element.php | 2 +- htdocs/projet/ganttview.php | 2 +- htdocs/projet/tasks.php | 2 +- htdocs/societe/card.php | 4 ++-- htdocs/user/card.php | 4 ++-- 14 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a0263065dee..062d1658821 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -491,7 +491,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 980cf6bd8f2..9f5707402a6 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -689,7 +689,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'bank_account', 1); + print $form->showCategories($object->id, Categorie::TYPE_ACCOUNT, 1); print ""; } diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index f72edeb3a34..563f9906f16 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1355,7 +1355,7 @@ else if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) { print '' . $langs->trans("Categories") . ''; print ''; - print $form->showCategories($object->id, 'contact', 1); + print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); print ''; } diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index f52f5b089fd..32f6a9ad11b 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -312,7 +312,7 @@ if ($object->id > 0) $langs->load("categories"); print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a5793cc66c8..32eb5c4b383 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1982,7 +1982,7 @@ else // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'product', 1); + print $form->showCategories($object->id, Categorie::TYPE_PRODUCT, 1); print ""; } diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 41e91b04d0c..2a69ae58ae8 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -454,7 +454,7 @@ else // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'warehouse', 1); + print $form->showCategories($object->id, Categorie::TYPE_WAREHOUSE, 1); print ""; } print ""; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 51af2f2b14d..16f1dd7e439 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1069,7 +1069,7 @@ elseif ($object->id > 0) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index a7478163f47..4c9c4ca3ad3 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -160,7 +160,7 @@ print ''; // Categories if ($conf->categorie->enabled) { print '' . $langs->trans("Categories") . ''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index 82eb598190b..f8ccdbf7210 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -279,7 +279,7 @@ if ($id > 0 || ! empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 56d01faa342..1e3661516fb 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -255,7 +255,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS) && ! empty($conf->global->PROJECT_B // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 725d99fb673..42f79ae0f30 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -212,7 +212,7 @@ if (($id > 0 && is_numeric($id)) || ! empty($ref)) // Categories if($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 9d9b8e69516..0775d5996b2 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -487,7 +487,7 @@ if ($id > 0 || !empty($ref)) // Categories if ($conf->categorie->enabled) { print ''.$langs->trans("Categories").''; - print $form->showCategories($object->id, 'project', 1); + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); print ""; } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 6b375679052..e8182f9c846 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2550,7 +2550,7 @@ else if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { print '' . $langs->trans("CustomersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'customer', 1); + print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1); print ""; } @@ -2558,7 +2558,7 @@ else if ($object->fournisseur) { print '' . $langs->trans("SuppliersCategoriesShort") . ''; print ''; - print $form->showCategories($object->id, 'supplier', 1); + print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1); print ""; } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 7886c0ef728..d75d6abbc57 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1764,7 +1764,7 @@ else { print ''.$langs->trans("Categories").''; print ''; - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); print ''; } @@ -2626,7 +2626,7 @@ else { print $form->multiselectarray('usercats', $cate_arbo, $arrayselected, '', 0, '', 0, '90%'); } else { - print $form->showCategories($object->id, 'user', 1); + print $form->showCategories($object->id, Categorie::TYPE_USER, 1); } print ""; } From 6e97697faae9cc5b07d3eee0bc938f87ba114b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Nov 2019 22:38:37 +0100 Subject: [PATCH 016/105] wip --- htdocs/categories/class/api_categories.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 0f2a425fe87..0e71f52a955 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -48,6 +48,11 @@ class Categories extends DolibarrApi 3 => 'member', 4 => 'contact', 5 => 'account', + //6 => 'project', + //7 => 'user', + //8 => 'bank_line', + //9 => 'warehouse', + //10 => 'actioncomm', ); /** From b3e09e050c3e07c0beb5a8dff8dd3f4652ee5a46 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 18 Nov 2019 11:36:12 +0100 Subject: [PATCH 017/105] fix missing param --- htdocs/comm/propal/list.php | 83 +++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index b1897916023..c29fac8405f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -413,22 +413,25 @@ if ($resql) $param = '&viewstatut='.urlencode($viewstatut); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - if ($sall) $param .= '&sall='.urlencode($sall); - if ($search_day) $param .= '&search_day='.urlencode($search_day); - if ($search_month) $param .= '&search_month='.urlencode($search_month); - if ($search_year) $param .= '&search_year='.urlencode($search_year); - if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); - if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); - if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); - if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); - if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); - if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); - if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); - if ($search_login) $param .= '&search_login='.urlencode($search_login); - if ($search_town) $param .= '&search_town='.urlencode($search_town); - if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); - if ($socid > 0) $param .= '&socid='.urlencode($socid); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($sall) $param .= '&sall='.urlencode($sall); + if ($search_date_start) $param .= '&search_date_start='.urlencode($search_date_start); + if ($search_date_end) $param .= '&search_date_end='.urlencode($search_date_end); + if ($search_dateend_start) $param .= '&search_dateend_start='.urlencode($search_dateend_start); + if ($search_dateend_end) $param .= '&search_dateend_end='.urlencode($search_dateend_end); + if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); + if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_refcustomer) $param .= '&search_refcustomer='.urlencode($search_refcustomer); + if ($search_refproject) $param .= '&search_refproject='.urlencode($search_refproject); + if ($search_societe) $param .= '&search_societe='.urlencode($search_societe); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); + if ($search_montant_ht) $param .= '&search_montant_ht='.urlencode($search_montant_ht); + if ($search_login) $param .= '&search_login='.urlencode($search_login); + if ($search_town) $param .= '&search_town='.urlencode($search_town); + if ($search_zip) $param .= '&search_zip='.urlencode($search_zip); + if ($socid > 0) $param .= '&socid='.urlencode($socid); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); if ($search_product_category != '') $param .= '&search_product_category='.$search_product_category; @@ -727,37 +730,37 @@ if ($resql) // Fields title print ''; - if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.ref_client']['checked'])) print_liste_field_titre($arrayfields['p.ref_client']['label'], $_SERVER["PHP_SELF"], 'p.ref_client', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.ref']['checked'])) print_liste_field_titre($arrayfields['pr.ref']['label'], $_SERVER["PHP_SELF"], 'pr.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['pr.title']['checked'])) print_liste_field_titre($arrayfields['pr.title']['label'], $_SERVER["PHP_SELF"], 'pr.title', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date']['checked'])) print_liste_field_titre($arrayfields['p.date']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fin_validite']['checked'])) print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_livraison']['checked'])) print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['ava.rowid']['checked'])) print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); if (!empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); - if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); - if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); + if (!empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); + if (!empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); - if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); + if (!empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.date_cloture']['checked'])) print_liste_field_titre($arrayfields['p.date_cloture']['label'], $_SERVER["PHP_SELF"], "p.date_cloture", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder); + if (!empty($arrayfields['p.fk_statut']['checked'])) print_liste_field_titre($arrayfields['p.fk_statut']['label'], $_SERVER["PHP_SELF"], "p.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); print ''."\n"; From dbbcda9e999ebdb4f8d48abdf97b62cc03c4fae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Wed, 20 Nov 2019 06:38:28 +0100 Subject: [PATCH 018/105] Add WYSIWYG editor to description field of projects --- htdocs/projet/card.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 493978f738e..45c76363933 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -27,6 +27,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/project/modules_project.php'; @@ -657,7 +658,8 @@ if ($action == 'create' && $user->rights->projet->creer) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', GETPOST("description", 'none'), '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; if ($conf->categorie->enabled) { @@ -913,7 +915,8 @@ elseif ($object->id > 0) // Description print ''.$langs->trans("Description").''; print ''; - print ''; + $doleditor = new DolEditor('description', $object->description, '', 90, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3, '90%'); + $doleditor->Create(); print ''; // Tags-Categories From a3e7c4467a42f6431021a06a77d90d9892e75336 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 10:36:26 +0100 Subject: [PATCH 019/105] NEW add WYSiWYG on member type's description --- htdocs/adherents/type.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ecfd12142f4..23a8608c1e8 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,3 +1,4 @@ + * Copyright (C) 2003 Jean-Louis Bergamo @@ -65,7 +66,7 @@ $subscription = GETPOST("subscription", "int"); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); $vote = GETPOST("vote", "int"); -$comment = GETPOST("comment", 'alphanohtml'); +$comment = GETPOST("comment", 'none'); $mail_valid = GETPOST("mail_valid", 'none'); // Security check @@ -363,7 +364,9 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); print ''.$langs->trans("WelcomeEMail").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -806,10 +809,12 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - print ''; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); + $doleditor->Create(); + print ""; print ''.$langs->trans("WelcomeEMail").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('mail_valid', $object->mail_valid, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From 54e528d659cb13670bbd801fa9ff30151f7ca7e6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 09:38:32 +0000 Subject: [PATCH 020/105] Fixing style errors. --- htdocs/adherents/type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 23a8608c1e8..ae54d9fec08 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -364,7 +364,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); From 789e751e4a2963d7c169708af68a08b723449604 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 10:55:58 +0100 Subject: [PATCH 021/105] Update type.php --- htdocs/adherents/type.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index ae54d9fec08..fd43988ccf5 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -1,4 +1,3 @@ - * Copyright (C) 2003 Jean-Louis Bergamo @@ -809,7 +808,7 @@ if ($rowid > 0) print ''; print ''.$langs->trans("Description").''; - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('comment', $object->note, '', 280, 'dolibarr_notes', '', false, true, $conf->fckeditor->enabled, 15, '90%'); $doleditor->Create(); print ""; From f1a9daf77e1740bbef9eb12c91ba7242c8e718af Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:42:56 +0100 Subject: [PATCH 022/105] NEW add total of value in product stat --- htdocs/product/stats/card.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 5ca7992be31..0b0399e424f 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2019 Thibault FOUCARt * * 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 @@ -351,6 +352,7 @@ if ($result || empty($id)) $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']); $px->draw($dir."/".$graphfiles[$key]['file'], $url); + $graphfiles[$key]['total'] = $px->total(); $graphfiles[$key]['output'] = $px->show(); } else @@ -405,7 +407,7 @@ if ($result || empty($id)) // Label print ''; print $graphfiles[$key]['label']; - print ''; + print ' ('.$graphfiles[$key]['total'].')'; print ''.$linktoregenerate.''; print ''; // Image From 2c810988a6204c09ec973df96ac36eb1a3395387 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 20 Nov 2019 12:43:49 +0100 Subject: [PATCH 023/105] Update dolgraph.class.php --- htdocs/core/class/dolgraph.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 37f1d6036c6..4cd58a63378 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1124,7 +1124,20 @@ class DolGraph $this->stringtoshow .= ''."\n"; } - + /** + * Output HTML string to total value + * + * @return string HTML string to total value + */ + public function total() + { + $value = 0; + foreach($this->data as $valarray) // Loop on each x + { + $value += $valarray[1]; + } + return $value; + } /** * Output HTML string to show graph From 3209d550c2d083b72bee1b7af202329485578186 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 20 Nov 2019 11:45:12 +0000 Subject: [PATCH 024/105] Fixing style errors. --- htdocs/core/class/dolgraph.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 4cd58a63378..c6d610ca5f0 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1131,12 +1131,12 @@ class DolGraph */ public function total() { - $value = 0; - foreach($this->data as $valarray) // Loop on each x + $value = 0; + foreach($this->data as $valarray) // Loop on each x { - $value += $valarray[1]; - } - return $value; + $value += $valarray[1]; + } + return $value; } /** From 0a125f73b5ae8ef858ec3a901b2f68045ddbb16c Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:21:35 +0100 Subject: [PATCH 025/105] NEW add units in product list --- htdocs/product/list.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 33ad0b4806c..2e383f18a0e 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -173,9 +173,10 @@ $arrayfields = array( 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(!empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(!empty($user->rights->fournisseur->lire))), @@ -289,6 +290,7 @@ $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid prod_comb_id'; @@ -311,6 +313,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_units cu ON cu.rowid = p.fk_unit"; $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; @@ -376,6 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; @@ -639,6 +643,13 @@ if ($resql) print ''; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + print ''; + } + // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) { @@ -759,6 +770,7 @@ if ($resql) if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.sellprice']['checked'])) { print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right '); } @@ -875,6 +887,9 @@ if ($resql) $product_static->volume_units = $obj->volume_units; $product_static->surface = $obj->surface; $product_static->surface_units = $obj->surface_units; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $product_static->fk_unit = $obj->fk_unit; + } if ((!empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || !empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { @@ -986,6 +1001,16 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Unit + if (!empty($arrayfields['cu.label']['checked'])) + { + print ''; + if ($obj->cu_label !== '') { + print $langs->trans($obj->cu_label); + } + print ''; + if (!$i) $totalarray['nbfield']++; + } // Sell price if (!empty($arrayfields['p.sellprice']['checked'])) From 38b083b766cb560017afa1a7b81f68ed632d60cf Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 14:43:29 +0100 Subject: [PATCH 026/105] FIX unit translate in product list if null --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2e383f18a0e..745876a7400 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -1005,7 +1005,7 @@ if ($resql) if (!empty($arrayfields['cu.label']['checked'])) { print ''; - if ($obj->cu_label !== '') { + if (!empty($obj->cu_label)) { print $langs->trans($obj->cu_label); } print ''; From b7517377a700810b27e251d27c6b948bdb3365f6 Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Wed, 20 Nov 2019 15:00:34 +0100 Subject: [PATCH 027/105] FIX goup by unit label in product list --- htdocs/product/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 745876a7400..2396b345fb8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -379,7 +379,7 @@ $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.pric $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; -if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit'; +if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { $sql .= ', pac.rowid'; From 4d9894e58e40e6b326f4d49909b9cbc7e9d40919 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 22 Nov 2019 15:49:06 +0100 Subject: [PATCH 028/105] Update card.php --- htdocs/product/stats/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 0b0399e424f..24387ef8b73 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2005 Eric Seigne * Copyright (C) 2013 Juanjo Menent - * Copyright (C) 2019 Thibault FOUCARt + * Copyright (C) 2019 Thibault FOUCART * * 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 From 35f02c5165bf94d76b10767d45d257255bf354af Mon Sep 17 00:00:00 2001 From: VESSILLER Date: Mon, 25 Nov 2019 10:25:09 +0100 Subject: [PATCH 029/105] NEW add width and height measures in product list --- htdocs/product/list.php | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 2396b345fb8..8df44bfeea8 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -174,6 +174,8 @@ $arrayfields = array( 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1')), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled))), 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.width'=>array('label'=>$langs->trans('Width'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.height'=>array('label'=>$langs->trans('Height'), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SIZE))), 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_SURFACE))), 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && empty($conf->global->PRODUCT_DISABLE_VOLUME))), 'cu.label'=>array('label'=>$langs->trans("DefaultUnitToShow"), 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->global->PRODUCT_USE_UNITS))), @@ -289,7 +291,7 @@ $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p $sql .= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql .= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units,'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ' p.fk_unit, cu.label as cu_label,'; $sql .= ' MIN(pfp.unitprice) as minsellprice'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -378,7 +380,7 @@ $sql .= $hookmanager->resPrint; $sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type,"; $sql .= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp, p.stock,'; -$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; +$sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.height, p.surface, p.surface_units, p.volume, p.volume_units, p.width, p.width_units, p.height, p.height_units'; if (!empty($conf->global->PRODUCT_USE_UNITS)) $sql .= ', p.fk_unit, cu.label'; if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) { @@ -630,6 +632,18 @@ if ($resql) print ''; print ''; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print ''; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print ''; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { @@ -768,6 +782,8 @@ if ($resql) } if (!empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.length']['checked'])) print_liste_field_titre($arrayfields['p.length']['label'], $_SERVER["PHP_SELF"], "p.length", "", $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.width']['checked'])) print_liste_field_titre($arrayfields['p.width']['label'], $_SERVER['PHP_SELF'], 'p.width', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['p.height']['checked'])) print_liste_field_titre($arrayfields['p.height']['label'], $_SERVER['PHP_SELF'], 'p.height', '', $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.surface']['checked'])) print_liste_field_titre($arrayfields['p.surface']['label'], $_SERVER["PHP_SELF"], "p.surface", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['p.volume']['checked'])) print_liste_field_titre($arrayfields['p.volume']['label'], $_SERVER["PHP_SELF"], "p.volume", "", $param, '', $sortfield, $sortorder, 'center '); if (!empty($arrayfields['cu.label']['checked'])) print_liste_field_titre($arrayfields['cu.label']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); @@ -985,6 +1001,22 @@ if ($resql) print ''; if (!$i) $totalarray['nbfield']++; } + // Width + if (!empty($arrayfields['p.width']['checked'])) + { + print ''; + print $obj->width; + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Height + if (!empty($arrayfields['p.height']['checked'])) + { + print ''; + print $obj->height; + print ''; + if (!$i) $totalarray['nbfield']++; + } // Surface if (!empty($arrayfields['p.surface']['checked'])) { From b715ecd7d9a2d2af35ca7d6dca33f70f9edea615 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 11 Dec 2019 16:42:03 +0100 Subject: [PATCH 030/105] FIX bookmark URLs get truncated to 255 chars --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_bookmark.key.sql | 1 - htdocs/install/mysql/tables/llx_bookmark.sql | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 4bacfa9b765..f8f5f912025 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,3 +545,6 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; + +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs diff --git a/htdocs/install/mysql/tables/llx_bookmark.key.sql b/htdocs/install/mysql/tables/llx_bookmark.key.sql index f933939ceb7..7f4090d32f4 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.key.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.key.sql @@ -17,5 +17,4 @@ -- =================================================================== -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_url (fk_user, url); ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/tables/llx_bookmark.sql b/htdocs/install/mysql/tables/llx_bookmark.sql index 1c11525528c..6a76ed38343 100644 --- a/htdocs/install/mysql/tables/llx_bookmark.sql +++ b/htdocs/install/mysql/tables/llx_bookmark.sql @@ -21,7 +21,7 @@ create table llx_bookmark rowid integer AUTO_INCREMENT PRIMARY KEY, fk_user integer NOT NULL, dateb datetime, - url varchar(255) NOT NULL, + url TEXT, target varchar(16), title varchar(64), favicon varchar(24), From 5d955fa7e00c362fe7f3f9b2b5274d787286b74c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 14 Dec 2019 13:51:13 +0100 Subject: [PATCH 031/105] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index f8f5f912025..d6e34030408 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -548,3 +548,4 @@ ALTER TABLE llx_website ADD COLUMN use_manifest integer; ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); From 7359c4140d7a5615a68ae44c9c43654e0e8fdf0d Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Tue, 24 Dec 2019 09:54:02 +0100 Subject: [PATCH 032/105] FIX 12.0 - bookmark URLs get truncated to 255 chars - PR rescheduled for merging into the next major version (v12.0) --- .../install/mysql/migration/10.0.0-11.0.0.sql | 4 --- .../install/mysql/migration/11.0.0-12.0.0.sql | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index d6e34030408..4bacfa9b765 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -545,7 +545,3 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; - -ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; -ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs -ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..7062ac5d58b --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,34 @@ +-- +-- Be careful with the order of the requests. +-- This file must be loaded by calling /install/index.php page +-- when current version is 12.0.0 or higher. +-- +-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y +-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y +-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new; +-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol; +-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60); +-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname; +-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60); +-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name; +-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field); +-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table +-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex +-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT; +-- To make pk to be auto increment (postgres): +-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid; +-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid); +-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq'); +-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table; +-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL; +-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL; +-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL; +-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL; +-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL; +-- Note: fields with type BLOB/TEXT can't have a default value. + +-- Missing in v11 +ALTER TABLE llx_bookmark DROP INDEX uk_bookmark_url; +ALTER TABLE llx_bookmark MODIFY COLUMN url TEXT; -- change from VARCHAR(255) to allow longer URLs +ALTER TABLE llx_bookmark ADD UNIQUE uk_bookmark_title (fk_user, title); + From 5b1ae96ce9878def8998eafe6a8c9a8c0c596605 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Sun, 29 Dec 2019 20:45:30 +0100 Subject: [PATCH 033/105] Added two new options when billing time spent on a project : - Create one invoice line per timespent entry - Create one invoice line per task --- htdocs/projet/tasks/time.php | 160 +++++++++++++++++++++++++++-------- 1 file changed, 125 insertions(+), 35 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 8e7856759a7..af37e3bfa5f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -342,6 +342,8 @@ if ($action == 'confirm_generateinvoice') $db->begin(); $idprod = GETPOST('productid', 'int'); + $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); + if ($idprod > 0) { $tmpproduct->fetch($idprod); @@ -373,45 +375,132 @@ if ($action == 'confirm_generateinvoice') if (!$error) { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); - } + if ($generateinvoicemode=='onelineperuser') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); + } - foreach ($arrayoftasks as $userid => $value) - { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + foreach ($arrayoftasks as $userid => $value) + { + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } + elseif ($generateinvoicemode=='onelineperperiod') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; + } + + foreach ($arrayoftasks as $timespent_id => $value) + { + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } + elseif ($generateinvoicemode=='onelinepertask') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; + } + + foreach ($arrayoftasks as $task_id => $value) + { + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } + } + } } if (!$error) @@ -841,7 +930,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; $tmparray = array( 'onelineperuser'=>'OneLinePerUser', - //'onelinepertask'=>'OneLinePerTask', + 'onelinepertask'=>'OneLinePerTask', + 'onelineperperiod'=>'OneLinePerPeriod', ); print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); print ''; From 84d8ca4b332ecb30ab95a99e4432af1cbb0c6406 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Sun, 29 Dec 2019 20:47:18 +0100 Subject: [PATCH 034/105] Made spaces/tab usage more consistent --- htdocs/projet/tasks/time.php | 1868 +++++++++++++++++----------------- 1 file changed, 934 insertions(+), 934 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index af37e3bfa5f..98bd7523605 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -4,7 +4,7 @@ * Copyright (C) 2010-2012 Regis Houssin * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Frédéric France * * 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 @@ -21,9 +21,9 @@ */ /** - * \file htdocs/projet/tasks/time.php - * \ingroup project - * \brief Page to add new time spent on a task + * \file htdocs/projet/tasks/time.php + * \ingroup project + * \brief Page to add new time spent on a task */ require '../../main.inc.php'; @@ -38,18 +38,18 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; // Load translation files required by the page $langs->loadLangs(array('projects', 'bills', 'orders')); -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); -$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$confirm = GETPOST('confirm', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'alpha'); -$id = GETPOST('id', 'int'); -$projectid = GETPOST('projectid', 'int'); -$ref = GETPOST('ref', 'alpha'); +$id = GETPOST('id', 'int'); +$projectid = GETPOST('projectid', 'int'); +$ref = GETPOST('ref', 'alpha'); $withproject = GETPOST('withproject', 'int'); $project_ref = GETPOST('project_ref', 'alpha'); @@ -68,14 +68,14 @@ $search_valuebilled = GETPOST('search_valuebilled', 'int'); // Security check $socid = 0; -//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. +//if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement. if (!$user->rights->projet->lire) accessforbidden(); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $page = GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -113,20 +113,20 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_month = ''; $search_year = ''; $search_date = ''; - $search_datehour = ''; - $search_datewithhour = ''; - $search_note = ''; - $search_duration = ''; - $search_value = ''; - $search_date_creation = ''; - $search_date_update = ''; - $search_task_ref = ''; - $search_task_label = ''; - $search_user = 0; - $search_valuebilled = ''; - $toselect = ''; - $search_array_options = array(); - $action = ''; + $search_datehour = ''; + $search_datewithhour = ''; + $search_note = ''; + $search_duration = ''; + $search_value = ''; + $search_date_creation = ''; + $search_date_update = ''; + $search_task_ref = ''; + $search_task_label = ''; + $search_user = 0; + $search_valuebilled = ''; + $toselect = ''; + $search_array_options = array(); + $action = ''; } if ($action == 'addtimespent' && $user->rights->projet->lire) @@ -149,61 +149,61 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if (!$error) { - if ($id || $ref) + if ($id || $ref) { $object->fetch($id, $ref); } else { - if (!GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) - { - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); - $action = 'createtime'; - $error++; - } - else - { - $object->fetch(GETPOST('taskid', 'int')); - } + if (!GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); + $action = 'createtime'; + $error++; + } + else + { + $object->fetch(GETPOST('taskid', 'int')); + } } if (!$error) { - $object->fetch_projet(); + $object->fetch_projet(); - if (empty($object->project->statut)) - { - setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); - $action = 'createtime'; - $error++; - } - else - { - $object->timespent_note = $_POST["timespent_note"]; - if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value - $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds - $object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds - if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered - { - $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - $object->timespent_withhour = 1; - } - else - { - $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); - } - $object->timespent_fk_user = $_POST["userid"]; - $result = $object->addTimeSpent($user); - if ($result >= 0) - { - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans($object->error), null, 'errors'); - $error++; - } - } + if (empty($object->project->statut)) + { + setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); + $action = 'createtime'; + $error++; + } + else + { + $object->timespent_note = $_POST["timespent_note"]; + if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value + $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds + $object->timespent_duration += ($_POST["timespent_durationmin"] ? $_POST["timespent_durationmin"] : 0) * 60; // We store duration in seconds + if (GETPOST("timehour") != '' && GETPOST("timehour") >= 0) // If hour was entered + { + $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + $object->timespent_withhour = 1; + } + else + { + $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); + } + $object->timespent_fk_user = $_POST["userid"]; + $result = $object->addTimeSpent($user); + if ($result >= 0) + { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans($object->error), null, 'errors'); + $error++; + } + } } } else @@ -233,12 +233,12 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel $object->timespent_old_duration = $_POST["old_duration"]; $object->timespent_duration = $_POST["new_durationhour"] * 60 * 60; // We store duration in seconds $object->timespent_duration += $_POST["new_durationmin"] * 60; // We store duration in seconds - if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered - { + if (GETPOST("timelinehour") != '' && GETPOST("timelinehour") >= 0) // If hour was entered + { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $object->timespent_withhour = 1; - } - else + } + else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } @@ -305,24 +305,24 @@ if (GETPOST('projectid', 'int') > 0) $projectidforalltimes = GETPOST('projectid', 'int'); $result = $projectstatic->fetch($projectidforalltimes); - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - $res = $projectstatic->fetch_optionals(); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + $res = $projectstatic->fetch_optionals(); } elseif (GETPOST('project_ref', 'alpha')) { - $projectstatic->fetch(0, GETPOST('project_ref', 'alpha')); - $projectidforalltimes = $projectstatic->id; - $withproject = 1; + $projectstatic->fetch(0, GETPOST('project_ref', 'alpha')); + $projectidforalltimes = $projectstatic->id; + $withproject = 1; } elseif ($id > 0) { - $object->fetch($id); - $result = $projectstatic->fetch($object->fk_project); + $object->fetch($id); + $result = $projectstatic->fetch($object->fk_project); } if ($action == 'confirm_generateinvoice') { - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); if (!($projectstatic->thirdparty->id > 0)) @@ -356,10 +356,10 @@ if ($action == 'confirm_generateinvoice') } else { - $pu_ht = 0; - $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); - $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); - $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); + $pu_ht = 0; + $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); + $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); + $localtax2 = get_default_localtax($mysoc, $projectstatic->thirdparty, 2); } $tmpinvoice->socid = $projectstatic->thirdparty->id; @@ -369,147 +369,147 @@ if ($action == 'confirm_generateinvoice') $result = $tmpinvoice->create($user); if ($result <= 0) { - $error++; - setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); + $error++; + setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); } if (!$error) { - if ($generateinvoicemode=='onelineperuser') { + if ($generateinvoicemode=='onelineperuser') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); } foreach ($arrayoftasks as $userid => $value) { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - elseif ($generateinvoicemode=='onelineperperiod') { + } + elseif ($generateinvoicemode=='onelineperperiod') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; - $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; - $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; - $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; } foreach ($arrayoftasks as $timespent_id => $value) { - $userid = $value['user']; - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - elseif ($generateinvoicemode=='onelinepertask') { + } + elseif ($generateinvoicemode=='onelinepertask') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { - // Get userid, timepent - $object->fetchTimeSpent($value); - // $object->id is the task id - $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; } foreach ($arrayoftasks as $task_id => $value) { - $ftask = new Task($db); - $ftask->fetch($task_id); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); - } + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } - // Add lines - $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; - $result = $db->query($sql); - if (!$result) - { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; - } + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } + } } if (!$error) { - $urltoinvoice = $tmpinvoice->getNomUrl(0); - setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); - //var_dump($tmpinvoice); + $urltoinvoice = $tmpinvoice->getNomUrl(0); + setEventMessages($langs->trans("InvoiceGeneratedFromTimeSpent", $urltoinvoice), null, 'mesgs'); + //var_dump($tmpinvoice); - $db->commit(); + $db->commit(); } else { @@ -536,14 +536,14 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { /* * Fiche projet en mode visu - */ - if ($projectidforalltimes > 0) - { - $result = $projectstatic->fetch($projectidforalltimes); - if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); - $res = $projectstatic->fetch_optionals(); - } - elseif ($object->fetch($id, $ref) >= 0) + */ + if ($projectidforalltimes > 0) + { + $result = $projectstatic->fetch($projectidforalltimes); + if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); + $res = $projectstatic->fetch_optionals(); + } + elseif ($object->fetch($id, $ref) >= 0) { if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $result = $projectstatic->fetch($object->fk_project); @@ -552,10 +552,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $res = $projectstatic->fetch_optionals(); $object->project = clone $projectstatic; - } + } - $userRead = $projectstatic->restrictedProjectArea($user, 'read'); - $linktocreatetime = ''; + $userRead = $projectstatic->restrictedProjectArea($user, 'read'); + $linktocreatetime = ''; if ($projectstatic->id > 0) { @@ -571,122 +571,122 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Project card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; - // Title - $morehtmlref .= $projectstatic->title; - // Thirdparty - if ($projectstatic->thirdparty->id > 0) - { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); - } - $morehtmlref .= '
'; + $morehtmlref = '
'; + // Title + $morehtmlref .= $projectstatic->title; + // Thirdparty + if ($projectstatic->thirdparty->id > 0) + { + $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$projectstatic->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref .= '
'; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) - { - $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; - } + // Define a complementary filter for search of next/prev ref. + if (!$user->rights->projet->all->lire) + { + $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); + $projectstatic->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + } - dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Usage - print ''; - print ''; + // Usage + print ''; + print ''; - // Visibility - print ''; + // Visibility + print ''; - // Date start - end - print ''; + // Date start - end + print ''; - // Budget - print ''; + // Budget + print ''; - // Other attributes - $cols = 2; - //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + // Other attributes + $cols = 2; + //include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - print '
'; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
'; - } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
'; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
'; - } - print '
'; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
'; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
'; + } + if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
'; + } + print '
'.$langs->trans("Visibility").''; - if ($projectstatic->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
'.$langs->trans("Visibility").''; + if ($projectstatic->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; - $start = dol_print_date($projectstatic->date_start, 'day'); - print ($start ? $start : '?'); - $end = dol_print_date($projectstatic->date_end, 'day'); - print ' - '; - print ($end ? $end : '?'); - if ($projectstatic->hasDelay()) print img_warning("Late"); - print '
'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + $start = dol_print_date($projectstatic->date_start, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($projectstatic->date_end, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($projectstatic->hasDelay()) print img_warning("Late"); + print '
'.$langs->trans("Budget").''; - if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - print '
'.$langs->trans("Budget").''; + if (strcmp($projectstatic->budget_amount, '')) print price($projectstatic->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + print '
'; + print ''; - print '
'; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Description - print ''; + // Description + print ''; - // Bill time - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print ''; - } + // Bill time + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print ''; + } - // Categories - if ($conf->categorie->enabled) { - print '"; - } + // Categories + if ($conf->categorie->enabled) { + print '"; + } - print '
'.$langs->trans("Description").''; - print nl2br($projectstatic->description); - print '
'.$langs->trans("Description").''; + print nl2br($projectstatic->description); + print '
'.$langs->trans("BillTime").''; - print yn($projectstatic->usage_bill_time); - print '
'.$langs->trans("BillTime").''; + print yn($projectstatic->usage_bill_time); + print '
'.$langs->trans("Categories").''; - print $form->showCategories($projectstatic->id, 'project', 1); - print "
'.$langs->trans("Categories").''; + print $form->showCategories($projectstatic->id, 'project', 1); + print "
'; + print ''; - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print '
'; + print '
'; dol_fiche_end(); @@ -694,46 +694,46 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } // Link to create time - $linktocreatetimeBtnStatus = 0; - $linktocreatetimeUrl = ''; - $linktocreatetimeHelpText = ''; - if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough + $linktocreatetimeBtnStatus = 0; + $linktocreatetimeUrl = ''; + $linktocreatetimeHelpText = ''; + if ($user->rights->projet->all->lire || $user->rights->projet->lire) // To enter time, read permission is enough { if ($projectstatic->public || $userRead > 0) - { - $linktocreatetimeBtnStatus = 1; + { + $linktocreatetimeBtnStatus = 1; - if (!empty($projectidforalltimes)) // We are on tab 'Time Spent' of project - { - $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); - $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); - } - else // We are on tab 'Time Spent' of task - { - $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); - $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); - } - } - else - { - $linktocreatetimeBtnStatus = -2; - $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); - } + if (!empty($projectidforalltimes)) // We are on tab 'Time Spent' of project + { + $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); + } + else // We are on tab 'Time Spent' of task + { + $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); + $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); + } + } + else + { + $linktocreatetimeBtnStatus = -2; + $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); + } } - $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); - } + $linktocreatetime = dolGetButtonTitle($langs->trans('AddTimeSpent'), $linktocreatetimeHelpText, 'fa fa-plus-circle', $linktocreatetimeUrl, '', $linktocreatetimeBtnStatus); + } $massactionbutton = ''; if ($projectstatic->usage_bill_time) { - $arrayofmassactions = array( - 'generateinvoice'=>$langs->trans("GenerateBill"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); - if (in_array($massaction, array('presend', 'predelete', 'generateinvoice'))) $arrayofmassactions = array(); - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); + $arrayofmassactions = array( + 'generateinvoice'=>$langs->trans("GenerateBill"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + //if ($user->rights->projet->creer) $arrayofmassactions['predelete']=''.$langs->trans("Delete"); + if (in_array($massaction, array('presend', 'predelete', 'generateinvoice'))) $arrayofmassactions = array(); + $massactionbutton = $form->selectMassAction('', $arrayofmassactions); } // Show section with information of task. If id of task is not defined and project id defined, then $projectidforalltimes is not empty. @@ -762,17 +762,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Project if (empty($withproject)) { - $morehtmlref .= '
'; - $morehtmlref .= $langs->trans("Project").': '; - $morehtmlref .= $projectstatic->getNomUrl(1); - $morehtmlref .= '
'; + $morehtmlref .= '
'; + $morehtmlref .= $langs->trans("Project").': '; + $morehtmlref .= $projectstatic->getNomUrl(1); + $morehtmlref .= '
'; - // Third party - $morehtmlref .= $langs->trans("ThirdParty").': '; - if (is_object($projectstatic->thirdparty)) { - $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); - } - $morehtmlref .= '
'; + // Third party + $morehtmlref .= $langs->trans("ThirdParty").': '; + if (is_object($projectstatic->thirdparty)) { + $morehtmlref .= $projectstatic->thirdparty->getNomUrl(1); + } + $morehtmlref .= '
'; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -780,7 +780,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; print '
'; - print '
'; + print '
'; print ''; // Date start - Date end @@ -846,127 +846,127 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print $form->formconfirm($_SERVER["PHP_SELF"]."?".($object->id > 0 ? "id=".$object->id : 'projectid='.$projectstatic->id).'&lineid='.GETPOST('lineid', 'int').($withproject ? '&withproject=1' : ''), $langs->trans("DeleteATimeSpent"), $langs->trans("ConfirmDeleteATimeSpent"), "confirm_delete", '', '', 1); } - // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array - $hookmanager->initHooks(array('tasktimelist')); + // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array + $hookmanager->initHooks(array('tasktimelist')); - // Definition of fields for list - $arrayfields = array(); - $arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); - $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); - } - $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); - $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); - $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); - $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1)); - $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time)); - // Extra fields - if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) - { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); - } - } - $arrayfields = dol_sort_array($arrayfields, 'position'); + // Definition of fields for list + $arrayfields = array(); + $arrayfields['t.task_date'] = array('label'=>$langs->trans("Date"), 'checked'=>1); + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + $arrayfields['t.task_ref'] = array('label'=>$langs->trans("RefTask"), 'checked'=>1); + $arrayfields['t.task_label'] = array('label'=>$langs->trans("LabelTask"), 'checked'=>1); + } + $arrayfields['author'] = array('label'=>$langs->trans("By"), 'checked'=>1); + $arrayfields['t.note'] = array('label'=>$langs->trans("Note"), 'checked'=>1); + $arrayfields['t.task_duration'] = array('label'=>$langs->trans("Duration"), 'checked'=>1); + $arrayfields['value'] = array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled) ? 0 : 1)); + $arrayfields['valuebilled'] = array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((!empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT)) ? 0 : 1) && $projectstatic->usage_bill_time)); + // Extra fields + if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) + { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) + $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + } + } + $arrayfields = dol_sort_array($arrayfields, 'position'); - $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); - if ($search_month > 0) $param .= '&search_month='.urlencode($search_month); - if ($search_year > 0) $param .= '&search_year='.urlencode($search_year); - if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); - if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_task_ref); - if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_task_label); - if ($search_note != '') $param .= '&search_note='.urlencode($search_note); - if ($search_duration != '') $param .= '&search_field2='.urlencode($search_duration); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); - /* - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - */ - if ($id) $param .= '&id='.urlencode($id); - if ($projectid) $param .= '&projectid='.urlencode($projectid); - if ($withproject) $param .= '&withproject='.urlencode($withproject); + $param = ''; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($search_month > 0) $param .= '&search_month='.urlencode($search_month); + if ($search_year > 0) $param .= '&search_year='.urlencode($search_year); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_task_ref != '') $param .= '&search_task_ref='.urlencode($search_task_ref); + if ($search_task_label != '') $param .= '&search_task_label='.urlencode($search_task_label); + if ($search_note != '') $param .= '&search_note='.urlencode($search_note); + if ($search_duration != '') $param .= '&search_field2='.urlencode($search_duration); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + /* + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + */ + if ($id) $param .= '&id='.urlencode($id); + if ($projectid) $param .= '&projectid='.urlencode($projectid); + if ($withproject) $param .= '&withproject='.urlencode($withproject); - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - if ($action == 'editline') print ''; - elseif ($action == 'splitline') print ''; - elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; - elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; - else print ''; - print ''; - print ''; - print ''; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + if ($action == 'editline') print ''; + elseif ($action == 'splitline') print ''; + elseif ($action == 'createtime' && $user->rights->projet->lire) print ''; + elseif ($massaction == 'generateinvoice' && $user->rights->facture->lire) print ''; + else print ''; + print ''; + print ''; + print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; - if ($massaction == 'generateinvoice') - { - //var_dump($_REQUEST); - print ''; + if ($massaction == 'generateinvoice') + { + //var_dump($_REQUEST); + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if ($conf->service->enabled) - { - print ''; - print ''; - print ''; - print ''; - } - /*print ''; - print ''; - print ''; - print '';*/ - print '
'; - print $langs->trans('DateInvoice'); - print ''; - print $form->selectDate('', '', '', '', '', '', 1, 1); - print '
'; - print $langs->trans('Mode'); - print ''; - $tmparray = array( - 'onelineperuser'=>'OneLinePerUser', - 'onelinepertask'=>'OneLinePerTask', - 'onelineperperiod'=>'OneLinePerPeriod', - ); - print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); - print '
'; - print $langs->trans('ServiceToUseOnLines'); - print ''; - $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); - print '
'; - print $langs->trans('ValidateInvoices'); - print ''; - print $form->selectyesno('validate_invoices', 0, 1); - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($conf->service->enabled) + { + print ''; + print ''; + print ''; + print ''; + } + /*print ''; + print ''; + print ''; + print '';*/ + print '
'; + print $langs->trans('DateInvoice'); + print ''; + print $form->selectDate('', '', '', '', '', '', 1, 1); + print '
'; + print $langs->trans('Mode'); + print ''; + $tmparray = array( + 'onelineperuser'=>'OneLinePerUser', + 'onelinepertask'=>'OneLinePerTask', + 'onelineperperiod'=>'OneLinePerPeriod', + ); + print $form->selectarray('generateinvoicemode', $tmparray, 'onelineperuser', 0, 0, 0, '', 1); + print '
'; + print $langs->trans('ServiceToUseOnLines'); + print ''; + $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500'); + print '
'; + print $langs->trans('ValidateInvoices'); + print ''; + print $form->selectyesno('validate_invoices', 0, 1); + print '
'; - print '
'; - print '
'; - print ' '; - print ''; - print '
'; - print '
'; - } + print '
'; + print '
'; + print ' '; + print ''; + print '
'; + print '
'; + } /* - * List of time spent + * List of time spent */ $tasks = array(); @@ -995,31 +995,31 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); - if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 - { - $page = 0; - $offset = 0; - } + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } } // if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { - $num = $nbtotalofrecords; + $num = $nbtotalofrecords; } else { - $sql .= $db->plimit($limit + 1, $offset); + $sql .= $db->plimit($limit + 1, $offset); - $resql = $db->query($sql); - if (!$resql) - { - dol_print_error($db); - exit; - } + $resql = $db->query($sql); + if (!$resql) + { + dol_print_error($db); + exit; + } - $num = $db->num_rows($resql); + $num = $db->num_rows($resql); } if ($num >= 0) @@ -1034,11 +1034,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { - print ''."\n"; + print ''."\n"; - $title = $langs->trans("ListTaskTimeForTask"); + $title = $langs->trans("ListTaskTimeForTask"); - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $linktocreatetime, '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $linktocreatetime, '', $limit); } $i = 0; @@ -1061,9 +1061,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'createtime' && $user->rights->projet->lire) { print ''."\n"; - if (!empty($id)) print ''; + if (!empty($id)) print ''; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -1075,7 +1075,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print ''; + print ''; } print ''; print "\n"; @@ -1092,9 +1092,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Task if (empty($id)) { - print ''; + print ''; } // Contributor @@ -1138,8 +1138,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Invoiced if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { - print ''; + print ''; } print ''; print ''; print ''; - print ''; // Fields title label // -------------------------------------------------------------------- @@ -199,7 +199,9 @@ if ($resql) print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "l.datestart", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "l.dateend", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "l.paid", "", $param, '', $sortfield, $sortorder, 'right '); - print_liste_field_titre(''); + print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); + print "\n"; + print "\n"; // Loop on record @@ -210,7 +212,7 @@ if ($resql) { $obj = $db->fetch_object($resql); if (empty($obj)) break; // Should not happen - + $loan_static->id = $obj->rowid; $loan_static->ref = $obj->rowid; $loan_static->label = $obj->label; @@ -252,12 +254,12 @@ if ($resql) $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - + print '
'.$langs->trans("ProgressDeclared").'
'; - $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); - print ''; + $formproject->selectTasks(-1, GETPOST('taskid', 'int'), 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); + print ''; - print ''; + print ''; @@ -1163,16 +1163,16 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; + print '
'; + print $moreforfilter; + print '
'; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= (is_array($arrayofmassactions) && count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - print '
'; + print '
'; print ''."\n"; // Fields title search @@ -1186,23 +1186,23 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $formother->select_year($search_year, 'search_year', 1, 20, 5); print ''; } - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - if (!empty($arrayfields['t.task_ref']['checked'])) print ''; - if (!empty($arrayfields['t.task_label']['checked'])) print ''; - } - // Author - if (!empty($arrayfields['author']['checked'])) print ''; + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + if (!empty($arrayfields['t.task_ref']['checked'])) print ''; + if (!empty($arrayfields['t.task_label']['checked'])) print ''; + } + // Author + if (!empty($arrayfields['author']['checked'])) print ''; // Note - if (!empty($arrayfields['t.note']['checked'])) print ''; + if (!empty($arrayfields['t.note']['checked'])) print ''; // Duration - if (!empty($arrayfields['t.task_duration']['checked'])) print ''; + if (!empty($arrayfields['t.task_duration']['checked'])) print ''; // Value in main currency - if (!empty($arrayfields['value']['checked'])) print ''; - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) print ''; + if (!empty($arrayfields['value']['checked'])) print ''; + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) print ''; - /* + /* // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; */ @@ -1218,26 +1218,26 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''."\n"; print ''; - if (!empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - if (!empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'], $_SERVER['PHP_SELF'], 'pt.ref', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'], $_SERVER['PHP_SELF'], 'pt.label', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); - if (!empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.task_date']['checked'])) print_liste_field_titre($arrayfields['t.task_date']['label'], $_SERVER['PHP_SELF'], 't.task_date,t.task_datehour,t.rowid', '', $param, '', $sortfield, $sortorder); + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + if (!empty($arrayfields['t.task_ref']['checked'])) print_liste_field_titre($arrayfields['t.task_ref']['label'], $_SERVER['PHP_SELF'], 'pt.ref', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.task_label']['checked'])) print_liste_field_titre($arrayfields['t.task_label']['label'], $_SERVER['PHP_SELF'], 'pt.label', '', $param, '', $sortfield, $sortorder); + } + if (!empty($arrayfields['author']['checked'])) print_liste_field_titre($arrayfields['author']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder); + if (!empty($arrayfields['t.note']['checked'])) print_liste_field_titre($arrayfields['t.note']['label'], $_SERVER['PHP_SELF'], 't.note', '', $param, '', $sortfield, $sortorder); if (!empty($arrayfields['t.task_duration']['checked'])) print_liste_field_titre($arrayfields['t.task_duration']['label'], $_SERVER['PHP_SELF'], 't.task_duration', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); + if (!empty($arrayfields['value']['checked'])) print_liste_field_titre($arrayfields['value']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'right '); + if (!empty($arrayfields['valuebilled']['checked'])) print_liste_field_titre($arrayfields['valuebilled']['label'], $_SERVER['PHP_SELF'], 'il.total_ht', '', $param, '', $sortfield, $sortorder, 'center '); /* - // Extra fields + // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; */ - // Hook fields + // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'width="80"', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; $tasktmp = new Task($db); @@ -1252,7 +1252,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $totalarray = array(); foreach ($tasks as $task_time) { - if ($i >= $limit) break; + if ($i >= $limit) break; print ''; @@ -1262,125 +1262,125 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) // Date if (!empty($arrayfields['t.task_date']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) $totalarray['nbfield']++; } // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - } + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + } // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - } + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - } - elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + } + elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; - $totalarray['val']['t.task_duration'] += $task_time->task_duration; - if (!$i) $totalarray['totaldurationfield'] = $totalarray['nbfield']; - $totalarray['totalduration'] += $task_time->task_duration; - } + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.task_duration'; + $totalarray['val']['t.task_duration'] += $task_time->task_duration; + if (!$i) $totalarray['totaldurationfield'] = $totalarray['nbfield']; + $totalarray['totalduration'] += $task_time->task_duration; + } // Value spent - if (!empty($arrayfields['value']['checked'])) - { + if (!empty($arrayfields['value']['checked'])) + { print ''; - if (!$i) $totalarray['nbfield']++; - if (!$i) $totalarray['totalvaluebilledfield'] = $totalarray['nbfield']; - $totalarray['totalvaluebilled'] += $valuebilled; - } + // Invoiced + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + if (!$i) $totalarray['nbfield']++; + if (!$i) $totalarray['totalvaluebilledfield'] = $totalarray['nbfield']; + $totalarray['totalvaluebilled'] += $valuebilled; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - // Action column + // Action column print ''; - if (!$i) $totalarray['nbfield']++; + print ''; + if (!$i) $totalarray['nbfield']++; print "\n"; @@ -1483,298 +1483,298 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { - print ''; + print ''; - // Date - if (!empty($arrayfields['t.task_date']['checked'])) - { - print ''; - } + // Date + if (!empty($arrayfields['t.task_date']['checked'])) + { + print ''; + } - // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task ref + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task label + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + } - // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + // Note + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + } + elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } - // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - } + // Time spent + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + } - // Value spent - if (!empty($arrayfields['value']['checked'])) - { - print ''; - } + // Value spent + if (!empty($arrayfields['value']['checked'])) + { + print ''; + } - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; - } + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Action column - print ''; + // Action column + print ''; - print "\n"; + print "\n"; - // Line for second dispatching + // Line for second dispatching - print ''; + print ''; - // Date - if (!empty($arrayfields['t.task_date']['checked'])) - { - print ''; - } + // Date + if (!empty($arrayfields['t.task_date']['checked'])) + { + print ''; + } - // Task ref - if (!empty($arrayfields['t.task_ref']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task ref + if (!empty($arrayfields['t.task_ref']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // Task label - if (!empty($arrayfields['t.task_label']['checked'])) - { - if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task - { - print ''; - } - } + // Task label + if (!empty($arrayfields['t.task_label']['checked'])) + { + if ((empty($id) && empty($ref)) || !empty($projectidforalltimes)) // Not a dedicated task + { + print ''; + } + } - // User - if (!empty($arrayfields['author']['checked'])) - { - print ''; - } + // User + if (!empty($arrayfields['author']['checked'])) + { + print ''; + } - // Note - if (!empty($arrayfields['t.note']['checked'])) - { - print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } + // Note + if (!empty($arrayfields['t.note']['checked'])) + { + print ''; + } + elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } - // Time spent - if (!empty($arrayfields['t.task_duration']['checked'])) - { - print ''; - } + // Time spent + if (!empty($arrayfields['t.task_duration']['checked'])) + { + print ''; + } - // Value spent - if (!empty($arrayfields['value']['checked'])) - { - print ''; - } + // Value spent + if (!empty($arrayfields['value']['checked'])) + { + print ''; + } - // Value billed - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; - } + // Value billed + if (!empty($arrayfields['valuebilled']['checked'])) + { + print ''; + } - /* - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - */ + /* + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + */ - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$task_time); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; - // Action column - print ''; + // Action column + print ''; - print "\n"; + print "\n"; } $i++; From 458c1e2174c5a9af21e7830e625682656a020002 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 29 Dec 2019 19:58:38 +0000 Subject: [PATCH 035/105] Fixing style errors. --- htdocs/projet/tasks/time.php | 228 +++++++++++++++++------------------ 1 file changed, 114 insertions(+), 114 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 98bd7523605..1f692386c74 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -375,132 +375,132 @@ if ($action == 'confirm_generateinvoice') if (!$error) { - if ($generateinvoicemode=='onelineperuser') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); - } - - foreach ($arrayoftasks as $userid => $value) - { - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); - - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + if ($generateinvoicemode=='onelineperuser') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_fk_user]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->timespent_fk_user]['totalvaluetodivideby3600'] += ($object->timespent_duration * $object->timespent_thm); } - // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $userid => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } - elseif ($generateinvoicemode=='onelineperperiod') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; - $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; - $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; - $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; - } - - foreach ($arrayoftasks as $timespent_id => $value) - { - $userid = $value['user']; - $fuser->fetch($userid); - //$pu_ht = $value['timespent'] * $fuser->thm; - $username = $fuser->getFullName($langs); - - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + elseif ($generateinvoicemode=='onelineperperiod') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + $arrayoftasks[$object->timespent_id]['timespent'] = $object->timespent_duration; + $arrayoftasks[$object->timespent_id]['totalvaluetodivideby3600'] = $object->timespent_duration * $object->timespent_thm; + $arrayoftasks[$object->timespent_id]['note'] = $object->timespent_note; + $arrayoftasks[$object->timespent_id]['user'] = $object->timespent_fk_user; } - // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $timespent_id => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $userid = $value['user']; + $fuser->fetch($userid); + //$pu_ht = $value['timespent'] * $fuser->thm; + $username = $fuser->getFullName($langs); + + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).') AND fk_user = '.$userid; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } - elseif ($generateinvoicemode=='onelinepertask') { - $arrayoftasks = array(); - foreach ($toselect as $key => $value) - { - // Get userid, timepent - $object->fetchTimeSpent($value); - // $object->id is the task id - $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; - $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; - } - - foreach ($arrayoftasks as $task_id => $value) - { - $ftask = new Task($db); - $ftask->fetch($task_id); - // Define qty per hour - $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - - // If no unit price known - if (empty($pu_ht)) - { - $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + elseif ($generateinvoicemode=='onelinepertask') { + $arrayoftasks = array(); + foreach ($toselect as $key => $value) + { + // Get userid, timepent + $object->fetchTimeSpent($value); + // $object->id is the task id + $arrayoftasks[$object->id]['timespent'] += $object->timespent_duration; + $arrayoftasks[$object->id]['totalvaluetodivideby3600'] += $object->timespent_duration * $object->timespent_thm; } - // Add lines - $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); - - // Update lineid into line of timespent - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; - $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; - $result = $db->query($sql); - if (!$result) + foreach ($arrayoftasks as $task_id => $value) { - $error++; - setEventMessages($db->lasterror(), null, 'errors'); - break; + $ftask = new Task($db); + $ftask->fetch($task_id); + // Define qty per hour + $qtyhour = round($value['timespent'] / 3600, 2); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + + // If no unit price known + if (empty($pu_ht)) + { + $pu_ht = price2num($value['totalvaluetodivideby3600'] / 3600, 'MU'); + } + + // Add lines + $lineName = $ftask->ref.' - '.$ftask->label; + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + + // Update lineid into line of timespent + $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; + $sql .= ' WHERE rowid in ('.join(',', $toselect).')'; + $result = $db->query($sql); + if (!$result) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + break; + } } - } - } + } } if (!$error) From 4f65f8d0950d07f3bc78e772526e55b8364878a5 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 14:13:26 +0100 Subject: [PATCH 036/105] Fixed bug (missing include) in formmargin.class.php, affecting display of propal --- htdocs/core/class/html.formmargin.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 345a94b3a62..1f091fc81fd 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -21,6 +21,8 @@ * \brief Fichier de la classe des fonctions predefinie de composants html autre */ +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + /** * Classe permettant la generation de composants html autre From e9e0aae1ce8634cf1b2769404734bde76d2669c1 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 14:59:53 +0100 Subject: [PATCH 037/105] Added option to bill time spent on a task to an existing draft invoice (for instance a recurrent bill) --- htdocs/core/class/html.form.class.php | 167 ++++++++++++++++++++++++++ htdocs/projet/tasks/time.php | 27 ++++- 2 files changed, 188 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6b0950b4f8d..4681a9f749a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7839,4 +7839,171 @@ class Form return $out; } + + /** + * Output a combo list with invoices qualified for a third party + * + * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) + * @param int $selected Id invoice preselected + * @param string $htmlname Name of HTML select + * @param int $maxlength Maximum length of label + * @param int $option_only Return only html options lines without the select tag + * @param string $show_empty Add an empty line ('1' or string to show for empty line) + * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled + * @param string $morecss More css added to the select component + * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. + * @param string $showproject 'all' = Show project info, ''=Hide project info + * @param User $usertofilter User object to use for filtering + * @return int Nbr of project if OK, <0 if KO + */ + public function selectInvoice($socid = -1, $selected = '', $htmlname = 'invoiceid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) + { + global $user,$conf,$langs; + + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + + if (is_null($usertofilter)) + { + $usertofilter = $user; + } + + $out=''; + + $hideunselectables = false; + if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true; + + if (empty($projectsListId)) + { + if (empty($usertofilter->rights->projet->all->lire)) + { + $projectstatic=new Project($this->db); + $projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1); + } + } + + // Search all projects + $sql = 'SELECT f.rowid, f.ref as fref, "nolabel" as flabel, p.rowid as pid, f.ref, + p.title, p.fk_soc, p.fk_statut, p.public,'; + $sql.= ' s.nom as name'; + $sql.= ' FROM '.MAIN_DB_PREFIX .'projet as p'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc,'; + $sql.= ' '.MAIN_DB_PREFIX.'facture as f'; + $sql.= " WHERE p.entity IN (".getEntity('project').")"; + $sql.= " AND f.fk_projet = p.rowid AND f.fk_statut=0"; //Brouillons seulement + //if ($projectsListId) $sql.= " AND p.rowid IN (".$projectsListId.")"; + //if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; + //if ($socid > 0) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + $sql.= " GROUP BY f.ref ORDER BY p.ref, f.ref ASC"; + + $resql=$this->db->query($sql); + if ($resql) + { + // Use select2 selector + if (! empty($conf->use_javascript_ajax)) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $out.=$comboenhancement; + $morecss='minwidth200imp maxwidth500'; + } + + if (empty($option_only)) { + $out.= ''; + } + + print $out; + + $this->db->free($resql); + return $num; + } + else + { + dol_print_error($this->db); + return -1; + } + } } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 1f692386c74..485ba8bf173 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -343,6 +343,7 @@ if ($action == 'confirm_generateinvoice') $db->begin(); $idprod = GETPOST('productid', 'int'); $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); + $invoiceToUse = GETPOST('invoiceid', 'int'); if ($idprod > 0) { @@ -366,12 +367,17 @@ if ($action == 'confirm_generateinvoice') $tmpinvoice->date = dol_mktime(GETPOST('rehour', 'int'), GETPOST('remin', 'int'), GETPOST('resec', 'int'), GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $tmpinvoice->fk_project = $projectstatic->id; - $result = $tmpinvoice->create($user); - if ($result <= 0) - { - $error++; - setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); - } + if ($invoiceToUse) { + $tmpinvoice->fetch($invoiceToUse); + } + else { + $result = $tmpinvoice->create($user); + if ($result <= 0) + { + $error++; + setEventMessages($tmpinvoice->error, $tmpinvoice->errors, 'errors'); + } + } if (!$error) { @@ -947,6 +953,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print ''; } + print ''; + print ''; + print ''; + print ''; /*print ''; print ''; print ''; print ''; /*print ''; From 19e69dc8690caa0a507b8d861f3358fa1f2fe7a3 Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Thu, 2 Jan 2020 15:18:18 +0100 Subject: [PATCH 039/105] Creating invoice from time spent now takes in to account the product duration to compute the quantity to bill --- htdocs/projet/tasks/time.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 485ba8bf173..e803d86f388 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -345,9 +345,23 @@ if ($action == 'confirm_generateinvoice') $generateinvoicemode = GETPOST('generateinvoicemode', 'string'); $invoiceToUse = GETPOST('invoiceid', 'int'); + $prodDurationHours = 1.0; if ($idprod > 0) { $tmpproduct->fetch($idprod); + if ($tmpproduct->duration_unit=='i') + $prodDurationHours = 1./60; + if ($tmpproduct->duration_unit=='h') + $prodDurationHours = 1.; + if ($tmpproduct->duration_unit=='d') + $prodDurationHours = 24.; + if ($tmpproduct->duration_unit=='w') + $prodDurationHours = 24.*7; + if ($tmpproduct->duration_unit=='m') + $prodDurationHours = 24.*30; + if ($tmpproduct->duration_unit=='y') + $prodDurationHours = 24.*365; + $prodDurationHours *= $tmpproduct->duration_value; $dataforprice = $tmpproduct->getSellPrice($mysoc, $projectstatic->thirdparty, 0); $pu_ht = empty($dataforprice['pu_ht']) ? 0 : $dataforprice['pu_ht']; @@ -408,7 +422,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -452,7 +466,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -493,7 +507,7 @@ if ($action == 'confirm_generateinvoice') // Add lines $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($lineName, $pu_ht, $qtyhour/$prodDurationHours, $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; From 2c68b08e4f1759705c51ba9c195cc3abd202c742 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jan 2020 14:27:35 +0000 Subject: [PATCH 040/105] Fixing style errors. --- htdocs/projet/tasks/time.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index d08c7d4706d..7e16c83a71a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -422,7 +422,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($langs->trans("TimeSpentForInvoice", $username).' : '.$qtyhourtext, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -466,7 +466,7 @@ if ($action == 'confirm_generateinvoice') } // Add lines - $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($value['note'], $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; @@ -507,7 +507,7 @@ if ($action == 'confirm_generateinvoice') // Add lines $lineName = $ftask->ref.' - '.$ftask->label; - $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours,2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); + $lineid = $tmpinvoice->addline($lineName, $pu_ht, round($qtyhour/$prodDurationHours, 2), $txtva, $localtax1, $localtax2, ($idprod > 0 ? $idprod : 0)); // Update lineid into line of timespent $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time SET invoice_line_id = '.$lineid.', invoice_id = '.$tmpinvoice->id; From d13e1ddcdf7d2b89fdc372a149679913173367ba Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Fri, 3 Jan 2020 11:21:33 +0100 Subject: [PATCH 041/105] Add document date instead of creation date when exporting FEC file --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f36b98b15b1..e049d2b5bad 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -718,7 +718,7 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_creation.$separator; + print $date_doc.$separator; // FEC:CompteNum print $line->numero_compte.$separator; From 72b7e72f735aa6fdb048842f68c579f1b9d0402b Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Fri, 3 Jan 2020 16:20:29 +0100 Subject: [PATCH 042/105] Dates YYMMDD dans l'export FEC --- htdocs/accountancy/class/accountancyexport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index e049d2b5bad..a702244b65b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -704,9 +704,9 @@ class AccountancyExport print $end_line; foreach ($objectLines as $line) { - $date_creation = dol_print_date($line->date_creation, '%d%m%Y'); - $date_doc = dol_print_date($line->doc_date, '%d%m%Y'); - $date_valid = dol_print_date($line->date_validated, '%d%m%Y'); + $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); + $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal.$separator; From 5b1e3908ca8fac46bb2e7a558d5e22dfbd312172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 4 Jan 2020 10:19:54 +0100 Subject: [PATCH 043/105] move migration from 10-11 to 11-12 --- .../install/mysql/migration/10.0.0-11.0.0.sql | 17 ++--------------- .../install/mysql/migration/11.0.0-12.0.0.sql | 13 +++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 0cc3a4411f9..1709dde91f0 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -73,7 +73,7 @@ UPDATE llx_holiday SET ref = rowid WHERE ref IS NULL; -- VPGSQL8.2 ALTER TABLE llx_holiday ALTER COLUMN ref SET NOT NULL; ALTER TABLE llx_c_email_senderprofile MODIFY COLUMN active tinyint DEFAULT 1 NOT NULL; - + insert into llx_c_type_container (code,label,module,active) values ('menu', 'Menu', 'system', 1); INSERT INTO llx_c_ticket_type (code, pos, label, active, use_default, description) VALUES('HELP', '15', 'Request for functionnal help', 1, 0, NULL); @@ -527,19 +527,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value ALTER TABLE llx_comment ADD COLUMN fk_user_modif integer DEFAULT NULL; -CREATE TABLE llx_categorie_actioncomm -( - fk_categorie integer NOT NULL, - fk_actioncomm integer NOT NULL, - import_key varchar(14) -) ENGINE=innodb; - -ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); -ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); -ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); - -ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); -ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); CREATE TABLE llx_mrp_production( rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, @@ -549,7 +536,7 @@ CREATE TABLE llx_mrp_production( fk_warehouse integer, qty integer NOT NULL DEFAULT 1, qty_frozen smallint DEFAULT 0, - disable_stock_change smallint DEFAULT 0, + disable_stock_change smallint DEFAULT 0, batch varchar(30), role varchar(10), -- 'toconsume' or 'toproduce' (initialized at MO creation), 'consumed' or 'produced' (added after MO validation) fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce' diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index b0ecc2b9639..5d647d610c5 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -52,6 +52,19 @@ create table llx_object_lang ALTER TABLE llx_object_lang ADD UNIQUE INDEX uk_object_lang (fk_object, type_object, property, lang); +CREATE TABLE llx_categorie_actioncomm +( + fk_categorie integer NOT NULL, + fk_actioncomm integer NOT NULL, + import_key varchar(14) +) ENGINE=innodb; + +ALTER TABLE llx_categorie_actioncomm ADD PRIMARY KEY pk_categorie_actioncomm (fk_categorie, fk_actioncomm); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_actioncomm ADD INDEX idx_categorie_actioncomm_fk_actioncomm (fk_actioncomm); + +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_actioncomm ADD CONSTRAINT fk_categorie_actioncomm_fk_actioncomm FOREIGN KEY (fk_actioncomm) REFERENCES llx_actioncomm (id); From 9ceec670b9300319315b1ed9b1b3c7ca0729d398 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 13:52:48 +0100 Subject: [PATCH 044/105] Fix date format in FEC export --- htdocs/accountancy/class/accountancyexport.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index f36b98b15b1..46b7a532a35 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -704,9 +704,9 @@ class AccountancyExport print $end_line; foreach ($objectLines as $line) { - $date_creation = dol_print_date($line->date_creation, '%d%m%Y'); - $date_doc = dol_print_date($line->doc_date, '%d%m%Y'); - $date_valid = dol_print_date($line->date_validated, '%d%m%Y'); + $date_creation = dol_print_date($line->date_creation, '%Y%m%d'); + $date_doc = dol_print_date($line->doc_date, '%Y%m%d'); + $date_valid = dol_print_date($line->date_validated, '%Y%m%d'); // FEC:JournalCode print $line->code_journal.$separator; From b6ed6df75d89e6ec55f1fb55a823f24a1563441b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 14:14:51 +0100 Subject: [PATCH 045/105] Remove property tha has no sense in output #12803 --- htdocs/societe/class/api_thirdparties.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c855346dbec..07dd2ba6031 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1685,6 +1685,8 @@ class Thirdparties extends DolibarrApi unset($object->particulier); unset($object->prefix_comm); + unset($object->commercial_id); // This property is used in create/update only. It does not exists in read mode because there is several sales representatives. + unset($object->total_ht); unset($object->total_tva); unset($object->total_localtax1); From 9d4e1a3941d0d1a099193f96cdb91474a70aa04a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 14:25:48 +0100 Subject: [PATCH 046/105] FIX #12797 --- htdocs/core/lib/functions.lib.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8980f2a41dd..861b49adde2 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1639,13 +1639,14 @@ function dol_bc($var, $moreclass = '') } /** - * Return a formated address (part address/zip/town/state) according to country rules + * Return a formated address (part address/zip/town/state) according to country rules. + * See https://en.wikipedia.org/wiki/Address * * @param Object $object A company or contact object - * @param int $withcountry 1=Add country into address string - * @param string $sep Separator to use to build string - * @param Translate $outputlangs Object lang that contains language for text translation. - * @param int $mode 0=Standard output, 1=Remove address + * @param int $withcountry 1=Add country into address string + * @param string $sep Separator to use to build string + * @param Translate $outputlangs Object lang that contains language for text translation. + * @param int $mode 0=Standard output, 1=Remove address * @return string Formated string * @see dol_print_address() */ @@ -1656,6 +1657,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $ret = ''; $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS + // See format of addresses on https://en.wikipedia.org/wiki/Address + // Address if (empty($mode)) { $ret .= $object->address; @@ -1692,7 +1695,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs { $ret .= ($ret ? $sep : '').$object->zip; $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); - $ret .= ($object->state_id ? (' ('.($object->state_id).')') : ''); + $ret .= ($object->state_code ? (' '.($object->state_code)) : ''); } else // Other: title firstname name \n address lines \n zip town \n country { From b7e4d4904fb302ca3080f26c1d2b2abe31b1c22c Mon Sep 17 00:00:00 2001 From: Guillaume Matheron Date: Mon, 13 Jan 2020 14:34:38 +0100 Subject: [PATCH 047/105] Revert "Add document date instead of creation date when exporting FEC file" This reverts commit d13e1ddcdf7d2b89fdc372a149679913173367ba. --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index a702244b65b..46b7a532a35 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -718,7 +718,7 @@ class AccountancyExport print $line->piece_num.$separator; // FEC:EcritureDate - print $date_doc.$separator; + print $date_creation.$separator; // FEC:CompteNum print $line->numero_compte.$separator; From ab4e0fe99cddfcd3c5c7b62025aa6e2de36edfc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 14:30:37 +0100 Subject: [PATCH 048/105] FIX #12758 --- build/generate_filelist_xml.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 59a39416b28..976f2cb6ba3 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -146,7 +146,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1); $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); */ $regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir=''; $needtoclose=0; From 68169b6df045de3f0b8424c27f8fd644318a700f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 14:43:27 +0100 Subject: [PATCH 049/105] Fix debian package --- build/debian/source/include-binaries | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/debian/source/include-binaries b/build/debian/source/include-binaries index 401eae93712..021641d5c04 100644 --- a/build/debian/source/include-binaries +++ b/build/debian/source/include-binaries @@ -1 +1,2 @@ -htdocs/install/doctemplates/websites/website_template-corporate.zip \ No newline at end of file +htdocs/install/doctemplates/websites/website_template-corporate.zip +htdocs/install/doctemplates/websites/website_template-stellar.zip \ No newline at end of file From 56fb6dce6199a36a3e6780ce517058bbb1406cdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 15:32:11 +0100 Subject: [PATCH 050/105] FIX #12756 --- htdocs/core/modules/modExpedition.class.php | 14 +++++++------- htdocs/core/modules/modSupplierProposal.class.php | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 96d3d3f45a5..93cd08c7001 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -65,8 +65,8 @@ class modExpedition extends DolibarrModules "/expedition/sending/temp", "/expedition/receipt", "/expedition/receipt/temp", - "/doctemplates/shipment", - "/doctemplates/delivery" + "/doctemplates/shipments", + "/doctemplates/deliveries" ); // Config pages @@ -98,7 +98,7 @@ class modExpedition extends DolibarrModules $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipments"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -119,7 +119,7 @@ class modExpedition extends DolibarrModules $this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/deliveries"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; $r++; @@ -127,7 +127,7 @@ class modExpedition extends DolibarrModules $this->const[$r][0] = "MAIN_SUBMODULE_EXPEDITION"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "1"; - $this->const[$r][3] = "Enable shipments"; + $this->const[$r][3] = "Enable delivery receipts"; $this->const[$r][4] = 0; $r++; @@ -326,8 +326,8 @@ class modExpedition extends DolibarrModules $this->remove($options); //ODT template - $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipment/template_shipment.odt'; - $dirodt = DOL_DATA_ROOT.'/doctemplates/shipment'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/shipments/template_shipment.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/shipments'; $dest = $dirodt.'/template_shipment.odt'; if (file_exists($src) && !file_exists($dest)) diff --git a/htdocs/core/modules/modSupplierProposal.class.php b/htdocs/core/modules/modSupplierProposal.class.php index c24c3787a9c..e2d071ac730 100644 --- a/htdocs/core/modules/modSupplierProposal.class.php +++ b/htdocs/core/modules/modSupplierProposal.class.php @@ -93,7 +93,7 @@ class modSupplierProposal extends DolibarrModules $this->const[$r][0] = "SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposal"; + $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/supplier_proposals"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; @@ -215,8 +215,8 @@ class modSupplierProposal extends DolibarrModules $this->remove($options); //ODT template - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposal/template_supplier_proposal.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposal'; + $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/supplier_proposals/template_supplier_proposal.odt'; + $dirodt=DOL_DATA_ROOT.'/doctemplates/supplier_proposals'; $dest=$dirodt.'/template_supplier_proposal.odt'; if (file_exists($src) && ! file_exists($dest)) From e2e06b47fff965cf4833ebc2f233fde0f5942e63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 13 Jan 2020 15:58:03 +0100 Subject: [PATCH 051/105] FIX #12617 --- htdocs/commande/class/commande.class.php | 1 + htdocs/contrat/card.php | 14 +++++++------- htdocs/contrat/class/contrat.class.php | 23 ++++++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ef15d983d20..a21e9534f49 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1447,6 +1447,7 @@ class Commande extends CommonOrder $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->thirdparty, $mysoc); // Clean vat code + $reg = array(); $vat_src_code = ''; if (preg_match('/\((.*)\)/', $txtva, $reg)) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index e61b0077ef7..9342a81395b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2019 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2010-2017 Juanjo Menent @@ -417,12 +417,12 @@ if (empty($reshook)) // Set if we used free entry or predefined product $predef = ''; $product_desc = (GETPOST('dp_desc') ?GETPOST('dp_desc') : ''); - $price_ht = GETPOST('price_ht'); - $price_ht_devise = GETPOST('multicurrency_price_ht'); - if (GETPOST('prod_entry_mode') == 'free') + $price_ht = price2num(GETPOST('price_ht')); + $price_ht_devise = price2num(GETPOST('multicurrency_price_ht')); + if (GETPOST('prod_entry_mode', 'alpha') == 'free') { $idprod = 0; - $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); + $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } else { @@ -430,7 +430,7 @@ if (empty($reshook)) $tva_tx = ''; } - $qty = GETPOST('qty'.$predef); + $qty = price2num(GETPOST('qty'.$predef)); $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); if ($qty == '') @@ -438,7 +438,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors'); $error++; } - if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) + if (GETPOST('prod_entry_mode', 'alpha') == 'free' && empty($idprod) && empty($product_desc)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors'); $error++; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 89ee93a39e8..ead2e1c816b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1421,9 +1421,18 @@ class Contrat extends CommonObject $pu_ht = price2num($pu_ht); $pu_ttc = price2num($pu_ttc); $pa_ht = price2num($pa_ht); - if (!preg_match('/\((.*)\)/', $txtva)) { - $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' + + // Clean vat code + $reg = array(); + $vat_src_code = ''; + if (preg_match('/\((.*)\)/', $txtva, $reg)) + { + $vat_src_code = $reg[1]; + $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } + + $txtva = price2num($txtva); + $txlocaltax1 = price2num($txlocaltax1); $txlocaltax2 = price2num($txlocaltax2); $remise_percent = price2num($remise_percent); @@ -1456,15 +1465,7 @@ class Contrat extends CommonObject $this->db->begin(); - $localtaxes_type = getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); - - // Clean vat code - $vat_src_code = ''; - if (preg_match('/\((.*)\)/', $txtva, $reg)) - { - $vat_src_code = $reg[1]; - $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. - } + $localtaxes_type = getLocalTaxesFromRate($txtva.($vat_src_code ? ' ('.$vat_src_code.')' : ''), 0, $this->societe, $mysoc); // Calcul du total TTC et de la TVA pour la ligne a partir de // qty, pu, remise_percent et txtva From 5455130a03293088c8d46d68bdfba780e32b4abb Mon Sep 17 00:00:00 2001 From: gauthier Date: Mon, 13 Jan 2020 16:15:22 +0100 Subject: [PATCH 052/105] FIX : We want to be able to import data for extrafields of entity 0 too --- htdocs/core/modules/modSociete.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 23d92f53cb7..b57617b4582 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -449,7 +449,7 @@ class modSociete extends DolibarrModules 's.multicurrency_code' => 'MulticurrencyCurrency' ); // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'societe' AND entity = " . $conf->entity; + $sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'societe' AND entity IN (0," . $conf->entity .")"; $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { From 226dbceac05a5fab80e6230a703763bcffaafd30 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 17:11:50 +0100 Subject: [PATCH 053/105] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 75a7efe53d2..7e04eb590b6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6036,7 +6036,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); + $birthday = dol_print_date($object->birth, 'day'); if ($object->id > 0) From f3046589e750c4eb8178f9253a247e9586303745 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 18:19:51 +0100 Subject: [PATCH 054/105] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 7e04eb590b6..18c31826fd1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6037,7 +6037,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); - + $birthday = dol_print_date($object->birth, 'day'); if ($object->id > 0) From 1eff733e1cb4a8983110897d6b7ba3bc896824f1 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 18:23:50 +0100 Subject: [PATCH 055/105] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 861b49adde2..228a0583ac4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6039,6 +6039,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); $birthday = dol_print_date($object->birth, 'day'); From 96674b2a7e47df4cf382c9b23cd4503892ed628d Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 13 Jan 2020 21:19:32 +0100 Subject: [PATCH 056/105] FIX : Look & feel v11 --- htdocs/loan/card.php | 14 +++++++------- htdocs/loan/list.php | 22 ++++++++++++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index ca28b16261c..9e7b8f2565a 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -716,9 +716,9 @@ if ($id > 0) print ''; print '\n"; print "\n"; - print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; + print '\n"; print ""; $total_capital += $objp->amount_capital; $i++; @@ -728,14 +728,14 @@ if ($id > 0) if ($object->paid == 0) { - print ''; - print ''; + print ''; + print ''; $staytopay = $object->capital - $totalpaid; print ''; - print ''; } print "
'.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200').''.$form->select_dolusers(($search_user > 0 ? $search_user : -1), 'search_user', 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200').''.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).''.$form->selectyesno('search_valuebilled', $search_valuebilled, 1, false, 1).'
'; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; $value = price2num($task_time->thm * $task_time->task_duration / 3600); print price($value, 1, $langs, 1, -1, -1, $conf->currency); @@ -1390,51 +1390,51 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $totalarray['val']['value'] += $value; if (!$i) $totalarray['totalvaluefield'] = $totalarray['nbfield']; $totalarray['totalvalue'] += $value; - } + } - // Invoiced - if (!empty($arrayfields['valuebilled']['checked'])) - { - print ''; // invoice_id and invoice_line_id - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - if ($projectstatic->usage_bill_time) - { - if ($task_time->invoice_id) - { - $result = $tmpinvoice->fetch($task_time->invoice_id); - if ($result > 0) - { - print $tmpinvoice->getNomUrl(1); - } - } - else - { - print $langs->trans("No"); - } - } - else - { - print ''.$langs->trans("NA").''; - } - } - print ''; // invoice_id and invoice_line_id + if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + if ($projectstatic->usage_bill_time) + { + if ($task_time->invoice_id) + { + $result = $tmpinvoice->fetch($task_time->invoice_id); + if ($result > 0) + { + print $tmpinvoice->getNomUrl(1); + } + } + else + { + print $langs->trans("No"); + } + } + else + { + print ''.$langs->trans("NA").''; + } + } + print ''; if (($action == 'editline' || $action == 'splitline') && $_GET['lineid'] == $task_time->rowid) { @@ -1443,19 +1443,19 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print '
'; print ''; } - elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks + elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks { if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) { - if ($conf->MAIN_FEATURES_LEVEL >= 2) - { - print ' '; - print 'rowid.$param.'">'; - print img_split(); - print ''; - } + if ($conf->MAIN_FEATURES_LEVEL >= 2) + { + print ' '; + print 'rowid.$param.'">'; + print img_split(); + print ''; + } - print ' '; + print ' '; print 'rowid.$param.'">'; print img_edit(); print ''; @@ -1465,17 +1465,17 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print img_delete(); print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { - $selected = 0; - if (in_array($task_time->rowid, $arrayofselected)) $selected = 1; - print ' '; - print ''; + $selected = 0; + if (in_array($task_time->rowid, $arrayofselected)) $selected = 1; + print ' '; + print ''; } - } + } } - print '
'; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; - $value = price2num($task_time->thm * $task_time->task_duration / 3600); - print price($value, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $value = price2num($task_time->thm * $task_time->task_duration / 3600); + print price($value, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - $valuebilled = price2num($task_time->total_ht); - if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $valuebilled = price2num($task_time->total_ht); + if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - print ''; + print '
'; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($task_time->task_date_withhour)) - { - print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); - } - else - { - print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($task_time->task_date_withhour)) + { + print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 3, 3, 2, "timespent_date", 1, 0); + } + else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); + } + else + { + print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); + } + print ''; - $tasktmp->id = $task_time->fk_task; - $tasktmp->ref = $task_time->ref; - $tasktmp->label = $task_time->label; - print $tasktmp->getNomUrl(1, 'withproject', 'time'); - print ''; + $tasktmp->id = $task_time->fk_task; + $tasktmp->ref = $task_time->ref; + $tasktmp->label = $task_time->label; + print $tasktmp->getNomUrl(1, 'withproject', 'time'); + print ''; - print $task_time->label; - print ''; + print $task_time->label; + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - if (empty($object->id)) $object->fetch($id); - $contactsoftask = $object->getListContactId('internal'); - if (!in_array($task_time->fk_user, $contactsoftask)) { - $contactsoftask[] = $task_time->fk_user; - } - if (count($contactsoftask) > 0) { - print img_object('', 'user', 'class="hideonsmartphone"'); - print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask); - } else { - print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); - } - } - else - { - $userstatic->id = $task_time->fk_user; - $userstatic->lastname = $task_time->lastname; - $userstatic->firstname = $task_time->firstname; - $userstatic->photo = $task_time->photo; - $userstatic->statut = $task_time->user_status; - print $userstatic->getNomUrl(-1); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + if (empty($object->id)) $object->fetch($id); + $contactsoftask = $object->getListContactId('internal'); + if (!in_array($task_time->fk_user, $contactsoftask)) { + $contactsoftask[] = $task_time->fk_user; + } + if (count($contactsoftask) > 0) { + print img_object('', 'user', 'class="hideonsmartphone"'); + print $form->select_dolusers($task_time->fk_user, 'userid_line_2', 0, '', 0, '', $contactsoftask); + } else { + print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); + } + } + else + { + $userstatic->id = $task_time->fk_user; + $userstatic->lastname = $task_time->lastname; + $userstatic->firstname = $task_time->firstname; + $userstatic->photo = $task_time->photo; + $userstatic->statut = $task_time->user_status; + print $userstatic->getNomUrl(-1); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - } - else - { - print dol_nl2br($task_time->note); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + } + else + { + print dol_nl2br($task_time->note); + } + print ''; - if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) - { - print ''; - print $form->select_duration('new_duration_2', 0, 0, 'text'); - } - else - { - print convertSecondToTime($task_time->task_duration, 'allhourmin'); - } - print ''; + if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + { + print ''; + print $form->select_duration('new_duration_2', 0, 0, 'text'); + } + else + { + print convertSecondToTime($task_time->task_duration, 'allhourmin'); + } + print ''; - $value = 0; - print price($value, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $value = 0; + print price($value, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - $valuebilled = price2num($task_time->total_ht); - if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); - print ''; + $valuebilled = price2num($task_time->total_ht); + if (isset($task_time->total_ht)) print price($valuebilled, 1, $langs, 1, -1, -1, $conf->currency); + print ''; - print ''; + print '
'; + print $langs->trans('InvoiceToUse'); + print ''; + $form->selectInvoice('invoice', '', 'invoiceid',24,0,$langs->trans('NewInvoice'), + 1,0,0,'maxwidth500','','all'); + print '
'; print $langs->trans('ValidateInvoices'); From 92f50f635702b83b93352cabf99b4197807222a9 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 2 Jan 2020 14:00:39 +0000 Subject: [PATCH 038/105] Fixing style errors. --- htdocs/projet/tasks/time.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 485ba8bf173..78eed257ce5 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -958,8 +958,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print $langs->trans('InvoiceToUse'); print ''; - $form->selectInvoice('invoice', '', 'invoiceid',24,0,$langs->trans('NewInvoice'), - 1,0,0,'maxwidth500','','all'); + $form->selectInvoice('invoice', '', 'invoiceid', 24, 0, $langs->trans('NewInvoice'), + 1, 0, 0, 'maxwidth500', '', 'all'); print '
'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.''.dol_print_date($db->jdate($objp->dp), 'day')."".$objp->paiement_type.' '.$objp->num_payment."'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."'.price($objp->amount_insurance, 0, $outputlangs, 1, -1, -1, $conf->currency)."'.price($objp->amount_interest, 0, $outputlangs, 1, -1, -1, $conf->currency)."'.price($objp->amount_capital, 0, $outputlangs, 1, -1, -1, $conf->currency)."
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, 0, -1, $conf->currency).'
'.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans("AlreadyPaid").' :'.price($totalpaid, 0, $langs, 0, -1, -1, $conf->currency).'
'.$langs->trans("AmountExpected").' :'.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).'
'.$langs->trans("RemainderToPay").' :'; - print price($staytopay, 0, $langs, 0, 0, -1, $conf->currency); + print ''; + print price($staytopay, 0, $langs, 0, -1, -1, $conf->currency); print '
"; diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 3b1ccfd2724..912b95c643a 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -124,14 +124,14 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); - + $resql = $db->query($sql); if (!$resql) { dol_print_error($db); exit; } - + $num = $db->num_rows($resql); } @@ -185,10 +185,10 @@ if ($resql) print '
 '; - print ''; - print ''; + print ''; + $searchpicto=$form->showFilterAndCheckAddButtons(0); + print $searchpicto; print '
'."\n"; print '
'."\n"; - + print ''."\n"; - + $db->free($resql); } else From dcba3d5c7c761668ea7f1faa6b15775faf5bf46a Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Mon, 13 Jan 2020 23:00:06 +0100 Subject: [PATCH 057/105] New: Professional identifiers for Roumania --- htdocs/langs/en_US/companies.lang | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 78f474ff96a..c569a48c84a 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -247,6 +247,12 @@ ProfId3US=- ProfId4US=- ProfId5US=- ProfId6US=- +ProfId1RO=Prof Id 1 (CUI) +ProfId2RO=Prof Id 2 (Nr. Înmatriculare) +ProfId3RO=Prof Id 3 (CAEN) +ProfId4RO=- +ProfId5RO=Prof Id 5 (EUID) +ProfId6RO=- ProfId1RU=Prof Id 1 (OGRN) ProfId2RU=Prof Id 2 (INN) ProfId3RU=Prof Id 3 (KPP) From ef5c1e6c8c6c2116139deae9e4e164f19e92a6d7 Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 13 Jan 2020 23:09:08 +0000 Subject: [PATCH 058/105] Update functions.lib.php --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 18c31826fd1..ad234a02cef 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6036,7 +6036,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : ''); + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? $outputlangs->transnoentities($object->availability) : ''); $birthday = dol_print_date($object->birth, 'day'); From 43aa5ec6580a379ff668ad8a45b9b166ac8aa349 Mon Sep 17 00:00:00 2001 From: Norbert Penel Date: Tue, 14 Jan 2020 15:31:41 +0100 Subject: [PATCH 059/105] Dbf -> Db & import from table 1 Import a BIG DBF (aka excel openoffice) into a new table then you can see and search content easily 2 Create thirdparties or products from a table --- dev/initdata/import-dbf.php | 220 +++++++++++++++ dev/initdata/importdb-products.php | 241 ++++++++++++++++ dev/initdata/importdb-thirdparties.php | 355 ++++++++++++++++++++++++ dev/initdata/includes/dbase.class.php | 362 +++++++++++++++++++++++++ 4 files changed, 1178 insertions(+) create mode 100644 dev/initdata/import-dbf.php create mode 100644 dev/initdata/importdb-products.php create mode 100644 dev/initdata/importdb-thirdparties.php create mode 100644 dev/initdata/includes/dbase.class.php diff --git a/dev/initdata/import-dbf.php b/dev/initdata/import-dbf.php new file mode 100644 index 00000000000..954f1c8b2ec --- /dev/null +++ b/dev/initdata/import-dbf.php @@ -0,0 +1,220 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 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 . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to create a table from a large DBF file (openoffice) + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); + +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = dirname($_SERVER["PHP_SELF"]); +require $path . "./../htdocs/master.inc.php"; +require $path . "/includes/dbase.class.php"; + +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + + +$filepath = $argv[1]; +$filepatherr = $filepath . '.err'; +$startchar = empty($argv[2]) ? 0 : (int) $argv[2]; +$deleteTable = empty($argv[3]) ? 1 : 0; +$startlinenb = empty($argv[3]) ? 1 : (int) $argv[3]; +$endlinenb = empty($argv[4]) ? 0 : (int) $argv[4]; + +if (empty($filepath)) { + print "Usage: php $script_file myfilepath.dbf [removeChatColumnName] [startlinenb] [endlinenb]\n"; + print "Example: php $script_file myfilepath.dbf 0 2 1002\n"; + print "\n"; + exit(-1); +} +if (!file_exists($filepath)) { + print "Error: File " . $filepath . " not found.\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} +$user->getrights(); + +// Ask confirmation +if (!$confirmed) { + print "Hit Enter to continue or CTRL+C to stop...\n"; + $input = trim(fgets(STDIN)); +} + +// Open input and output files +$fhandle = dbase_open($filepath, 0); +if (!$fhandle) { + print 'Error: Failed to open file ' . $filepath . "\n"; + exit(1); +} +$fhandleerr = fopen($filepatherr, 'w'); +if (!$fhandleerr) { + print 'Error: Failed to open file ' . $filepatherr . "\n"; + exit(1); +} + +$langs->setDefaultLang($defaultlang); + +$record_numbers = dbase_numrecords($fhandle); +$table_name = substr(basename($filepath), 0, strpos(basename($filepath), '.')); +print 'Info: ' . $record_numbers . " lines in file \n"; +$header = dbase_get_header_info($fhandle); +if ($deleteTable) { + $db->query("DROP TABLE IF EXISTS `$table_name`"); +} +$sqlCreate = "CREATE TABLE IF NOT EXISTS `$table_name` ( `id` INT(11) NOT NULL AUTO_INCREMENT "; +$fieldArray = array("`id`"); +foreach ($header as $value) { + $fieldName = substr(str_replace('_', '', $value['name']), $startchar); + $fieldArray[] = "`$fieldName`"; + $sqlCreate .= ", `" . $fieldName . "` VARCHAR({$value['length']}) NULL DEFAULT NULL "; +} +$sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB"; +$resql = $db->query($sqlCreate); +if ($resql !== FALSE) { + print "Table $table_name created\n"; +} else { + var_dump($db->errno()); + print "Impossible : " . $sqlCreate . "\n"; + die(); +} + +$i = 0; +$nboflines++; + +$fields = implode(',', $fieldArray); +//var_dump($fieldArray);die(); +$maxLength = 0; +for ($i = 1; $i <= $record_numbers; $i++) { + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; + $row = dbase_get_record_with_names($fhandle, $i); + if ($row === FALSE || (isset($row["deleted"]) && $row["deleted"] == '1')) + continue; + $sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,"; + array_shift($row); // remove delete column + foreach ($row as $value) { + $sqlInsert .= "'" . $db->escape(utf8_encode($value)) . "', "; + } + replaceable_echo(implode("\t", $row)); + $sqlInsert = rtrim($sqlInsert, ', '); + $sqlInsert .= ")"; + $resql = $db->query($sqlInsert); + if ($resql === false) { + print "Impossible : " . $sqlInsert . "\n"; + var_dump($row, $db->errno()); + die(); + } +// $fields = (object) $row; +// var_dump($fields); + continue; +} +die(); + + + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) { + print "Rollback any changes.\n"; + $db->rollback(); +} else { + print "Commit all changes.\n"; + $db->commit(); +} + +$db->close(); +fclose($fhandle); +fclose($fhandleerr); + +exit($error); + +function replaceable_echo($message, $force_clear_lines = NULL) { + static $last_lines = 0; + + if (!is_null($force_clear_lines)) { + $last_lines = $force_clear_lines; + } + + $term_width = exec('tput cols', $toss, $status); + if ($status) { + $term_width = 64; // Arbitrary fall-back term width. + } + + $line_count = 0; + foreach (explode("\n", $message) as $line) { + $line_count += count(str_split($line, $term_width)); + } + + // Erasure MAGIC: Clear as many lines as the last output had. + for ($i = 0; $i < $last_lines; $i++) { + // Return to the beginning of the line + echo "\r"; + // Erase to the end of the line + echo "\033[K"; + // Move cursor Up a line + echo "\033[1A"; + // Return to the beginning of the line + echo "\r"; + // Erase to the end of the line + echo "\033[K"; + // Return to the beginning of the line + echo "\r"; + // Can be consolodated into + // echo "\r\033[K\033[1A\r\033[K\r"; + } + + $last_lines = $line_count; + + echo $message . "\n"; +} diff --git a/dev/initdata/importdb-products.php b/dev/initdata/importdb-products.php new file mode 100644 index 00000000000..249ae129b58 --- /dev/null +++ b/dev/initdata/importdb-products.php @@ -0,0 +1,241 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 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 . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to insert products from a csv file. + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = preg_replace('/importdb-products.php/i', '', $_SERVER["PHP_SELF"]); +require $path . "../../htdocs/master.inc.php"; +require $path . "includes/dbase.class.php"; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +//$delimiter = ','; +//$enclosure = '"'; +//$linelength = 10000; +//$escape = '/'; +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + +$tvas = [ + '1' => "20.00", + '2' => "5.50", + '3' => "0.00", + '4' => "20.60", + '5' => "19.60", +]; +$tvasD = [ + '1' => "20", + '2' => "5.5", + '3' => "0", + '4' => "20", + '5' => "20", +]; + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + +$table = $argv[1]; + +if (empty($argv[1])) { + print "Error: Quelle table ?\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} + +$sql = "SELECT * FROM `$table` WHERE 1"; +$resql = $db->query($sql); +if ($resql) + while ($fields = $db->fetch_array($resql)) { + $errorrecord = 0; + if ($fields === FALSE) + continue; + $nboflines++; + + $produit = new Product($db); + $produit->type = 0; + $produit->status = 1; + $produit->ref = trim($fields['REF']); + if ($produit->ref == '') + continue; + print "Process line nb " . $j . ", ref " . $produit->ref; + $produit->label = trim($fields['LIBELLE']); + if ($produit->label == '') + $produit->label = $produit->ref; + if (empty($produit->label)) + continue; + //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); +// $produit->volume = price2num($fields[8]); +// $produit->volume_unit = 0; + $produit->weight = price2num($fields['MASSE']); + $produit->weight_units = 0; // -3 = g + //$produit->customcode = $fields[10]; + $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); + $produit->barcode_type = '2'; + $produit->import_key = $fields['CODE']; + + $produit->status = 1; + $produit->status_buy = 1; + + $produit->finished = 1; + +// $produit->multiprices[0] = price2num($fields['TARIF0']); +// $produit->multiprices[1] = price2num($fields['TARIF1']); +// $produit->multiprices[2] = price2num($fields['TARIF2']); +// $produit->multiprices[3] = price2num($fields['TARIF3']); +// $produit->multiprices[4] = price2num($fields['TARIF4']); +// $produit->multiprices[5] = price2num($fields['TARIF5']); +// $produit->multiprices[6] = price2num($fields['TARIF6']); +// $produit->multiprices[7] = price2num($fields['TARIF7']); +// $produit->multiprices[8] = price2num($fields['TARIF8']); +// $produit->multiprices[9] = price2num($fields['TARIF9']); +// $produit->price_min = null; +// $produit->price_min_ttc = null; +// $produit->price = price2num($fields[11]); +// $produit->price_ttc = price2num($fields[12]); +// $produit->price_base_type = 'TTC'; +// $produit->tva_tx = price2num($fields[13]); + $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); + $produit->tva_npr = 0; +// $produit->cost_price = price2num($fields[16]); + //compta + + $produit->accountancy_code_buy = trim($fields['COMACH']); + $produit->accountancy_code_sell = trim($fields['COMVEN']); +// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); +// $produit->accountancy_code_sell_export=trim($fields['COMVEN']); + // Extrafields +// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); + + $produit->seuil_stock_alerte = $fields['STALERTE']; + $ret = $produit->create($user, 0); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; + } + + dol_syslog("Add prices"); + + // If we use price level, insert price for each level + if (!$errorrecord && 1) { + //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); + $ret1 = false; + for ($i = 0; $i < 10; $i++) { + if ($fields['TARIF' . ($i)] == 0) + continue; + $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; + } + if ($ret1) { + print " - Error in updatePrice result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - updatePrice OK"; + } + } + + +// dol_syslog("Add multilangs"); + // Add alternative languages +// if (!$errorrecord && 1) { +// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); +// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); +// +// $ret = $produit->setMultiLangs($user); +// if ($ret < 0) { +// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); +// $errorrecord++; +// } else { +// print " - setMultiLangs OK"; +// } +// } + + + dol_syslog("Add stocks"); + // stocks + if (!$errorrecord && $fields['STOCK'] != 0) { + $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); + if ($rets < 0) { + print " - Error in correct_stock result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - correct_stock OK"; + } + } + + //update date créa + if (!$errorrecord) { + $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); + $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; + + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); + var_dump($db); + die(); + $error++; // $errorrecord will be reset + } + $j++; + } else + die("error : $sql"); + + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +$db->close(); + +exit($error); diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/importdb-thirdparties.php new file mode 100644 index 00000000000..af92ce70261 --- /dev/null +++ b/dev/initdata/importdb-thirdparties.php @@ -0,0 +1,355 @@ +#!/usr/bin/env php + + * Copyright (C) 2016 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 . + * + * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE + */ + +/** + * \file dev/initdata/import-product.php + * \brief Script example to insert products from a csv file. + * To purge data, you can have a look at purge-data.php + */ +// Test si mode batch +$sapi_type = php_sapi_name(); +$script_file = basename(__FILE__); +$path = dirname(__FILE__) . '/'; +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + +// Recupere root dolibarr +$path = preg_replace('/importdb-thirdparties.php/i', '', $_SERVER["PHP_SELF"]); +require $path . "../../htdocs/master.inc.php"; +require $path . "includes/dbase.class.php"; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +//$delimiter = ','; +//$enclosure = '"'; +//$linelength = 10000; +//$escape = '/'; +// Global variables +$version = DOL_VERSION; +$confirmed = 1; +$error = 0; + +$civilPrivate = array("MLLE", + "MM", + "MM/MADAME", + "MME", + "MME.", + "MME²", + "MMONSIEUR", + "MMR", + "MOBNSIEUR", + "MOMSIEUR", + "MON SIEUR", + "MONDIAL", + "MONIEUR", + "MONJSIEUR", + "MONNSIEUR", + "MONRIEUR", + "MONS", + "MONSIEÕR", + "MONSIER", + "MONSIERU", + "MONSIEU", + "monsieue", + "MONSIEUR", + "Monsieur     \"", + "MONSIEUR    \"", + "MONSIEUR   E", + "MONSIEUR  DENIS", + "MONSIEUR ET MME", + "MONSIEUR!", + "MONSIEUR.", + "MONSIEUR.MADAME", + "MONSIEUR3", + "MONSIEURN", + "MONSIEURT", + "MONSIEUR£", + "MONSIEYR", + "Monsigur", + "MONSIIEUR", + "MONSIUER", + "MONSIZEUR", + "MOPNSIEUR", + "MOSIEUR", + "MR", + "Mr  Mme", + "Mr - MME", + "MR BLANC", + "MR ET MME", + "mr mm", + "MR OU MME", + "Mr.", + "MR/MME", + "MRME", + "MRR", + "Mrs", + "Mademoiselle", + "MADAOME", + "madamme", + "MADAME", + "M0NSIEUR", + "M.et Madame", + "M. ET MR", + "M.", + "M%", + "M MME", + "M ET MME", + "M", + "M CROCE", + "M DIEVART", +); + +/* + * Main + */ + +@set_time_limit(0); +print "***** " . $script_file . " (" . $version . ") pid=" . dol_getmypid() . " *****\n"; +dol_syslog($script_file . " launched with arg " . implode(',', $argv)); + +$table = $argv[1]; + +if (empty($argv[1])) { + print "Error: Quelle table ?\n"; + print "\n"; + exit(-1); +} + +$ret = $user->fetch('', 'admin'); +if (!$ret > 0) { + print 'A user with login "admin" and all permissions must be created to use this script.' . "\n"; + exit; +} + +$sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC"; +$resql = $db->query($sql); +//$db->begin(); +if ($resql) + while ($fields = $db->fetch_array($resql)) { + $i++; + $errorrecord = 0; + + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; + + $nboflines++; + + $object = new Societe($db); + $object->import_key = $fields['CODE']; + $object->state = 1; + $object->client = 3; + $object->fournisseur = 0; + + $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; + //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; + + $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); + $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); + + + $object->address = trim($fields['FADR1']); + if ($fields['FADR2']) + $object->address .= "\n" . trim($fields['FADR2']); + if ($fields['FADR3']) + $object->address .= "\n" . trim($fields['FADR3']); + + $object->zip = trim($fields['FPOSTE']); + $object->town = trim($fields['FVILLE']); + if ($fields['FPAYS']) + $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); + else + $object->country_id = 1; + $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); + $object->phone = substr($object->phone, 0, 20); + $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); + $object->fax = substr($object->fax, 0, 20); + $object->email = trim($fields['FMAIL']); +// $object->idprof2 = trim($fields[29]); + $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); + $object->tva_intra = substr($object->tva_intra, 0, 20); + $object->default_lang = 'fr_FR'; + + $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); + $object->multicurrency_code = 'EUR'; + + if ($fields['REMISE'] != '0.00') { + $object->remise_percent = abs($fields['REMISE']); + } + +// $object->code_client = $fields[9]; +// $object->code_fournisseur = $fields[10]; + + + if ($fields['FCIVIL']) { + $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; + $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); + } + + // Set price level + $object->price_level = $fields['TARIF'] + 1; +// if ($labeltype == 'Revendeur') +// $object->price_level = 2; + + print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; + + + // Extrafields + $object->array_options['options_banque'] = $fields['BANQUE']; + $object->array_options['options_banque2'] = $fields['BANQUE2']; + $object->array_options['options_banquevalid'] = $fields['VALID']; + + if (!$errorrecord) { + $ret = $object->create($user); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); + $errorrecord++; + var_dump($object->code_client, $db); + die(); + } else { + print " - Creation OK with name " . $object->name . " - id = " . $ret; + } + } + + if (!$errorrecord) { + dol_syslog("Set price level"); + $object->set_price_level($object->price_level, $user); + } + if (!$errorrecord && @$object->remise_percent) { + dol_syslog("Set remise client"); + $object->set_remise_client($object->remise_percent, 'Importé', $user); + } + + dol_syslog("Add contact"); + // Insert an invoice contact if there is an invoice email != standard email + if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { + $madame = array("MADAME", + "MADEMOISELLE", + "MELLE", + "MLLE", + "MM", + "Mme", + "MNE", + ); + $monsieur = array("M", + "M ET MME", + "M MME", + "M.", + "M. MME", + "M. OU Mme", + "M.ou Madame", + "MONSEUR", + "MONSIER", + "MONSIEU", + "MONSIEUR", + "monsieur:mme", + "MONSIEUR¨", + "MONSIEZUR", + "MONSIUER", + "MONSKIEUR", + "MR", + ); + $ret1 = $ret2 = 0; + + $contact = new Contact($db); + if (in_array($fields['LCIVIL'], $madame)) { + // une dame + $contact->civility_id = 'MME'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], $monsieur)) { + // un monsieur + $contact->civility_id = 'MR'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { + // un monsieur + $contact->civility_id = 'DR'; + $contact->lastname = $fields['LNOM']; + } else { + // un a rattraper + $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; + } + $contact->address = trim($fields['LADR1']); + if ($fields['LADR2']) + $contact->address .= "\n" . trim($fields['LADR2']); + if ($fields['LADR3']) + $contact->address .= "\n" . trim($fields['LADR3']); + + $contact->zip = trim($fields['LPOSTE']); + $contact->town = trim($fields['LVILLE']); + if ($fields['FPAYS']) + $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); + else + $contact->country_id = 1; + $contact->email = $fields['LMAIL']; + $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); + $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); + $contact->socid = $object->id; + + $ret1 = $contact->create($user); + if ($ret1 > 0) { + //$ret2=$contact->add_contact($object->id, 'BILLING'); + } + if ($ret1 < 0 || $ret2 < 0) { + print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); + $errorrecord++; + } else { + print " - create contact OK"; + } + } + + + //update date créa + if (!$errorrecord) { + $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); + $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $object->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; + + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); + var_dump($db, $object, $contact); +// $db->rollback(); + die(); + $error++; // $errorrecord will be reset + } + $j++; + } else + die("error : $sql"); + +$db->commit(); + + + +// commit or rollback +print "Nb of lines qualified: " . $nboflines . "\n"; +print "Nb of errors: " . $error . "\n"; +$db->close(); + +exit($error); diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/includes/dbase.class.php new file mode 100644 index 00000000000..99cc4480b5f --- /dev/null +++ b/dev/initdata/includes/dbase.class.php @@ -0,0 +1,362 @@ +fd = $fd; + // Byte 4-7 (32-bit number): Number of records in the database file. Currently 0 + fseek($this->fd, 4, SEEK_SET); + $this->recordCount = self::getInt32($fd); + // Byte 8-9 (16-bit number): Number of bytes in the header. + fseek($this->fd, 8, SEEK_SET); + $this->headerLength = self::getInt16($fd); + // Number of fields is (headerLength - 33) / 32) + $this->fieldCount = ($this->headerLength - 33) / 32; + // Byte 10-11 (16-bit number): Number of bytes in record. + fseek($this->fd, 10, SEEK_SET); + $this->recordLength = self::getInt16($fd); + // Byte 32 - n (32 bytes each): Field descriptor array + fseek($fd, 32, SEEK_SET); + for ($i = 0; $i < $this->fieldCount; $i++) { + $data = fread($this->fd, 32); + $field = array_map('trim', unpack('a11name/a1type/c4/c1length/c1precision/s1workid/c1example/c10/c1production', $data)); + $this->fields[] = $field; + } + } + + //bool dbase_close ( resource $dbase_identifier ) + public function close() { + fclose($this->fd); + } + + //array dbase_get_header_info ( resource $dbase_identifier ) + public function get_header_info() { + return $this->fields; + } + + //int dbase_numfields ( resource $dbase_identifier ) + public function numfields() { + return $this->fieldCount; + } + + //int dbase_numrecords ( resource $dbase_identifier ) + public function numrecords() { + return $this->recordCount; + } + + //bool dbase_add_record ( resource $dbase_identifier , array $record ) + public function add_record($record) { + if (count($record) != $this->fieldCount) + return false; + // Seek to end of file, minus the end of file marker + fseek($this->fd, 0, SEEK_END); + // Put the deleted flag + self::putChar8($this->fd, 0x20); + // Put the record + if (!$this->putRecord($record)) + return false; + // Update the record count + fseek($this->fd, 4); + self::putInt32($this->fd, ++$this->recordCount); + return true; + } + + //bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number ) + public function replace_record($record, $record_number) { + if (count($record) != $this->fieldCount) + return false; + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + // Skip to the record location, plus the 1 byte for the deleted flag + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1)) + 1); + return $this->putRecord($record); + } + + //bool dbase_delete_record ( resource $dbase_identifier , int $record_number ) + public function delete_record($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); + self::putChar8($this->fd, 0x2A); + return true; + } + + //array dbase_get_record ( resource $dbase_identifier , int $record_number ) + public function get_record($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); + $record = array( + 'deleted' => self::getChar8($this->fd) == 0x2A ? 1 : 0 + ); + foreach ($this->fields as $i => &$field) { + $value = trim(fread($this->fd, $field['length'])); + if ($field['type'] == 'L') { + $value = strtolower($value); + if ($value == 't' || $value == 'y') + $value = true; + else if ($value == 'f' || $value == 'n') + $value = false; + else + $value = null; + } + $record[$i] = $value; + } + return $record; + } + + //array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number ) + public function get_record_with_names($record_number) { + if ($record_number < 1 || $record_number > $this->recordCount) + return false; + $record = $this->get_record($record_number); + foreach ($this->fields as $i => &$field) { + $record[$field['name']] = $record[$i]; + unset($record[$i]); + } + return $record; + } + + //bool dbase_pack ( resource $dbase_identifier ) + public function pack() { + $in_offset = $out_offset = $this->headerLength; + $new_count = 0; + $rec_count = $this->recordCount; + while ($rec_count > 0) { + fseek($this->fd, $in_offset, SEEK_SET); + $record = fread($this->fd, $this->recordLength); + $deleted = substr($record, 0, 1); + if ($deleted != '*') { + fseek($this->fd, $out_offset, SEEK_SET); + fwrite($this->fd, $record); + $out_offset += $this->recordLength; + $new_count++; + } + $in_offset += $this->recordLength; + $rec_count--; + } + ftruncate($this->fd, $out_offset); + // Update the record count + fseek($this->fd, 4); + self::putInt32($this->fd, $new_count); + } + + /* + * A few utilitiy functions + */ + + private static function length($field) { + switch ($field[1]) { + case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format) + return 8; + case 'T': // DateTime (YYYYMMDDhhmmss.uuu) (FoxPro) + return 18; + case 'M': // Memo (ignored): All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces) + case 'N': // Number: -.0123456789 (right justified, padded with whitespaces) + case 'F': // Float: -.0123456789 (right justified, padded with whitespaces) + case 'C': // String: All ASCII characters (padded with whitespaces up to the field's length) + return $field[2]; + case 'L': // Boolean: YyNnTtFf? (? when not initialized) + return 1; + } + return 0; + } + + /* + * Functions for reading and writing bytes + */ + + private static function getChar8($fd) { + return ord(fread($fd, 1)); + } + + private static function putChar8($fd, $value) { + return fwrite($fd, chr($value)); + } + + private static function getInt16($fd, $n = 1) { + $data = fread($fd, 2 * $n); + $i = unpack("S$n", $data); + if ($n == 1) + return (int) $i[1]; + else + return array_merge($i); + } + + private static function putInt16($fd, $value) { + return fwrite($fd, pack('S', $value)); + } + + private static function getInt32($fd, $n = 1) { + $data = fread($fd, 4 * $n); + $i = unpack("L$n", $data); + if ($n == 1) + return (int) $i[1]; + else + return array_merge($i); + } + + private static function putInt32($fd, $value) { + return fwrite($fd, pack('L', $value)); + } + + private static function putString($fd, $value, $length = 254) { + $ret = fwrite($fd, pack('A' . $length, $value)); + } + + private function putRecord($record) { + foreach ($this->fields as $i => &$field) { + $value = $record[$i]; + // Number types are right aligned with spaces + if ($field['type'] == 'N' || $field['type'] == 'F' && strlen($value) < $field['length']) { + $value = str_repeat(' ', $field['length'] - strlen($value)) . $value; + } + self::putString($this->fd, $value, $field['length']); + } + return true; + } + +} + +if (!function_exists('dbase_open')) { + + function dbase_open($filename, $mode) { + return DBase::open($filename, $mode); + } + + function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) { + return DBase::create($filename, $fields, $type); + } + + function dbase_close($dbase_identifier) { + return $dbase_identifier->close(); + } + + function dbase_get_header_info($dbase_identifier) { + return $dbase_identifier->get_header_info(); + } + + function dbase_numfields($dbase_identifier) { + $dbase_identifier->numfields(); + } + + function dbase_numrecords($dbase_identifier) { + return $dbase_identifier->numrecords(); + } + + function dbase_add_record($dbase_identifier, $record) { + return $dbase_identifier->add_record($record); + } + + function dbase_delete_record($dbase_identifier, $record_number) { + return $dbase_identifier->delete_record($record_number); + } + + function dbase_replace_record($dbase_identifier, $record, $record_number) { + return $dbase_identifier->replace_record($record, $record_number); + } + + function dbase_get_record($dbase_identifier, $record_number) { + return $dbase_identifier->get_record($record_number); + } + + function dbase_get_record_with_names($dbase_identifier, $record_number) { + return $dbase_identifier->get_record_with_names($record_number); + } + + function dbase_pack($dbase_identifier) { + return $dbase_identifier->pack(); + } + +} \ No newline at end of file From ece3face5e66c41bce11ab68582e69d28b0c77cc Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 14 Jan 2020 14:34:36 +0000 Subject: [PATCH 060/105] Fixing style errors. --- dev/initdata/import-dbf.php | 11 +- dev/initdata/importdb-products.php | 250 +++++++++--------- dev/initdata/importdb-thirdparties.php | 340 ++++++++++++------------- dev/initdata/includes/dbase.class.php | 110 +++++--- 4 files changed, 373 insertions(+), 338 deletions(-) diff --git a/dev/initdata/import-dbf.php b/dev/initdata/import-dbf.php index 954f1c8b2ec..de904ca76e1 100644 --- a/dev/initdata/import-dbf.php +++ b/dev/initdata/import-dbf.php @@ -116,7 +116,7 @@ foreach ($header as $value) { } $sqlCreate .= ", PRIMARY KEY (`id`)) ENGINE = InnoDB"; $resql = $db->query($sqlCreate); -if ($resql !== FALSE) { +if ($resql !== false) { print "Table $table_name created\n"; } else { var_dump($db->errno()); @@ -136,7 +136,7 @@ for ($i = 1; $i <= $record_numbers; $i++) { if ($endlinenb && $i > $endlinenb) continue; $row = dbase_get_record_with_names($fhandle, $i); - if ($row === FALSE || (isset($row["deleted"]) && $row["deleted"] == '1')) + if ($row === false || (isset($row["deleted"]) && $row["deleted"] == '1')) continue; $sqlInsert = "INSERT INTO `$table_name`($fields) VALUES (null,"; array_shift($row); // remove delete column @@ -152,8 +152,8 @@ for ($i = 1; $i <= $record_numbers; $i++) { var_dump($row, $db->errno()); die(); } -// $fields = (object) $row; -// var_dump($fields); + // $fields = (object) $row; + // var_dump($fields); continue; } die(); @@ -179,7 +179,8 @@ fclose($fhandleerr); exit($error); -function replaceable_echo($message, $force_clear_lines = NULL) { +function replaceable_echo($message, $force_clear_lines = null) +{ static $last_lines = 0; if (!is_null($force_clear_lines)) { diff --git a/dev/initdata/importdb-products.php b/dev/initdata/importdb-products.php index 249ae129b58..08e960dfdc6 100644 --- a/dev/initdata/importdb-products.php +++ b/dev/initdata/importdb-products.php @@ -89,145 +89,145 @@ if (!$ret > 0) { $sql = "SELECT * FROM `$table` WHERE 1"; $resql = $db->query($sql); if ($resql) - while ($fields = $db->fetch_array($resql)) { - $errorrecord = 0; - if ($fields === FALSE) - continue; - $nboflines++; +while ($fields = $db->fetch_array($resql)) { + $errorrecord = 0; + if ($fields === false) + continue; + $nboflines++; - $produit = new Product($db); - $produit->type = 0; - $produit->status = 1; - $produit->ref = trim($fields['REF']); - if ($produit->ref == '') - continue; - print "Process line nb " . $j . ", ref " . $produit->ref; - $produit->label = trim($fields['LIBELLE']); - if ($produit->label == '') - $produit->label = $produit->ref; - if (empty($produit->label)) - continue; - //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); -// $produit->volume = price2num($fields[8]); -// $produit->volume_unit = 0; - $produit->weight = price2num($fields['MASSE']); - $produit->weight_units = 0; // -3 = g - //$produit->customcode = $fields[10]; - $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); - $produit->barcode_type = '2'; - $produit->import_key = $fields['CODE']; + $produit = new Product($db); + $produit->type = 0; + $produit->status = 1; + $produit->ref = trim($fields['REF']); + if ($produit->ref == '') + continue; + print "Process line nb " . $j . ", ref " . $produit->ref; + $produit->label = trim($fields['LIBELLE']); + if ($produit->label == '') + $produit->label = $produit->ref; + if (empty($produit->label)) + continue; + //$produit->description = trim($fields[4] . "\n" . ($fields[5] ? $fields[5] . ' x ' . $fields[6] . ' x ' . $fields[7] : '')); + // $produit->volume = price2num($fields[8]); + // $produit->volume_unit = 0; + $produit->weight = price2num($fields['MASSE']); + $produit->weight_units = 0; // -3 = g + //$produit->customcode = $fields[10]; + $produit->barcode = str_pad($fields['CODE'], 12, "0", STR_PAD_LEFT); + $produit->barcode_type = '2'; + $produit->import_key = $fields['CODE']; - $produit->status = 1; - $produit->status_buy = 1; + $produit->status = 1; + $produit->status_buy = 1; - $produit->finished = 1; + $produit->finished = 1; -// $produit->multiprices[0] = price2num($fields['TARIF0']); -// $produit->multiprices[1] = price2num($fields['TARIF1']); -// $produit->multiprices[2] = price2num($fields['TARIF2']); -// $produit->multiprices[3] = price2num($fields['TARIF3']); -// $produit->multiprices[4] = price2num($fields['TARIF4']); -// $produit->multiprices[5] = price2num($fields['TARIF5']); -// $produit->multiprices[6] = price2num($fields['TARIF6']); -// $produit->multiprices[7] = price2num($fields['TARIF7']); -// $produit->multiprices[8] = price2num($fields['TARIF8']); -// $produit->multiprices[9] = price2num($fields['TARIF9']); -// $produit->price_min = null; -// $produit->price_min_ttc = null; -// $produit->price = price2num($fields[11]); -// $produit->price_ttc = price2num($fields[12]); -// $produit->price_base_type = 'TTC'; -// $produit->tva_tx = price2num($fields[13]); - $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); - $produit->tva_npr = 0; -// $produit->cost_price = price2num($fields[16]); - //compta + // $produit->multiprices[0] = price2num($fields['TARIF0']); + // $produit->multiprices[1] = price2num($fields['TARIF1']); + // $produit->multiprices[2] = price2num($fields['TARIF2']); + // $produit->multiprices[3] = price2num($fields['TARIF3']); + // $produit->multiprices[4] = price2num($fields['TARIF4']); + // $produit->multiprices[5] = price2num($fields['TARIF5']); + // $produit->multiprices[6] = price2num($fields['TARIF6']); + // $produit->multiprices[7] = price2num($fields['TARIF7']); + // $produit->multiprices[8] = price2num($fields['TARIF8']); + // $produit->multiprices[9] = price2num($fields['TARIF9']); + // $produit->price_min = null; + // $produit->price_min_ttc = null; + // $produit->price = price2num($fields[11]); + // $produit->price_ttc = price2num($fields[12]); + // $produit->price_base_type = 'TTC'; + // $produit->tva_tx = price2num($fields[13]); + $produit->tva_tx = (int) ($tvas[$fields['CODTVA']]); + $produit->tva_npr = 0; + // $produit->cost_price = price2num($fields[16]); + //compta - $produit->accountancy_code_buy = trim($fields['COMACH']); - $produit->accountancy_code_sell = trim($fields['COMVEN']); -// $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); -// $produit->accountancy_code_sell_export=trim($fields['COMVEN']); - // Extrafields -// $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); + $produit->accountancy_code_buy = trim($fields['COMACH']); + $produit->accountancy_code_sell = trim($fields['COMVEN']); + // $produit->accountancy_code_sell_intra=trim($fields['COMVEN']); + // $produit->accountancy_code_sell_export=trim($fields['COMVEN']); + // Extrafields + // $produit->array_options['options_ecotaxdeee'] = price2num($fields[17]); - $produit->seuil_stock_alerte = $fields['STALERTE']; - $ret = $produit->create($user, 0); - if ($ret < 0) { - print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; - } + $produit->seuil_stock_alerte = $fields['STALERTE']; + $ret = $produit->create($user, 0); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - Creation OK with ref " . $produit->ref . " - id = " . $ret; + } - dol_syslog("Add prices"); + dol_syslog("Add prices"); - // If we use price level, insert price for each level - if (!$errorrecord && 1) { - //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); - $ret1 = false; - for ($i = 0; $i < 10; $i++) { - if ($fields['TARIF' . ($i)] == 0) - continue; - $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; - } - if ($ret1) { - print " - Error in updatePrice result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - updatePrice OK"; - } - } + // If we use price level, insert price for each level + if (!$errorrecord && 1) { + //$ret1 = $produit->updatePrice($produit->price_ttc, $produit->price_base_type, $user, $produit->tva_tx, $produit->price_min, 1, $produit->tva_npr, 0, 0, array()); + $ret1 = false; + for ($i = 0; $i < 10; $i++) { + if ($fields['TARIF' . ($i)] == 0) + continue; + $ret1 = $ret1 || $produit->updatePrice(price2num($fields['TARIF' . ($i)]), 'HT', $user, $produit->tva_tx, $produit->price_min, $i + 1, $produit->tva_npr, 0, 0, array()) < 0; + } + if ($ret1) { + print " - Error in updatePrice result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - updatePrice OK"; + } + } -// dol_syslog("Add multilangs"); - // Add alternative languages -// if (!$errorrecord && 1) { -// $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); -// $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); -// -// $ret = $produit->setMultiLangs($user); -// if ($ret < 0) { -// print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); -// $errorrecord++; -// } else { -// print " - setMultiLangs OK"; -// } -// } + // dol_syslog("Add multilangs"); + // Add alternative languages + // if (!$errorrecord && 1) { + // $produit->multilangs['fr_FR'] = array('label' => $produit->label, 'description' => $produit->description, 'note' => $produit->note_private); + // $produit->multilangs['en_US'] = array('label' => $fields[3], 'description' => $produit->description, 'note' => $produit->note_private); + // + // $ret = $produit->setMultiLangs($user); + // if ($ret < 0) { + // print " - Error in setMultiLangs result code = " . $ret . " - " . $produit->errorsToString(); + // $errorrecord++; + // } else { + // print " - setMultiLangs OK"; + // } + // } - dol_syslog("Add stocks"); - // stocks - if (!$errorrecord && $fields['STOCK'] != 0) { - $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); - if ($rets < 0) { - print " - Error in correct_stock result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - correct_stock OK"; - } - } + dol_syslog("Add stocks"); + // stocks + if (!$errorrecord && $fields['STOCK'] != 0) { + $rets = $produit->correct_stock($user, 1, $fields['STOCK'], 0, 'Stock importé'); + if ($rets < 0) { + print " - Error in correct_stock result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - correct_stock OK"; + } + } - //update date créa - if (!$errorrecord) { - $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); - $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); - if ($retd < 1) { - print " - Error in update date créa result " . $produit->errorsToString(); - $errorrecord++; - } else { - print " - update date créa OK"; - } - } - print "\n"; + //update date créa + if (!$errorrecord) { + $date = substr($fields['DATCREA'], 0, 4) . '-' . substr($fields['DATCREA'], 4, 2) . '-' . substr($fields['DATCREA'], 6, 2); + $retd = $db->query("UPDATE `llx_product` SET `datec` = '$date 00:00:00' WHERE `llx_product`.`rowid` = $produit->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $produit->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; - if ($errorrecord) { - print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); - var_dump($db); - die(); - $error++; // $errorrecord will be reset - } - $j++; - } else + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $produit->errorsToString() . "\n"); + var_dump($db); + die(); + $error++; // $errorrecord will be reset + } + $j++; +} else die("error : $sql"); diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/importdb-thirdparties.php index af92ce70261..195c1d16b82 100644 --- a/dev/initdata/importdb-thirdparties.php +++ b/dev/initdata/importdb-thirdparties.php @@ -145,202 +145,202 @@ $sql = "SELECT * FROM `$table` WHERE 1 "; //ORDER BY REMISE DESC,`LCIVIL` DESC"; $resql = $db->query($sql); //$db->begin(); if ($resql) - while ($fields = $db->fetch_array($resql)) { - $i++; - $errorrecord = 0; +while ($fields = $db->fetch_array($resql)) { + $i++; + $errorrecord = 0; - if ($startlinenb && $i < $startlinenb) - continue; - if ($endlinenb && $i > $endlinenb) - continue; + if ($startlinenb && $i < $startlinenb) + continue; + if ($endlinenb && $i > $endlinenb) + continue; - $nboflines++; + $nboflines++; - $object = new Societe($db); - $object->import_key = $fields['CODE']; - $object->state = 1; - $object->client = 3; - $object->fournisseur = 0; + $object = new Societe($db); + $object->import_key = $fields['CODE']; + $object->state = 1; + $object->client = 3; + $object->fournisseur = 0; - $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; - //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; + $object->name = $fields['FCIVIL'] . ' ' . $fields['FNOM']; + //$object->name_alias = $fields[0] != $fields[13] ? trim($fields[0]) : ''; - $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); - $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); + $date = $fields['DATCREA'] ? $fields['DATCREA'] : ($fields['DATMOD'] ? $fields['DATMOD'] : '20200101'); + $object->code_client = 'CU' . substr($date, 2, 2) . substr($date, 4, 2) . '-' . str_pad(substr($fields['CODE'], 0, 5), 5, "0", STR_PAD_LEFT); - $object->address = trim($fields['FADR1']); - if ($fields['FADR2']) - $object->address .= "\n" . trim($fields['FADR2']); - if ($fields['FADR3']) - $object->address .= "\n" . trim($fields['FADR3']); + $object->address = trim($fields['FADR1']); + if ($fields['FADR2']) + $object->address .= "\n" . trim($fields['FADR2']); + if ($fields['FADR3']) + $object->address .= "\n" . trim($fields['FADR3']); - $object->zip = trim($fields['FPOSTE']); - $object->town = trim($fields['FVILLE']); - if ($fields['FPAYS']) - $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); - else - $object->country_id = 1; - $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); - $object->phone = substr($object->phone, 0, 20); - $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); - $object->fax = substr($object->fax, 0, 20); - $object->email = trim($fields['FMAIL']); -// $object->idprof2 = trim($fields[29]); - $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); - $object->tva_intra = substr($object->tva_intra, 0, 20); - $object->default_lang = 'fr_FR'; + $object->zip = trim($fields['FPOSTE']); + $object->town = trim($fields['FVILLE']); + if ($fields['FPAYS']) + $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); + else + $object->country_id = 1; + $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); + $object->phone = substr($object->phone, 0, 20); + $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); + $object->fax = substr($object->fax, 0, 20); + $object->email = trim($fields['FMAIL']); + // $object->idprof2 = trim($fields[29]); + $object->tva_intra = str_replace(['.', ' '], '', $fields['TVAINTRA']); + $object->tva_intra = substr($object->tva_intra, 0, 20); + $object->default_lang = 'fr_FR'; - $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); - $object->multicurrency_code = 'EUR'; + $object->cond_reglement_id = dol_getIdFromCode($db, 'PT_ORDER', 'c_payment_term', 'code', 'rowid', 1); + $object->multicurrency_code = 'EUR'; - if ($fields['REMISE'] != '0.00') { - $object->remise_percent = abs($fields['REMISE']); - } + if ($fields['REMISE'] != '0.00') { + $object->remise_percent = abs($fields['REMISE']); + } -// $object->code_client = $fields[9]; -// $object->code_fournisseur = $fields[10]; + // $object->code_client = $fields[9]; + // $object->code_fournisseur = $fields[10]; - if ($fields['FCIVIL']) { - $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; - $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); - } + if ($fields['FCIVIL']) { + $labeltype = in_array($fields['FCIVIL'], $civilPrivate) ? 'TE_PRIVATE' : 'TE_SMALL'; + $object->typent_id = dol_getIdFromCode($db, $labeltype, 'c_typent', 'code'); + } - // Set price level - $object->price_level = $fields['TARIF'] + 1; -// if ($labeltype == 'Revendeur') -// $object->price_level = 2; + // Set price level + $object->price_level = $fields['TARIF'] + 1; + // if ($labeltype == 'Revendeur') + // $object->price_level = 2; - print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; + print "Process line nb " . $i . ", code " . $fields['CODE'] . ", name " . $object->name; - // Extrafields - $object->array_options['options_banque'] = $fields['BANQUE']; - $object->array_options['options_banque2'] = $fields['BANQUE2']; - $object->array_options['options_banquevalid'] = $fields['VALID']; + // Extrafields + $object->array_options['options_banque'] = $fields['BANQUE']; + $object->array_options['options_banque2'] = $fields['BANQUE2']; + $object->array_options['options_banquevalid'] = $fields['VALID']; - if (!$errorrecord) { - $ret = $object->create($user); - if ($ret < 0) { - print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); - $errorrecord++; - var_dump($object->code_client, $db); - die(); - } else { - print " - Creation OK with name " . $object->name . " - id = " . $ret; - } - } + if (!$errorrecord) { + $ret = $object->create($user); + if ($ret < 0) { + print " - Error in create result code = " . $ret . " - " . $object->errorsToString(); + $errorrecord++; + var_dump($object->code_client, $db); + die(); + } else { + print " - Creation OK with name " . $object->name . " - id = " . $ret; + } + } - if (!$errorrecord) { - dol_syslog("Set price level"); - $object->set_price_level($object->price_level, $user); - } - if (!$errorrecord && @$object->remise_percent) { - dol_syslog("Set remise client"); - $object->set_remise_client($object->remise_percent, 'Importé', $user); - } + if (!$errorrecord) { + dol_syslog("Set price level"); + $object->set_price_level($object->price_level, $user); + } + if (!$errorrecord && @$object->remise_percent) { + dol_syslog("Set remise client"); + $object->set_remise_client($object->remise_percent, 'Importé', $user); + } - dol_syslog("Add contact"); - // Insert an invoice contact if there is an invoice email != standard email - if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { - $madame = array("MADAME", - "MADEMOISELLE", - "MELLE", - "MLLE", - "MM", - "Mme", - "MNE", - ); - $monsieur = array("M", - "M ET MME", - "M MME", - "M.", - "M. MME", - "M. OU Mme", - "M.ou Madame", - "MONSEUR", - "MONSIER", - "MONSIEU", - "MONSIEUR", - "monsieur:mme", - "MONSIEUR¨", - "MONSIEZUR", - "MONSIUER", - "MONSKIEUR", - "MR", - ); - $ret1 = $ret2 = 0; + dol_syslog("Add contact"); + // Insert an invoice contact if there is an invoice email != standard email + if (!$errorrecord && ($fields['LCIVIL'] || $fields['LNOM'])) { + $madame = array("MADAME", + "MADEMOISELLE", + "MELLE", + "MLLE", + "MM", + "Mme", + "MNE", + ); + $monsieur = array("M", + "M ET MME", + "M MME", + "M.", + "M. MME", + "M. OU Mme", + "M.ou Madame", + "MONSEUR", + "MONSIER", + "MONSIEU", + "MONSIEUR", + "monsieur:mme", + "MONSIEUR¨", + "MONSIEZUR", + "MONSIUER", + "MONSKIEUR", + "MR", + ); + $ret1 = $ret2 = 0; - $contact = new Contact($db); - if (in_array($fields['LCIVIL'], $madame)) { - // une dame - $contact->civility_id = 'MME'; - $contact->lastname = $fields['LNOM']; - } elseif (in_array($fields['LCIVIL'], $monsieur)) { - // un monsieur - $contact->civility_id = 'MR'; - $contact->lastname = $fields['LNOM']; - } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { - // un monsieur - $contact->civility_id = 'DR'; - $contact->lastname = $fields['LNOM']; - } else { - // un a rattraper - $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; - } - $contact->address = trim($fields['LADR1']); - if ($fields['LADR2']) - $contact->address .= "\n" . trim($fields['LADR2']); - if ($fields['LADR3']) - $contact->address .= "\n" . trim($fields['LADR3']); + $contact = new Contact($db); + if (in_array($fields['LCIVIL'], $madame)) { + // une dame + $contact->civility_id = 'MME'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], $monsieur)) { + // un monsieur + $contact->civility_id = 'MR'; + $contact->lastname = $fields['LNOM']; + } elseif (in_array($fields['LCIVIL'], ['DOCTEUR'])) { + // un monsieur + $contact->civility_id = 'DR'; + $contact->lastname = $fields['LNOM']; + } else { + // un a rattraper + $contact->lastname = $fields['LCIVIL'] . " " . $fields['LNOM']; + } + $contact->address = trim($fields['LADR1']); + if ($fields['LADR2']) + $contact->address .= "\n" . trim($fields['LADR2']); + if ($fields['LADR3']) + $contact->address .= "\n" . trim($fields['LADR3']); - $contact->zip = trim($fields['LPOSTE']); - $contact->town = trim($fields['LVILLE']); - if ($fields['FPAYS']) - $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); - else - $contact->country_id = 1; - $contact->email = $fields['LMAIL']; - $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); - $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); - $contact->socid = $object->id; + $contact->zip = trim($fields['LPOSTE']); + $contact->town = trim($fields['LVILLE']); + if ($fields['FPAYS']) + $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); + else + $contact->country_id = 1; + $contact->email = $fields['LMAIL']; + $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); + $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); + $contact->socid = $object->id; - $ret1 = $contact->create($user); - if ($ret1 > 0) { - //$ret2=$contact->add_contact($object->id, 'BILLING'); - } - if ($ret1 < 0 || $ret2 < 0) { - print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); - $errorrecord++; - } else { - print " - create contact OK"; - } - } + $ret1 = $contact->create($user); + if ($ret1 > 0) { + //$ret2=$contact->add_contact($object->id, 'BILLING'); + } + if ($ret1 < 0 || $ret2 < 0) { + print " - Error in create contact result code = " . $ret1 . " " . $ret2 . " - " . $contact->errorsToString(); + $errorrecord++; + } else { + print " - create contact OK"; + } + } - //update date créa - if (!$errorrecord) { - $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); - $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); - if ($retd < 1) { - print " - Error in update date créa result " . $object->errorsToString(); - $errorrecord++; - } else { - print " - update date créa OK"; - } - } - print "\n"; + //update date créa + if (!$errorrecord) { + $datec = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2); + $retd = $db->query("UPDATE `llx_societe` SET `datec` = '$datec 00:00:00' WHERE `rowid` = $object->id"); + if ($retd < 1) { + print " - Error in update date créa result " . $object->errorsToString(); + $errorrecord++; + } else { + print " - update date créa OK"; + } + } + print "\n"; - if ($errorrecord) { - print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); - var_dump($db, $object, $contact); -// $db->rollback(); - die(); - $error++; // $errorrecord will be reset - } - $j++; - } else + if ($errorrecord) { + print( 'Error on record nb ' . $i . " - " . $object->errorsToString() . "\n"); + var_dump($db, $object, $contact); + // $db->rollback(); + die(); + $error++; // $errorrecord will be reset + } + $j++; +} else die("error : $sql"); $db->commit(); diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/includes/dbase.class.php index 99cc4480b5f..ba0e18db15d 100644 --- a/dev/initdata/includes/dbase.class.php +++ b/dev/initdata/includes/dbase.class.php @@ -8,7 +8,8 @@ define('DBASE_RDWR', 2); define('DBASE_TYPE_DBASE', 0); define('DBASE_TYPE_FOXPRO', 1); -class DBase { +class DBase +{ private $fd; private $headerLength = 0; @@ -18,7 +19,8 @@ class DBase { private $recordCount = 0; //resource dbase_open ( string $filename , int $mode ) - public static function open($filename, $mode) { + public static function open($filename, $mode) + { if (!file_exists($filename)) return false; $modes = array('r', 'w', 'r+'); @@ -30,7 +32,8 @@ class DBase { } //resource dbase_create ( string $filename , array $fields [, int $type = DBASE_TYPE_DBASE ] ) - public static function create($filename, $fields, $type = DBASE_TYPE_DBASE) { + public static function create($filename, $fields, $type = DBASE_TYPE_DBASE) + { if (file_exists($filename)) return false; $fd = fopen($filename, 'c+'); @@ -93,7 +96,8 @@ class DBase { } // Create DBase instance - private function __construct($fd) { + private function __construct($fd) + { $this->fd = $fd; // Byte 4-7 (32-bit number): Number of records in the database file. Currently 0 fseek($this->fd, 4, SEEK_SET); @@ -116,27 +120,32 @@ class DBase { } //bool dbase_close ( resource $dbase_identifier ) - public function close() { + public function close() + { fclose($this->fd); } //array dbase_get_header_info ( resource $dbase_identifier ) - public function get_header_info() { + public function get_header_info() + { return $this->fields; } //int dbase_numfields ( resource $dbase_identifier ) - public function numfields() { + public function numfields() + { return $this->fieldCount; } //int dbase_numrecords ( resource $dbase_identifier ) - public function numrecords() { + public function numrecords() + { return $this->recordCount; } //bool dbase_add_record ( resource $dbase_identifier , array $record ) - public function add_record($record) { + public function add_record($record) + { if (count($record) != $this->fieldCount) return false; // Seek to end of file, minus the end of file marker @@ -153,7 +162,8 @@ class DBase { } //bool dbase_replace_record ( resource $dbase_identifier , array $record , int $record_number ) - public function replace_record($record, $record_number) { + public function replace_record($record, $record_number) + { if (count($record) != $this->fieldCount) return false; if ($record_number < 1 || $record_number > $this->recordCount) @@ -164,7 +174,8 @@ class DBase { } //bool dbase_delete_record ( resource $dbase_identifier , int $record_number ) - public function delete_record($record_number) { + public function delete_record($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); @@ -173,7 +184,8 @@ class DBase { } //array dbase_get_record ( resource $dbase_identifier , int $record_number ) - public function get_record($record_number) { + public function get_record($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; fseek($this->fd, $this->headerLength + ($this->recordLength * ($record_number - 1))); @@ -186,7 +198,7 @@ class DBase { $value = strtolower($value); if ($value == 't' || $value == 'y') $value = true; - else if ($value == 'f' || $value == 'n') + elseif ($value == 'f' || $value == 'n') $value = false; else $value = null; @@ -197,7 +209,8 @@ class DBase { } //array dbase_get_record_with_names ( resource $dbase_identifier , int $record_number ) - public function get_record_with_names($record_number) { + public function get_record_with_names($record_number) + { if ($record_number < 1 || $record_number > $this->recordCount) return false; $record = $this->get_record($record_number); @@ -209,7 +222,8 @@ class DBase { } //bool dbase_pack ( resource $dbase_identifier ) - public function pack() { + public function pack() + { $in_offset = $out_offset = $this->headerLength; $new_count = 0; $rec_count = $this->recordCount; @@ -236,7 +250,8 @@ class DBase { * A few utilitiy functions */ - private static function length($field) { + private static function length($field) + { switch ($field[1]) { case 'D': // Date: Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format) return 8; @@ -257,15 +272,18 @@ class DBase { * Functions for reading and writing bytes */ - private static function getChar8($fd) { + private static function getChar8($fd) + { return ord(fread($fd, 1)); } - private static function putChar8($fd, $value) { + private static function putChar8($fd, $value) + { return fwrite($fd, chr($value)); } - private static function getInt16($fd, $n = 1) { + private static function getInt16($fd, $n = 1) + { $data = fread($fd, 2 * $n); $i = unpack("S$n", $data); if ($n == 1) @@ -274,11 +292,13 @@ class DBase { return array_merge($i); } - private static function putInt16($fd, $value) { + private static function putInt16($fd, $value) + { return fwrite($fd, pack('S', $value)); } - private static function getInt32($fd, $n = 1) { + private static function getInt32($fd, $n = 1) + { $data = fread($fd, 4 * $n); $i = unpack("L$n", $data); if ($n == 1) @@ -287,15 +307,18 @@ class DBase { return array_merge($i); } - private static function putInt32($fd, $value) { + private static function putInt32($fd, $value) + { return fwrite($fd, pack('L', $value)); } - private static function putString($fd, $value, $length = 254) { + private static function putString($fd, $value, $length = 254) + { $ret = fwrite($fd, pack('A' . $length, $value)); } - private function putRecord($record) { + private function putRecord($record) + { foreach ($this->fields as $i => &$field) { $value = $record[$i]; // Number types are right aligned with spaces @@ -306,57 +329,68 @@ class DBase { } return true; } - } if (!function_exists('dbase_open')) { - function dbase_open($filename, $mode) { + function dbase_open($filename, $mode) + { return DBase::open($filename, $mode); } - function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) { + function dbase_create($filename, $fields, $type = DBASE_TYPE_DBASE) + { return DBase::create($filename, $fields, $type); } - function dbase_close($dbase_identifier) { + function dbase_close($dbase_identifier) + { return $dbase_identifier->close(); } - function dbase_get_header_info($dbase_identifier) { + function dbase_get_header_info($dbase_identifier) + { return $dbase_identifier->get_header_info(); } - function dbase_numfields($dbase_identifier) { + function dbase_numfields($dbase_identifier) + { $dbase_identifier->numfields(); } - function dbase_numrecords($dbase_identifier) { + function dbase_numrecords($dbase_identifier) + { return $dbase_identifier->numrecords(); } - function dbase_add_record($dbase_identifier, $record) { + function dbase_add_record($dbase_identifier, $record) + { return $dbase_identifier->add_record($record); } - function dbase_delete_record($dbase_identifier, $record_number) { + function dbase_delete_record($dbase_identifier, $record_number) + { return $dbase_identifier->delete_record($record_number); } - function dbase_replace_record($dbase_identifier, $record, $record_number) { + function dbase_replace_record($dbase_identifier, $record, $record_number) + { return $dbase_identifier->replace_record($record, $record_number); } - function dbase_get_record($dbase_identifier, $record_number) { + function dbase_get_record($dbase_identifier, $record_number) + { return $dbase_identifier->get_record($record_number); } - function dbase_get_record_with_names($dbase_identifier, $record_number) { + function dbase_get_record_with_names($dbase_identifier, $record_number) + { return $dbase_identifier->get_record_with_names($record_number); } - function dbase_pack($dbase_identifier) { + function dbase_pack($dbase_identifier) + { return $dbase_identifier->pack(); } -} \ No newline at end of file +} From a088c7827921b520a8cd8a05c41f2f6ef6382b3e Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 15 Jan 2020 09:46:44 +0100 Subject: [PATCH 061/105] Fix column type to be as llx_facture --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 ++ htdocs/install/mysql/tables/llx_facture_rec.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 18972bc6b8f..350e3d2065a 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -564,3 +564,5 @@ ALTER TABLE llx_mrp_production ADD INDEX idx_mrp_production_fk_mo (fk_mo); ALTER TABLE llx_emailcollector_emailcollector ADD UNIQUE INDEX uk_emailcollector_emailcollector_ref(ref, entity); ALTER TABLE llx_website ADD COLUMN use_manifest integer; + +ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEFAULT 1; diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index d60537a36d0..d0e4486262a 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -48,7 +48,7 @@ create table llx_facture_rec fk_projet integer, -- projet auquel est associe la facture - fk_cond_reglement integer DEFAULT 0, -- condition de reglement + fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement fk_mode_reglement integer DEFAULT 0, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement fk_account integer, -- bank account id From a893b4220263317dc5dd81134a34704577396396 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:02:18 +0100 Subject: [PATCH 062/105] Show extra short php function overview --- htdocs/admin/system/phpinfo.php | 103 +++++++++++++++++++++++++++++--- 1 file changed, 96 insertions(+), 7 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index bcc3aba20d4..fc98460892c 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("admin"); +$langs->load("install"); +$langs->load("errors"); if (! $user->admin) accessforbidden(); @@ -66,20 +68,107 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) print '
'; } - print ''; print ''; print "\n"; +$ErrorPicturePath = "../../theme/eldy/img/error.png"; +$WarningPicturePath = "../../theme/eldy/img/warning.png"; +$OkayPicturePath = "../../theme/eldy/img/tick.png"; -// Get PHP version -$phpversion=version_php(); -print '\n"; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Version")."".$phpversion."
'.$langs->trans("Version").''; +if (versioncompare(versionphparray(), array(5,5,0)) < 0) +{ + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); +} +elseif (versioncompare(versionphparray(), array(5,5,0)) < 0) +{ + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); +} +else +{ + print 'Ok '.versiontostring(versionphparray()); +} + +print '
GET and POST support'; + +if (! isset($_GET["testget"]) && ! isset($_POST["testpost"])) +{ + print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); + print ' ('.$langs->trans("Recheck").')'; +} +else +{ + print 'Ok '.$langs->trans("PHPSupportPOSTGETOk"); +} + +print '
Sessions support'; + +if (! function_exists("session_id")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportSessions"); +} + +print '
GD support'; + +if (! function_exists("imagecreate")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportGD"); +} + +print '
Curl support'; + +if (! function_exists("curl_init")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportCurl"); +} + +print '
UTF-8 support'; + +if (! function_exists("utf8_encode")) +{ + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); +} +else +{ + print 'Ok '.$langs->trans("PHPSupportUTF8"); +} + +print '
Intl support'; + +if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') +{ + if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) + { + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl"); + } + else + { + print 'Ok '.$langs->trans("PHPSupportIntl"); + } +} + +print '
'; -print '
'; - - // Get php_info array $phparray=phpinfo_array(); From c47da64476065e2c0f7f03176a4f8940c536213d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:13:55 +0100 Subject: [PATCH 063/105] A few fixes --- htdocs/admin/system/phpinfo.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index fc98460892c..237973f26df 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -78,13 +78,15 @@ $OkayPicturePath = "../../theme/eldy/img/tick.png"; print ''.$langs->trans("Version").''; -if (versioncompare(versionphparray(), array(5,5,0)) < 0) +$arrayphpminversionerror = array(5,5,0); +$arrayphpminversionwarning = array(5,5,0); +if (versioncompare(versionphparray(), , $arrayphpminversionerror) < 0) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } -elseif (versioncompare(versionphparray(), array(5,5,0)) < 0) +elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) { - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); + print 'Warning '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); } else { @@ -109,7 +111,7 @@ print 'Sessions support'; if (! function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { @@ -121,7 +123,7 @@ print 'GD support'; if (! function_exists("imagecreate")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportGD"); } else { @@ -133,7 +135,7 @@ print 'Curl support'; if (! function_exists("curl_init")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportCurl"); } else { @@ -145,7 +147,7 @@ print 'UTF-8 support'; if (! function_exists("utf8_encode")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); } else { @@ -159,7 +161,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc { if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportIntl"); } else { From 503671a307e63c5f1d08eef0a4225b009c4f45c6 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Wed, 15 Jan 2020 10:21:36 +0100 Subject: [PATCH 064/105] Fix lint error --- htdocs/admin/system/phpinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 237973f26df..45d9166811a 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -80,7 +80,7 @@ print ''.$langs->trans("Version").''; $arrayphpminversionerror = array(5,5,0); $arrayphpminversionwarning = array(5,5,0); -if (versioncompare(versionphparray(), , $arrayphpminversionerror) < 0) +if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } From 14d59f43afdedc772a989e3ba0f4883efa45f1fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 11:33:02 +0100 Subject: [PATCH 065/105] Trans --- htdocs/langs/en_US/modulebuilder.lang | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index 67002f622f9..ca3fd3e68b8 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -135,3 +135,5 @@ CSSClass=CSS Class NotEditable=Not editable ForeignKey=Foreign key TypeOfFieldsHelp=Type of fields:
varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example) +AsciiToHtmlConverter=Ascii to HTML converter +AsciiToPdfConverter=Ascii to PDF converter \ No newline at end of file From 0442105bd499a33cbc75cd6fe2c92556b3f88d30 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 11:55:27 +0100 Subject: [PATCH 066/105] Fix Generation of zip of module --- htdocs/core/lib/files.lib.php | 6 ++++-- htdocs/modulebuilder/index.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index b84bef02910..b8595b435c1 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2071,9 +2071,10 @@ function dol_uncompress($inputfile, $outputdir) * @param string $outputfile Target file name (output directory must exists and be writable) * @param string $mode 'zip' * @param string $excludefiles A regex pattern. For example: '/\.log$|\/temp\//' + * @param string $rootdirinzip Add a root dir level in zip file * @return int <0 if KO, >0 if OK */ -function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '') +function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = '', $rootdirinzip = '') { $foundhandler=0; @@ -2134,7 +2135,8 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = { // Get real and relative path for current file $filePath = $file->getRealPath(); - $relativePath = substr($filePath, strlen($inputdir) + 1); + $relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1); + if (empty($excludefiles) || ! preg_match($excludefiles, $filePath)) { // Add current file to archive diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d67fa08fafa..f1de611051b 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1071,7 +1071,7 @@ if ($dirins && $action == 'generatepackage') if ($dirofmodule) { if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); - $result = dol_compress_dir($dir, $outputfilezip, 'zip'); + $result = dol_compress_dir($dir, $outputfilezip, 'zip', '', $modulelowercase); } else { From b4a309a2514db27f54a513b5cf7b4cbc0d074959 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:00:25 +0100 Subject: [PATCH 067/105] Prepare 10.0.7 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b3e743aa1a6..1f8d9bf3b8f 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE', 'Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.6'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION', '10.0.7'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO', chr(128)); From 82757e6d03b0cab91503bce87803e02d9c596e59 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:23:14 +0100 Subject: [PATCH 068/105] Move files --- dev/initdata/{ => dbf}/import-dbf.php | 6 +++--- dev/initdata/{ => dbf}/importdb-products.php | 4 ++-- dev/initdata/{ => dbf}/importdb-thirdparties.php | 2 +- dev/initdata/{ => dbf}/includes/dbase.class.php | 2 -- dev/initdata/generate-invoice.php | 2 +- dev/initdata/generate-order.php | 2 +- dev/initdata/generate-product.php | 2 +- dev/initdata/generate-proposal.php | 2 +- dev/initdata/generate-thirdparty.php | 2 +- dev/initdata/import-products.php | 2 +- dev/initdata/import-thirdparties.php | 2 +- dev/initdata/import-users.php | 2 +- 12 files changed, 14 insertions(+), 16 deletions(-) rename dev/initdata/{ => dbf}/import-dbf.php (95%) rename dev/initdata/{ => dbf}/importdb-products.php (97%) rename dev/initdata/{ => dbf}/importdb-thirdparties.php (98%) rename dev/initdata/{ => dbf}/includes/dbase.class.php (99%) diff --git a/dev/initdata/import-dbf.php b/dev/initdata/dbf/import-dbf.php similarity index 95% rename from dev/initdata/import-dbf.php rename to dev/initdata/dbf/import-dbf.php index de904ca76e1..a694a878404 100644 --- a/dev/initdata/import-dbf.php +++ b/dev/initdata/dbf/import-dbf.php @@ -20,9 +20,9 @@ */ /** - * \file dev/initdata/import-product.php + * \file dev/initdata/import-dbf.php * \brief Script example to create a table from a large DBF file (openoffice) - * To purge data, you can have a look at purge-data.php + * To purge data, you can have a look at purge-data.php */ // Test si mode batch $sapi_type = php_sapi_name(); @@ -30,7 +30,7 @@ $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/importdb-products.php b/dev/initdata/dbf/importdb-products.php similarity index 97% rename from dev/initdata/importdb-products.php rename to dev/initdata/dbf/importdb-products.php index 08e960dfdc6..845064f0688 100644 --- a/dev/initdata/importdb-products.php +++ b/dev/initdata/dbf/importdb-products.php @@ -29,7 +29,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } @@ -75,7 +75,7 @@ dol_syslog($script_file . " launched with arg " . implode(',', $argv)); $table = $argv[1]; if (empty($argv[1])) { - print "Error: Quelle table ?\n"; + print "Error: Which table ?\n"; print "\n"; exit(-1); } diff --git a/dev/initdata/importdb-thirdparties.php b/dev/initdata/dbf/importdb-thirdparties.php similarity index 98% rename from dev/initdata/importdb-thirdparties.php rename to dev/initdata/dbf/importdb-thirdparties.php index 195c1d16b82..8f0eb0635f0 100644 --- a/dev/initdata/importdb-thirdparties.php +++ b/dev/initdata/dbf/importdb-thirdparties.php @@ -29,7 +29,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path = dirname(__FILE__) . '/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/includes/dbase.class.php b/dev/initdata/dbf/includes/dbase.class.php similarity index 99% rename from dev/initdata/includes/dbase.class.php rename to dev/initdata/dbf/includes/dbase.class.php index ba0e18db15d..f7383d344a2 100644 --- a/dev/initdata/includes/dbase.class.php +++ b/dev/initdata/dbf/includes/dbase.class.php @@ -10,7 +10,6 @@ define('DBASE_TYPE_FOXPRO', 1); class DBase { - private $fd; private $headerLength = 0; private $fields = array(); @@ -392,5 +391,4 @@ if (!function_exists('dbase_open')) { { return $dbase_identifier->pack(); } - } diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index 0c754b1c874..220144f2a7d 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -26,7 +26,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index b66d3a3abc9..129313c70fd 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 83951c57df7..49fd9860467 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index ad8cf6025bb..d0b2cd4aa56 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 9f740b5705d..91c7c969b75 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -27,7 +27,7 @@ // Test si mode batch $sapi_type = php_sapi_name(); if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index e55f13c7c82..4288c5bf3b1 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 558745e8d06..ef1dfcc99ab 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 64af2f9eb64..60a672adf12 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -30,7 +30,7 @@ $sapi_type = php_sapi_name(); $script_file = basename(__FILE__); $path=dirname(__FILE__).'/'; if (substr($sapi_type, 0, 3) == 'cgi') { - echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n"; exit; } From 1d3d26e185626f17a3df5ae3af4833aeef9cdde1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:26:11 +0100 Subject: [PATCH 069/105] Fix phpcs --- htdocs/core/class/html.form.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fbd00c99281..fde26fa2e19 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3008,7 +3008,6 @@ class Form * @param int $productid Id of product * @param string $htmlname Name of HTML field * @param int $selected_supplier Pre-selected supplier if more than 1 result - * * @return string */ public function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '') From db17a081449209ac294c1c3071c331598bb654ef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 15 Jan 2020 12:52:04 +0100 Subject: [PATCH 070/105] Fix distrib in ping --- build/debian/conf.php.install | 5 +++++ build/exe/doliwamp/doliwamp.iss | 2 +- htdocs/main.inc.php | 7 ++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/build/debian/conf.php.install b/build/debian/conf.php.install index 3fe41b98086..6741d7ea544 100644 --- a/build/debian/conf.php.install +++ b/build/debian/conf.php.install @@ -231,3 +231,8 @@ $dolibarr_main_prod='0'; # Default value: 0 (use database value if exist) # Examples: # $dolibarr_mailing_limit_sendbycli='0'; + +# dolibarr_distrib +# A key to identify the distribution used for first installation +$dolibarr_distrib = 'deb'; + diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 93f515d3440..994beb95eff 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -110,7 +110,7 @@ Source: "C:\Program Files\Wamp\bin\mysql\mysql5.0.45\*.*"; DestDir: "{app}\bin\m ; Mysql data files (does not overwrite if exists) Source: "build\exe\doliwamp\mysql\*.*"; DestDir: "{app}\bin\mysql\data\mysql"; Flags: onlyifdoesntexist ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db" ; Dolibarr -Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php" +Source: "htdocs\*.*"; DestDir: "{app}\www\dolibarr\htdocs"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,custom\*,custom2\*,documents\*,includes\ckeditor\_source\*,includes\savant\*,includes\phpmailer\*,jquery\plugins\template\*,nltechno*\*,sabre\sabre\*\tests,PHPExcel\Shared\PDF\*,PHPExcel\Shared\PCLZip\*,tcpdf\fonts\dejavu-fonts-ttf-2.33\*,tcpdf\fonts\freefont-20100919\*,tcpdf\fonts\utils\*,*\conf.php,*\conf.php.mysql,*\conf.php.old,*\conf.php.postgres,*\conf.php.sav,*\install.forced.php" Source: "dev\*.*"; DestDir: "{app}\www\dolibarr\dev"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,dbmodel\*,fpdf\*,initdata\*,initdemo\*,iso-normes\*,licence\*,phpcheckstyle\*,phpunit\*,samples\*,test\*,uml\*,vagrant\*,xdebug\*" Source: "doc\*.*"; DestDir: "{app}\www\dolibarr\doc"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,wiki\*,plaquette\*,dev\*,images\dolibarr_screenshot2.png,images\dolibarr_screenshot3.png,images\dolibarr_screenshot4.png,images\dolibarr_screenshot5.png,images\dolibarr_screenshot6.png,images\dolibarr_screenshot7.png,images\dolibarr_screenshot8.png,images\dolibarr_screenshot9.png,images\dolibarr_screenshot10.png,images\dolibarr_screenshot11.png,images\dolibarr_screenshot12.png" Source: "scripts\*.*"; DestDir: "{app}\www\dolibarr\scripts"; Flags: ignoreversion recursesubdirs; Excludes: ".gitignore,.project,CVS\*,Thumbs.db,product\materiel.net.php,product\import-product.php" diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index ad329a9efbc..c9def11e910 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2571,6 +2571,10 @@ if (!function_exists("llxFooter")) print "\n".''."\n"; print "\n\n"; $url_for_ping = (empty($conf->global->MAIN_URL_FOR_PING) ? "https://ping.dolibarr.org/" : $conf->global->MAIN_URL_FOR_PING); + // Try to guess the distrib used + $distrib = 'standard'; + if ($_SERVER["SERVER_ADMIN"] == 'doliwamp@localhost') $distrib = 'doliwamp'; + if (! empty($dolibarr_distrib)) $distrib = $dolibarr_distrib; ?>