From c362e7cf2dc6c104213469446737480faaca09a5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:10:07 +0100 Subject: [PATCH 01/75] FIX #6043 - Payment mode not visible on supplier invoice list --- htdocs/fourn/facture/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 47841195c83..89dfb083ea0 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -247,9 +247,9 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:Factur $sql = "SELECT"; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite,"; +$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement,"; $sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; -$sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; +$sql.= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; $sql.= " p.rowid as project_id, p.ref as project_ref"; From 8b569f9dfe7550844be487fe17f6f7de4b75266a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 27 Nov 2016 17:17:29 +0100 Subject: [PATCH 02/75] Try a fix for #6024 --- htdocs/fourn/facture/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2acb57665a6..2a1f1dab8bc 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1765,7 +1765,7 @@ else print ''; $paymentstatic->id=$objp->rowid; $paymentstatic->datepaye=$db->jdate($objp->dp); - $paymentstatic->ref=$objp->ref; + $paymentstatic->ref=($objp->ref ? $objp->ref : $objp->rowid); $paymentstatic->num_paiement=$objp->num_paiement; $paymentstatic->payment_code=$objp->payment_code; print $paymentstatic->getNomUrl(1); From b81a1a9a1d3c522809ba56dac2d6c2b67b38244f Mon Sep 17 00:00:00 2001 From: bgenere Date: Mon, 28 Nov 2016 14:23:35 +0100 Subject: [PATCH 03/75] Code was setting ISO charset as default wich was causing an issue with transnoentities as this method send back UTF-8. Result was that CSV file was generated empty (tested on Unix Ubuntu workstation). Replaced now with $conf->file->character_set_client so it works for me (using UTF-8 by default. To complete the fix my feeling is that we should not force charset till we are not writing the final result. But needs to be confirmed by a senior Dolibarr developer. --- .../modules/export/export_csv.modules.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 8d35ff63225..0c01ef07d89 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -177,6 +177,7 @@ class ExportCsv extends ModeleExports */ function write_header($outputlangs) { + return 0; } @@ -189,18 +190,23 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Object lang to translate values * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK + * + * //TODO transnoentities send back UTF-8 so using an ISO charset at this point create an issue + * (get a blank screen and an empty file) + * my feeling is that we should not force charset till we are not writing the final result. */ function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { + global $conf; - + if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) { $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; } else { - $outputlangs->charset_output = 'ISO-8859-1'; + $outputlangs->charset_output = $conf->file->character_set_client; } foreach($array_selected_sorted as $code => $value) @@ -211,6 +217,7 @@ class ExportCsv extends ModeleExports fwrite($this->handle,$newvalue.$this->separator); } fwrite($this->handle,"\n"); + return 0; } @@ -223,6 +230,10 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Object lang to translate values * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK + * + * //TODO transnoentities send back UTF-8 so using an ISO charset at this point create an issue + * (get a blank screen and an empty file) + * my feeling is that we should not force charset till we are not writing the final result. */ function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { @@ -234,7 +245,7 @@ class ExportCsv extends ModeleExports } else { - $outputlangs->charset_output = 'ISO-8859-1'; + $outputlangs->charset_output = $conf->file->character_set_client; } $this->col=0; @@ -303,7 +314,7 @@ class ExportCsv extends ModeleExports { global $conf; $addquote=0; - + dol_syslog("ExportCsv::csvClean ".$newvalue); // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; From a3fbe94f7ca5b84060dcfaae54d5299b14f1f40b Mon Sep 17 00:00:00 2001 From: bgenere Date: Mon, 28 Nov 2016 14:30:21 +0100 Subject: [PATCH 04/75] Cleaned-up code - removed syslog entry added for debug --- htdocs/core/modules/export/export_csv.modules.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 0c01ef07d89..f2455753ee6 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -177,7 +177,6 @@ class ExportCsv extends ModeleExports */ function write_header($outputlangs) { - return 0; } @@ -197,7 +196,6 @@ class ExportCsv extends ModeleExports */ function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { - global $conf; if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) @@ -217,7 +215,7 @@ class ExportCsv extends ModeleExports fwrite($this->handle,$newvalue.$this->separator); } fwrite($this->handle,"\n"); - + return 0; } @@ -314,8 +312,7 @@ class ExportCsv extends ModeleExports { global $conf; $addquote=0; - dol_syslog("ExportCsv::csvClean ".$newvalue); - + // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; //$newvalue=dol_string_nohtmltag($newvalue,0,$charset); From 093942bcd7a180194648ddfab614c4b690ae7eb9 Mon Sep 17 00:00:00 2001 From: bgenere Date: Mon, 28 Nov 2016 15:37:24 +0100 Subject: [PATCH 05/75] Fixed display issue for custom modules dictionnary not displayed properly when blank exists in dictionnary list for core modules. --- htdocs/core/lib/admin.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 5726981586a..399a77fe27e 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -975,9 +975,9 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql if (! empty($objMod->dictionaries)) { - //var_dump($objMod->dictionaries['tabname']); + //var_dump($objMod->dictionaries['tabname']);var_dump(max($taborder)); $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0; - foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = count($tabname)+1; $tabname[] = $val; } + foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder)+1; $tabname[] = $val; } foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; } foreach($objMod->dictionaries['tabsql'] as $val) { $nbtabsql++; $tabsql[] = $val; } foreach($objMod->dictionaries['tabsqlsort'] as $val) { $nbtabsqlsort++; $tabsqlsort[] = $val; } From b2ed3f30535871b0f313d7b51b2051845f8ac772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 16:32:14 +0100 Subject: [PATCH 06/75] Fix translation --- htdocs/langs/en_US/bills.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index f89e4f1121e..65a93b573e3 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -41,7 +41,7 @@ ConsumedBy=Consumed by NotConsumed=Not consumed NoReplacableInvoice=No replacable invoices NoInvoiceToCorrect=No invoice to correct -InvoiceHasAvoir=Corrected by one or several invoices +InvoiceHasAvoir=Was source of one or several credit notes CardBill=Invoice card PredefinedInvoices=Predefined Invoices Invoice=Invoice From 196428edf5dbb1d6a21e5abc3446d263a1a04dee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 16:34:38 +0100 Subject: [PATCH 07/75] FIX #6051 --- htdocs/societe/consumption.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index ea2cb899893..c31b4513ef5 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -250,6 +250,7 @@ if ($type_element == 'supplier_invoice') $tables_from = MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."facture_fourn_det as d"; $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_facture_fourn = f.rowid"; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datef'; $doc_number='f.ref'; $thirdTypeSelect='supplier'; @@ -262,6 +263,7 @@ if ($type_element == 'supplier_order') $tables_from = MAIN_DB_PREFIX."commande_fournisseur as c,".MAIN_DB_PREFIX."commande_fournisseurdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_commande = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='supplier'; @@ -275,6 +277,7 @@ if ($type_element == 'contract') $tables_from = MAIN_DB_PREFIX."contrat as c,".MAIN_DB_PREFIX."contratdet as d"; $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid; $where.= " AND d.fk_contrat = c.rowid"; + $where.= " AND c.entity = ".$conf->entity; $dateprint = 'c.date_valid'; $doc_number='c.ref'; $thirdTypeSelect='customer'; From 71434d84dd5dfbb2ea4e7c71b9095165d8606401 Mon Sep 17 00:00:00 2001 From: bgenere Date: Mon, 28 Nov 2016 16:44:58 +0100 Subject: [PATCH 08/75] Fixed display issue on import step 4 screen when import_entities_array is empty. also fixed an extra -> displayed. --- htdocs/imports/import.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index c4c14ff8d5f..3b93c40e5ef 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -868,13 +868,13 @@ if ($step == 4 && $datatoimport) $i++; - $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_icon[0]); + $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_label[0]); $tablealias=preg_replace('/(\..*)$/i','',$code); $tablename=$objimport->array_import_tables[0][$tablealias]; $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity; $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity; - print '=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).''; + print ''.img_object('',$entityicon).' '.$langs->trans($entitylang).''; print ''; $newlabel=preg_replace('/\*$/','',$label); $text=$langs->trans($newlabel); From 6e439109324dd66cc1add4ee608d9e6bdd0e3a15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 28 Nov 2016 18:38:48 +0100 Subject: [PATCH 09/75] FIX Filter was wrong or lost during navigation --- htdocs/compta/resultat/clientfourn.php | 164 +++++++++++++++++-------- 1 file changed, 110 insertions(+), 54 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 95ea2bfe46c..63071794caa 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -52,6 +52,17 @@ if ($user->societe_id > 0) $socid = $user->societe_id; if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; +$sortfield = GETPOST("sortfield",'alpha'); +$sortorder = GETPOST("sortorder",'alpha'); +$page = GETPOST("page",'int'); +if ($page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield='s.nom, s.rowid'; +if (! $sortorder) $sortorder='ASC'; + // Date range $year=GETPOST("year"); if (empty($year)) @@ -150,12 +161,23 @@ $hselected = 'report'; report_header($name,$nomlink,$period,$periodlink,$description,$builddate,$exportlink,array('modecompta'=>$modecompta),$calcmode); // Show report array +$param='&modecompta='.$modecompta; +if ($date_startday) $param.='&date_startday='.$date_startday; +if ($date_startmonth) $param.='&date_startmonth='.$date_startmonth; +if ($date_startyear) $param.='&date_startyear='.$date_startyear; +if ($date_endday) $param.='&date_endday='.$date_endday; +if ($date_endmonth) $param.='&date_endmonth='.$date_endmonth; +if ($date_endyear) $param.='&date_endyear='.$date_startyear; + print ''; print ''; -print ''; +print_liste_field_titre(''); +print_liste_field_titre($langs->trans("Name"), $_SERVER["PHP_SELF"],'s.nom, s.rowid','',$param,'',$sortfield,$sortorder); if ($modecompta == 'CREANCES-DETTES') - print ""; -print ""; +{ + print_liste_field_titre($langs->trans("AmountHT"), $_SERVER["PHP_SELF"],'amount_ht','',$param,'align="right"',$sortfield,$sortorder); +} +print_liste_field_titre($langs->trans("AmountTTC"), $_SERVER["PHP_SELF"],'amount_ttc','',$param,'align="right"',$sortfield,$sortorder); print "\n"; /* @@ -197,7 +219,7 @@ else $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.nom, s.rowid"; -$sql.= " ORDER BY s.nom, s.rowid"; +$sql.= $db->order($sortfield, $sortorder); dol_syslog("get customer invoices", LOG_DEBUG); $result = $db->query($sql); @@ -323,7 +345,7 @@ else $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql .= " GROUP BY s.nom, s.rowid"; -$sql .= " ORDER BY s.nom, s.rowid"; +$sql.= $db->order($sortfield, $sortorder); print ''; @@ -408,7 +430,11 @@ else } $sql.= " AND cs.entity = ".$conf->entity; $sql.= " GROUP BY c.libelle, c.id"; -$sql.= " ORDER BY c.libelle, c.id"; +$newsortfield = $sortfield; +if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id'; +if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; +if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; +$sql.= $db->order($newsortfield, $sortorder); dol_syslog("get social contributions deductible=0", LOG_DEBUG); $result=$db->query($sql); @@ -468,8 +494,6 @@ if ($modecompta == 'CREANCES-DETTES') if (! empty($date_start) && ! empty($date_end)) $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " GROUP BY c.libelle, c.id"; - $sql.= " ORDER BY c.libelle, c.id"; } else { @@ -483,9 +507,13 @@ else if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; $sql.= " AND cs.entity = ".$conf->entity; - $sql.= " GROUP BY c.libelle, c.id"; - $sql.= " ORDER BY c.libelle, c.id"; } +$sql.= " GROUP BY c.libelle, c.id"; +$newsortfield = $sortfield; +if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'c.libelle, c.id'; +if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; +if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; +$sql.= $db->order($newsortfield, $sortorder); dol_syslog("get social contributions deductible=1", LOG_DEBUG); $result=$db->query($sql); @@ -569,8 +597,12 @@ if (! empty($conf->salaries->enabled)) $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY u.rowid, u.firstname, u.lastname, p.fk_user, p.label, dm"; - $sql.= " ORDER BY u.firstname"; - + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'u.firstname, u.lastname'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); + dol_syslog("get payment salaries"); $result=$db->query($sql); $subtotal_ht = 0; @@ -638,7 +670,7 @@ if (! empty($conf->expensereport->enabled)) $column='p.date_valid'; } else { - $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht,sum(p.total_ttc) as amount_ttc"; + $sql = "SELECT p.rowid, p.ref, u.rowid as userid, u.firstname, u.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.total_ht) as amount_ht, sum(p.total_ttc) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=p.fk_user_author"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_expensereport as pe ON pe.fk_expensereport = p.rowid"; @@ -652,55 +684,59 @@ if (! empty($conf->expensereport->enabled)) print ''; if (! empty($date_start) && ! empty($date_end)) + { $sql.= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'"; + } + + $sql.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.ref'; + $sql.= $db->order($newsortfield, $sortorder); - $sql.= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm"; - $sql.= " ORDER BY p.ref"; - - dol_syslog("get expense report outcome"); - $result=$db->query($sql); - $subtotal_ht = 0; - $subtotal_ttc = 0; - if ($result) + dol_syslog("get expense report outcome"); + $result=$db->query($sql); + $subtotal_ht = 0; + $subtotal_ttc = 0; + if ($result) + { + $num = $db->num_rows($result); + $var=true; + if ($num) { - $num = $db->num_rows($result); - $var=true; - if ($num) + while ($obj = $db->fetch_object($result)) { - while ($obj = $db->fetch_object($result)) - { - $total_ht -= $obj->amount_ht; - $total_ttc -= $obj->amount_ttc; - $subtotal_ht += $obj->amount_ht; - $subtotal_ttc += $obj->amount_ttc; + $total_ht -= $obj->amount_ht; + $total_ttc -= $obj->amount_ttc; + $subtotal_ht += $obj->amount_ht; + $subtotal_ttc += $obj->amount_ttc; - $var = !$var; - print ""; - - print "\n"; - - if ($modecompta == 'CREANCES-DETTES') print ''; - print ''; - print ''; - } - } - else - { $var = !$var; print ""; - print ''; + + print "\n"; + + if ($modecompta == 'CREANCES-DETTES') print ''; + print ''; print ''; } } else { - dol_print_error($db); - } - print ''; - if ($modecompta == 'CREANCES-DETTES') - print ''; - print ''; + $var = !$var; + print ""; + print ''; print ''; + } + } + else + { + dol_print_error($db); + } + print ''; + if ($modecompta == 'CREANCES-DETTES') + print ''; + print ''; + print ''; } /* @@ -720,7 +756,11 @@ if (! empty($conf->don->enabled)) if (! empty($date_start) && ! empty($date_end)) $sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm"; - $sql.= " ORDER BY p.societe, p.firstname, p.lastname, dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'p.societe, p.firstname, p.lastname, dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get dunning"); $result=$db->query($sql); @@ -795,7 +835,11 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat to pay", LOG_DEBUG); $result=$db->query($sql); @@ -840,7 +884,11 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql.= " AND f.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat received back", LOG_DEBUG); $result=$db->query($sql); @@ -884,7 +932,11 @@ else $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'"; $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat really paid", LOG_DEBUG); $result=$db->query($sql); @@ -925,7 +977,11 @@ else $sql.= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'"; $sql.= " AND t.entity = ".$conf->entity; $sql.= " GROUP BY dm"; - $sql.= " ORDER BY dm"; + $newsortfield = $sortfield; + if ($newsortfield == 's.nom, s.rowid') $newsortfield = 'dm'; + if ($newsortfield == 'amount_ht') $newsortfield = 'amount'; + if ($newsortfield == 'amount_ttc') $newsortfield = 'amount'; + $sql.= $db->order($newsortfield, $sortorder); dol_syslog("get vat really received back", LOG_DEBUG); $result=$db->query($sql); From f6734be1a17d3be5875138701fc1c5cb2831cf7c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:08:44 +0100 Subject: [PATCH 10/75] Fix security hole. Add quick and fast hack to fix it --- htdocs/cron/admin/cron.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 697b24fcc1e..5b517857c7c 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -88,9 +88,20 @@ print ""; print ''; print ''; -print ''; print ''; print ''; From 711961ed1825407064125ad918a341f527e773ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 29 Nov 2016 17:24:40 +0100 Subject: [PATCH 11/75] Fix missing translation --- htdocs/admin/ihm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 3147538c8fe..1a9ad5f317a 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -38,6 +38,7 @@ $langs->load("products"); $langs->load("members"); $langs->load("projects"); $langs->load("hrm"); +$langs->load("agenda"); if (! $user->admin) accessforbidden(); From 49442c0b7f624daa8fdd5eca12248e7f43427ad8 Mon Sep 17 00:00:00 2001 From: fappels Date: Wed, 30 Nov 2016 13:03:17 +0100 Subject: [PATCH 12/75] Add filter on warehouse status to object line product list --- htdocs/core/class/html.form.class.php | 23 ++++++++++++++++------- htdocs/core/tpl/objectline_create.tpl.php | 9 ++++++++- htdocs/product/ajax/products.php | 3 ++- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3e704816d5c..60ce8428d7f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1630,7 +1630,7 @@ class Form * @param int $hidepriceinlabel 1=Hide prices in label * @return void */ - function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0) + function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus=0) { global $langs,$conf; @@ -1649,7 +1649,7 @@ class Form unset($producttmpselect); } // mode=1 means customers products - $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished; + $urloption='htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=1&status='.$status.'&finished='.$finished.'&warehousestatus='.$warehouseStatus; //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { $urloption.='&socid='.$socid; @@ -1670,7 +1670,7 @@ class Form } else { - print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo,$morecss,$hidepriceinlabel); + print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo,$morecss,$hidepriceinlabel, $warehouseStatus); } } @@ -1691,28 +1691,33 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label + * @param int $warehouseStatus Additional warehousestatus to filter (stock from status 1 is always shown) * @return array Array of keys for json */ - function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0) + function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus=0) { global $langs,$conf,$user,$db; $out=''; $outarray=array(); - $sql = "SELECT "; - $sql.= " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.stock, p.fk_price_expression"; + $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; + $selectFieldsGrouped = ", sum(ps.reel) as stock"; + $sql = "SELECT "; + $sql.= $selectFields . $selectFieldsGrouped; //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { $sql.=' ,pcp.rowid as idprodcustprice, pcp.price as custprice, pcp.price_ttc as custprice_ttc,'; $sql.=' pcp.price_base_type as custprice_base_type, pcp.tva_tx as custtva_tx'; + $selectFields.= ", idprodcustprice, custprice, custprice_ttc, custprice_base_type, custtva_tx"; } // Multilang : we add translation if (! empty($conf->global->MAIN_MULTILANGS)) { $sql.= ", pl.label as label_translated"; + $selectFields.= ", pl.label as label_translated"; } // Price by quantity if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) @@ -1725,8 +1730,11 @@ class Form if ($price_level >= 1 && !empty($conf->global->PRODUIT_MULTIPRICES)) $sql.= " AND price_level=".$price_level; $sql.= " ORDER BY date_price"; $sql.= " DESC LIMIT 1) as price_by_qty"; + $selectFields.= ", price_rowid, price_by_qty"; } - $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; + $sql.= " JOIN ".MAIN_DB_PREFIX."entrepot as e on (ps.fk_entrepot = e.rowid AND e.statut IN (1, ".$warehouseStatus."))"; //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".$socid." AND pcp.fk_product=p.rowid"; @@ -1772,6 +1780,7 @@ class Form if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'"; $sql.=')'; } + $sql.= ' GROUP BY'.$selectFields; $sql.= $db->order("p.ref"); $sql.= $db->plimit($limit); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 62866e31ea1..3cd0bd78993 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -184,7 +184,14 @@ else { if (empty($senderissupplier)) { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id); + if ($conf->global->ENTREPOT_EXTRA_STATUS) + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, 3); + } + else + { + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id); + } } else { diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index c399d222177..e8d75c4ba19 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -50,6 +50,7 @@ $id = GETPOST('id', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int'); $finished = GETPOST('finished', 'int'); $alsoproductwithnosupplierprice = GETPOST('alsoproductwithnosupplierprice', 'int'); +$warehouseStatus = GETPOST('warehousestatus', 'int'); /* @@ -185,7 +186,7 @@ else $form = new Form($db); if (empty($mode) || $mode == 1) { // mode=1: customer - $arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid); + $arrayresult = $form->select_produits_list("", $htmlname, $type, 0, $price_level, $searchkey, $status, $finished, $outjson, $socid, '1', 0, '', 0, $warehouseStatus); } elseif ($mode == 2) { // mode=2: supplier $arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, 0, $alsoproductwithnosupplierprice); } From e846d746549b3244c6ecf17c3313b56615f61d38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 Nov 2016 15:19:16 +0100 Subject: [PATCH 13/75] Fix sort on invlice list --- htdocs/compta/facture/list.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 79342baf293..d9e5ae8ce23 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -130,7 +130,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search $fieldstosearchall = array( 'f.facnumber'=>'Ref', 'f.ref_client'=>'RefCustomer', - 'fd.description'=>'Description', + 'pd.description'=>'Description', 's.nom'=>"ThirdParty", 'f.note_public'=>'NotePublic', ); @@ -152,7 +152,7 @@ $arrayfields=array( 'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1), 'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>0), - 'am'=>array('label'=>$langs->trans("Received"), 'checked'=>0), + 'dynamount_payed'=>array('label'=>$langs->trans("Received"), 'checked'=>0), 'rtp'=>array('label'=>$langs->trans("Rest"), 'checked'=>0), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -648,7 +648,9 @@ $sql.= ' f.datec as date_creation, f.tms as date_update,'; $sql.= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name"; -if (! $sall) $sql.= ', SUM(pf.amount) as am'; // To be able to sort on status +// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) +// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. +if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed'; // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); // Add fields from hooks @@ -662,7 +664,6 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s $sql.= ', '.MAIN_DB_PREFIX.'facture as f'; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture_extrafields as ef on (f.rowid = ef.fk_object)"; if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; -else $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON fd.fk_facture = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; // We'll need this table joined to the select in order to filter by sale @@ -1018,8 +1019,8 @@ if ($resql) if (! empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'],$_SERVER['PHP_SELF'],'f.total','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'],$_SERVER['PHP_SELF'],'f.tva','',$param,'align="right"',$sortfield,$sortorder); if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'],$_SERVER['PHP_SELF'],'f.total_ttc','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['am']['checked'])) print_liste_field_titre($arrayfields['am']['label'],$_SERVER['PHP_SELF'],'am','',$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'rtp','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); // Extra fields if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) { @@ -1038,7 +1039,7 @@ if ($resql) print $hookmanager->resPrint; if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); if (! empty($arrayfields['f.tms']['checked'])) print_liste_field_titre($arrayfields['f.tms']['label'],$_SERVER["PHP_SELF"],"f.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,am","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['f.fk_statut']['checked'])) print_liste_field_titre($arrayfields['f.fk_statut']['label'],$_SERVER["PHP_SELF"],"fk_statut,paye,type,dynamount_payed","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch '); print "\n"; @@ -1135,7 +1136,7 @@ if ($resql) print ''; print ''; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { print ''; @@ -1369,9 +1370,9 @@ if ($resql) $totalarray['totalttc'] += $obj->total_ttc; } - if (! empty($arrayfields['am']['checked'])) + if (! empty($arrayfields['dynamount_payed']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalamfield']=$totalarray['nbfield']; $totalarray['totalam'] += $paiement; @@ -1379,7 +1380,7 @@ if ($resql) if (! empty($arrayfields['rtp']['checked'])) { - print ''; + print ''; // TODO Use a denormalized field if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; $totalarray['totalrtp'] += $remaintopay; From 5b6d5df159e99ea2ac4da32d6686ebae60c8c6e7 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Wed, 30 Nov 2016 16:02:55 +0100 Subject: [PATCH 14/75] FIX : delete contract extrafields on contract deletion --- htdocs/contrat/class/contrat.class.php | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 74ea611dc96..e4bee39c39e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -56,7 +56,7 @@ class Contrat extends CommonObject * @var string */ var $ref_customer; - + /** * Supplier reference of the contract * @var string @@ -536,7 +536,7 @@ class Contrat extends CommonObject return -1; } } - + /** * Load a contract from database * @@ -1134,6 +1134,16 @@ class Contrat extends CommonObject } } + // Removed extrafields + if (! $error) { + $result=$this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } + } + if (! $error) { // We remove directory @@ -1333,7 +1343,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc); $txtva = preg_replace('/\s*\(.*\)/','',$txtva); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1356,9 +1366,9 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; - + // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { @@ -1515,7 +1525,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); $tvatx = preg_replace('/\s*\(.*\)/','',$tvatx); // Remove code into vatrate. - + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; @@ -1539,7 +1549,7 @@ class Contrat extends CommonObject if (empty($pa_ht)) $pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($pu_ht, $remise_percent)) < 0) { @@ -2571,7 +2581,7 @@ class ContratLigne extends CommonObjectLine if (empty($this->pa_ht)) $this->pa_ht=0; // if buy price not defined, define buyprice as configured in margin admin - if ($this->pa_ht == 0) + if ($this->pa_ht == 0) { if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { From c17d354367937f9b9271cdc4807ab9ac1a6c350a Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 30 Nov 2016 16:48:27 +0100 Subject: [PATCH 15/75] Fix propal updateline oldcopy extrafields --- htdocs/comm/propal/class/propal.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6c5fdcbbec4..d94932d10c8 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -651,6 +651,7 @@ class Propal extends CommonObject //Fetch current line from the database and then clone the object and set it in $oldline property $line = new PropaleLigne($this->db); $line->fetch($rowid); + $line->fetch_optionals(); // Fetch extrafields for oldcopy $staticline = clone $line; From 18c6bb141d4778a9bb1a497fe8a5b5cd57abd983 Mon Sep 17 00:00:00 2001 From: bgenere Date: Wed, 30 Nov 2016 17:12:17 +0100 Subject: [PATCH 16/75] going back to current version and use EXPORT_CSV_FORCE_CHARSET as a workaround for my dev environment. --- .../core/modules/export/export_csv.modules.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index f2455753ee6..8d35ff63225 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -189,22 +189,18 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Object lang to translate values * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK - * - * //TODO transnoentities send back UTF-8 so using an ISO charset at this point create an issue - * (get a blank screen and an empty file) - * my feeling is that we should not force charset till we are not writing the final result. */ function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { global $conf; - + if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) { $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; } else { - $outputlangs->charset_output = $conf->file->character_set_client; + $outputlangs->charset_output = 'ISO-8859-1'; } foreach($array_selected_sorted as $code => $value) @@ -215,7 +211,6 @@ class ExportCsv extends ModeleExports fwrite($this->handle,$newvalue.$this->separator); } fwrite($this->handle,"\n"); - return 0; } @@ -228,10 +223,6 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Object lang to translate values * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK - * - * //TODO transnoentities send back UTF-8 so using an ISO charset at this point create an issue - * (get a blank screen and an empty file) - * my feeling is that we should not force charset till we are not writing the final result. */ function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { @@ -243,7 +234,7 @@ class ExportCsv extends ModeleExports } else { - $outputlangs->charset_output = $conf->file->character_set_client; + $outputlangs->charset_output = 'ISO-8859-1'; } $this->col=0; @@ -313,6 +304,7 @@ class ExportCsv extends ModeleExports global $conf; $addquote=0; + // Rule Dolibarr: No HTML //print $charset.' '.$newvalue."\n"; //$newvalue=dol_string_nohtmltag($newvalue,0,$charset); From 9c62adb81125aedd68e9c85f416b8c870a700daa Mon Sep 17 00:00:00 2001 From: bgenere Date: Wed, 30 Nov 2016 17:46:53 +0100 Subject: [PATCH 17/75] removed a vardump that was used for debug. --- htdocs/core/lib/admin.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 399a77fe27e..d79e65f766f 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -975,7 +975,7 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql if (! empty($objMod->dictionaries)) { - //var_dump($objMod->dictionaries['tabname']);var_dump(max($taborder)); + //var_dump($objMod->dictionaries['tabname']); $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp=0; foreach($objMod->dictionaries['tabname'] as $val) { $nbtabname++; $taborder[] = max($taborder)+1; $tabname[] = $val; } foreach($objMod->dictionaries['tablib'] as $val) { $nbtablib++; $tablib[] = $val; } From ff859fec022737d4d04d540dbcf29db6f23c3d1a Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 30 Nov 2016 16:03:02 -0300 Subject: [PATCH 18/75] Improve code style php5/7 Replace old attibute var to public --- htdocs/loan/class/loan.class.php | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index 5c57764bf97..3c89f8b36b0 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -33,23 +33,23 @@ class Loan extends CommonObject public $table='loan'; public $table_element='loan'; - var $rowid; - var $datestart; - var $dateend; - var $label; - var $capital; - var $nbterm; - var $rate; - var $paid; - var $account_capital; - var $account_insurance; - var $account_interest; - var $date_creation; - var $date_modification; - var $date_validation; - var $fk_bank; - var $fk_user_creat; - var $fk_user_modif; + public $rowid; + public $datestart; + public $dateend; + public $label; + public $capital; + public $nbterm; + public $rate; + public $paid; + public $account_capital; + public $account_insurance; + public $account_interest; + public $date_creation; + public $date_modification; + public $date_validation; + public $fk_bank; + public $fk_user_creat; + public $fk_user_modif; /** From a7a20f45a11319ea309f1c05ba34712bdc32113d Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 2 Dec 2016 11:03:21 +0100 Subject: [PATCH 19/75] Remove Only shipping and dispatch status Remove Only shipping and dispatch status, better to create new future option 'Routing' for this. --- htdocs/langs/en_US/stocks.lang | 4 +--- htdocs/product/stock/class/entrepot.class.php | 15 +-------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 90ec9a6fb2c..c3f9c359dac 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -133,9 +133,7 @@ InventoryCodeShort=Inv./Mov. code NoPendingReceptionOnSupplierOrder=No pending reception due to open supplier order ThisSerialAlreadyExistWithDifferentDate=This lot/serial number (%s) already exists but with different eatby or sellby date (found %s but you enter %s). OpenAll=Open for all actions -OpenInternal=Open for internal actions -OpenShipping=Open for shippings -OpenDispatch=Open for dispatch +OpenInternal=Open only for internal actions UseDispatchStatus=Use a dispatch status (approve/refuse) for product lines on supplier order reception OptionMULTIPRICESIsOn=Option "several prices per segment" is on. It means a product has several selling price so value for sell can't be calculated ProductStockWarehouseCreated=Stock limit for alert and desired optimal stock correctly created diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 36599833c2d..aed4a866efa 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -50,18 +50,7 @@ class Entrepot extends CommonObject /** * Warehouse open and operations for stock transfers/corrections allowed (not for customer shipping and supplier dispatch). */ - const STATUS_OPEN_INTERNAL = 2; - - /** - * Warehouse open and operations for customer shipping and internal stock transfers/corrections allowed (not for supplier dispatch). - */ - const STATUS_OPEN_SHIPPING = 3; - - /** - * Warehouse open and operations for supplier dispatch internal stock transfers/corrections allowed (not for customer shipping). - */ - const STATUS_OPEN_DISPATCH = 4; - + const STATUS_OPEN_INTERNAL = 2; var $libelle; var $description; @@ -91,8 +80,6 @@ class Entrepot extends CommonObject { $this->statuts[self::STATUS_OPEN_ALL] = 'OpenAll'; $this->statuts[self::STATUS_OPEN_INTERNAL] = 'OpenInternal'; - $this->statuts[self::STATUS_OPEN_SHIPPING] = 'OpenShipping'; - $this->statuts[self::STATUS_OPEN_DISPATCH] = 'OpenDispatch'; } else { From 191474a5db73aaa05509cc325776efe82c6080c5 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 2 Dec 2016 11:35:12 +0100 Subject: [PATCH 20/75] FIX : Update intervention lline crash with PgSQL --- htdocs/fichinter/class/fichinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 59ea03476c4..f1c2ad16879 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -1202,7 +1202,7 @@ class FichinterLigne extends CommonObjectLine // Mise a jour ligne en base $sql = "UPDATE ".MAIN_DB_PREFIX."fichinterdet SET"; $sql.= " description='".$this->db->escape($this->desc)."'"; - $sql.= ",date=".$this->db->idate($this->datei); + $sql.= ",date='".$this->db->idate($this->datei)."'"; $sql.= ",duree=".$this->duration; $sql.= ",rang='".$this->rang."'"; $sql.= " WHERE rowid = ".$this->rowid; From de5ad57af40a432c673070b6dc160bca93e80ffd Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 2 Dec 2016 12:02:08 +0100 Subject: [PATCH 21/75] FIX : export extrafields must not include separe type --- htdocs/core/extrafieldsinexport.inc.php | 62 +++++++++++++------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 1a608f6bc2e..82c26a91991 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -1,4 +1,4 @@ -db->fetch_object($resql)) { - $fieldname=$keyforaliasextra.'.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) { - $tmpkeys=array_keys($tmpparam['options']); - $tmp=array_shift($tmpkeys); - } - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; + if ($obj->type!='separate') { + $fieldname=$keyforaliasextra.'.'.$obj->name; + $fieldlabel=ucfirst($obj->label); + $typeFilter="Text"; + switch($obj->type) + { + case 'int': + case 'double': + case 'price': + $typeFilter="Numeric"; + break; + case 'date': + case 'datetime': + $typeFilter="Date"; + break; + case 'boolean': + $typeFilter="Boolean"; + break; + case 'sellist': + $tmp=''; + $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $tmpkeys=array_keys($tmpparam['options']); + $tmp=array_shift($tmpkeys); + } + if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; + break; + } + $this->export_fields_array[$r][$fieldname]=$fieldlabel; + $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; + $this->export_entities_array[$r][$fieldname]=$keyforelement; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]=$keyforelement; } } // End add axtra fields From b21fd14a114448f94e6fbabeae35cbc7ebe7e35c Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 2 Dec 2016 12:17:33 +0100 Subject: [PATCH 22/75] Ignore Service, only filter warehouse if parameter set --- htdocs/core/class/html.form.class.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index fba20648623..0998579f250 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1698,7 +1698,7 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label - * @param int $warehouseStatus Additional warehousestatus to filter (stock from status 1 is always shown) + * @param int $warehouseStatus Additional warehousestatus to filter (products with stock from status 1 are always shown) * @return array Array of keys for json */ function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus=0) @@ -1709,7 +1709,7 @@ class Form $outarray=array(); $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; - $selectFieldsGrouped = ", sum(ps.reel) as stock"; + $warehouseStatus ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; $sql = "SELECT "; $sql.= $selectFields . $selectFieldsGrouped; @@ -1724,7 +1724,7 @@ class Form if (! empty($conf->global->MAIN_MULTILANGS)) { $sql.= ", pl.label as label_translated"; - $selectFields.= ", pl.label as label_translated"; + $selectFields.= ", label_translated"; } // Price by quantity if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) @@ -1739,9 +1739,11 @@ class Form $sql.= " DESC LIMIT 1) as price_by_qty"; $selectFields.= ", price_rowid, price_by_qty"; } - $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; - $sql.= " JOIN ".MAIN_DB_PREFIX."entrepot as e on (ps.fk_entrepot = e.rowid AND e.statut IN (1, ".$warehouseStatus."))"; + $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; + if ($warehouseStatus) + { + } + //Price by customer if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) { $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".$socid." AND pcp.fk_product=p.rowid"; @@ -1752,6 +1754,9 @@ class Form $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='". $langs->getDefaultLang() ."'"; } $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; + if ($warehouseStatus) + { + } if ($finished == 0) { $sql.= " AND p.finished = ".$finished; @@ -1787,7 +1792,10 @@ class Form if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'"; $sql.=')'; } - $sql.= ' GROUP BY'.$selectFields; + if ($warehouseStatus) + { + $sql.= ' GROUP BY'.$selectFields; + } $sql.= $db->order("p.ref"); $sql.= $db->plimit($limit); From af5eb00933edf13cf6d500d03a9690814c9ce31e Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 2 Dec 2016 12:18:36 +0100 Subject: [PATCH 23/75] Ignore filtering if service --- htdocs/core/class/html.form.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0998579f250..7a8bbf5288d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1742,6 +1742,8 @@ class Form $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; if ($warehouseStatus) { + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; } //Price by customer @@ -1756,6 +1758,7 @@ class Form $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; if ($warehouseStatus) { + $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN (1, '.$warehouseStatus.'))'; } if ($finished == 0) { From c697141851892fd735187043cded2d482630a9d3 Mon Sep 17 00:00:00 2001 From: fappels Date: Fri, 2 Dec 2016 12:22:09 +0100 Subject: [PATCH 24/75] hide products in closed warehouse, but show products for internal transfer Products only for internal transfer should be sellable (for example, they can have virtual stock) --- htdocs/core/tpl/objectline_create.tpl.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 3cd0bd78993..27be5ebf75d 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -186,7 +186,9 @@ else { { if ($conf->global->ENTREPOT_EXTRA_STATUS) { - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, 3); + // hide products in closed warehouse, but show products for internal transfer + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, Entrepot::STATUS_OPEN_INTERNAL); } else { From 495ba00cb63b73b496ed3c7f5751102c14303afd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:21:46 +0100 Subject: [PATCH 25/75] Fix: Slurp, database corruption due to missing unique key on main key. --- .../install/mysql/migration/4.0.0-5.0.0.sql | 11 ++++++ .../mysql/tables/llx_expensereport.key.sql | 36 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 htdocs/install/mysql/tables/llx_expensereport.key.sql diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 4d653644f39..9b65050b663 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -219,6 +219,15 @@ create table llx_user_employment )ENGINE=innodb; +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + -- Sequence to removed duplicated values of llx_links. Use serveral times if you still have duplicate. drop table tmp_links_double; @@ -230,5 +239,7 @@ drop table tmp_links_double; ALTER TABLE llx_links ADD UNIQUE INDEX uk_links (objectid,label); +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_expensereport.key.sql b/htdocs/install/mysql/tables/llx_expensereport.key.sql new file mode 100644 index 00000000000..a7e4fd54425 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_expensereport.key.sql @@ -0,0 +1,36 @@ +-- =================================================================== +-- Copyright (C) 2005 Laurent Destailleur +-- Copyright (C) 2008-2010 Regis Houssin +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- =================================================================== + + +ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, entity); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_debut (date_debut); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_date_fin (date_fin); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_statut (fk_statut); + +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_author (fk_user_author); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_valid (fk_user_valid); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_user_approve (fk_user_approve); +ALTER TABLE llx_expensereport ADD INDEX idx_expensereport_fk_refuse (fk_user_approve); + +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_valid FOREIGN KEY (fk_user_valid) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_user_approve FOREIGN KEY (fk_user_approve) REFERENCES llx_user (rowid); +--ALTER TABLE llx_expensereport ADD CONSTRAINT fk_expensereport_fk_refuse FOREIGN KEY (fk_user_refuse) REFERENCES llx_user (rowid); + From 411e82b7a3b528072438143e88cd4c309fa95f38 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 14:52:38 +0100 Subject: [PATCH 26/75] Fix button set to paid not always visible when it should. --- htdocs/expensereport/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d3b25d2277f..9112f8ee99b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1999,7 +1999,8 @@ if ($action != 'create' && $action != 'edit') // If bank module is not used if (($user->rights->expensereport->to_paid || empty($conf->banque->enabled)) && $object->fk_statut == 5) { - if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) + if ($object->paid == 0) { print '"; } From 64f76d8cab87e6489aefd1ee73bd666ff7da5683 Mon Sep 17 00:00:00 2001 From: jfefe Date: Fri, 2 Dec 2016 17:02:49 +0100 Subject: [PATCH 27/75] Fix : bad function name --- dev/skeletons/skeleton_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 38aa50cf593..7a3a94da477 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -1,6 +1,6 @@ - * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2016 Jean-François Ferry * * 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 @@ -301,7 +301,7 @@ if ($resql) $moreforfilter = ''; $moreforfilter.='
'; - $moreforfilter.= $langs->trans('MyFilter') . ': '; + $moreforfilter.= $langs->trans('MyFilter') . ': '; $moreforfilter.= '
'; if (! empty($moreforfilter)) From 33139dd57abc8b8ab02ffc4f0c0c254d826051b8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 2 Dec 2016 17:46:59 +0100 Subject: [PATCH 28/75] Fix missing translation of page "disabled" and "offline". --- htdocs/cache.manifest | 4 ++-- htdocs/disabled.php | 29 ----------------------- htdocs/public/notice.php | 50 +++++++++++++++++++++++++++++++++++++++ htdocs/public/offline.php | 37 ----------------------------- 4 files changed, 52 insertions(+), 68 deletions(-) delete mode 100644 htdocs/disabled.php create mode 100644 htdocs/public/notice.php delete mode 100644 htdocs/public/offline.php diff --git a/htdocs/cache.manifest b/htdocs/cache.manifest index 9119290941b..a3d1b1c554f 100644 --- a/htdocs/cache.manifest +++ b/htdocs/cache.manifest @@ -33,5 +33,5 @@ NETWORK: # If the browser is unable to retrieve the original content, the fallback resource will be used. # In the example above, we display a static image in case the dynamic one is unavailable. FALLBACK: -#/ public/offline.php -#theme/amarok/img/* theme/eldy/img/ +#/ public/notice.php +#theme/eldy/img/* theme/md/img/* diff --git a/htdocs/disabled.php b/htdocs/disabled.php deleted file mode 100644 index 43c650466a6..00000000000 --- a/htdocs/disabled.php +++ /dev/null @@ -1,29 +0,0 @@ - - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * or see http://www.gnu.org/ - */ - -/** - * \file htdocs/disabled.php - * \brief Page to use to replace index.php to disable all software - */ -?> - - -This feature has been disabled on this test server.
-Cette fonctionnalité a été désactivée sur ce serveur de test.
- - diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php new file mode 100644 index 00000000000..623baa2020a --- /dev/null +++ b/htdocs/public/notice.php @@ -0,0 +1,50 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/public/notice.php + * \brief Dolibarr page to show a notice. + * Default notice is a message to say network connection is off. + * You can also call this page with URL: + * /public/notice.php?lang=xx_XX&transkey=translation_key (key must be inside file main.lang, error.lang or other.lang) + * /public/notice.php?transphrase=url_encoded_sentence_to_show + */ + +define('NOCSRFCHECK',1); +define('NOLOGIN',1); + +require '../main.inc.php'; + + +/** + * View + */ + +if (! GETPOST('transkey') && ! GETPOST('transphrase')) +{ + print 'Sorry, it seems your internet connexion is off.
'; + print 'You need to be connected to network to use this software.
'; +} +else +{ + $langs->load("error"); + $langs->load("other"); + + if (GETPOST('transphrase')) print GETPOST('transphrase'); + if (GETPOST('transkey')) print $langs->trans(GETPOST('transkey')); +} + diff --git a/htdocs/public/offline.php b/htdocs/public/offline.php deleted file mode 100644 index 043da4ac9c7..00000000000 --- a/htdocs/public/offline.php +++ /dev/null @@ -1,37 +0,0 @@ - - * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2011-2012 Juanjo Menent - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** - * \file htdocs/public/offline.php - * \brief Dolibarr offline page - */ - -define('NOCSRFCHECK',1); -define('NOLOGIN',1); - -require '../main.inc.php'; - -/** - * View - */ - -print 'Sorry, it seems your internet connexion is off.
'; -print 'You need to be connected to network to use this software.
'; - From a75577516d1bf37c69418258b2dc5e9beec821ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:13:04 +0100 Subject: [PATCH 29/75] Fix pb with multicompany on expense report --- htdocs/expensereport/export_csv.php | 1 + htdocs/expensereport/index.php | 2 +- htdocs/expensereport/list.php | 2 +- htdocs/expensereport/payment/card.php | 2 +- htdocs/expensereport/payment/payment.php | 5 +++-- htdocs/expensereport/synchro_compta.php | 1 + 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/expensereport/export_csv.php b/htdocs/expensereport/export_csv.php index 3cf520c6739..d55e262e2e4 100644 --- a/htdocs/expensereport/export_csv.php +++ b/htdocs/expensereport/export_csv.php @@ -128,6 +128,7 @@ if (isset($_POST['action'])) $sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.rowid"; $result = $db->query($sql); diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index 117ecc5e3c4..83e45d2a1b7 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -147,7 +147,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d, ".MAIN_DB_PREFIX."user as u" if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE u.rowid = d.fk_user_author"; if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous)) $sql.=' AND d.fk_user_author IN ('.join(',',$childids).')'; -//$sql.= " AND d.entity = ".$conf->entity; +$sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND d.fk_user_author = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND d.fk_user_author = ".$socid; $sql.= $db->order($sortfield,$sortorder); diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index b857b9c92d4..476ef2224f5 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -133,7 +133,7 @@ $sql.= " d.date_debut, d.date_fin, d.date_valid,"; $sql.= " u.rowid as id_user, u.firstname, u.lastname"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; -$sql.= " WHERE d.entity = ".$conf->entity; +$sql.= ' WHERE d.entity IN ('.getEntity('expensereport', 1).')'; // Search all if (!empty($sall)) { diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index 19d5b3206f7..f9ba5af3dc0 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -199,7 +199,7 @@ $disable_delete = 0; $sql = 'SELECT er.rowid as did, er.paid, er.total_ttc, per.amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'payment_expensereport as per,'.MAIN_DB_PREFIX.'expensereport as er'; $sql.= ' WHERE per.fk_expensereport = er.rowid'; -$sql.= ' AND er.entity = '.$conf->entity; +$sql.= ' AND er.entity IN ('.getEntity('expensereport', 1).')'; $sql.= ' AND per.rowid = '.$id; dol_syslog("expensereport/payment/card.php", LOG_DEBUG); diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index c4351e4d038..e361a9954c0 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -193,8 +193,9 @@ if (GETPOST("action") == 'create') print '
'; $sql = "SELECT sum(p.amount) as total"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " WHERE p.fk_expensereport = ".$chid; + $sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e"; + $sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$chid; + $sql.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/expensereport/synchro_compta.php b/htdocs/expensereport/synchro_compta.php index 31c2d985840..eba616d2620 100644 --- a/htdocs/expensereport/synchro_compta.php +++ b/htdocs/expensereport/synchro_compta.php @@ -139,6 +139,7 @@ else: $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid"; $sql.= " WHERE d.fk_statut = 6"; + $sql.= ' AND d.entity IN ('.getEntity('expensereport', 1).')'; $sql.= " ORDER BY d.date_valid DESC"; $resql=$db->query($sql); From 7a3b3090139e9300504d4f3ad4cd43911523a361 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:22:26 +0100 Subject: [PATCH 30/75] Fix width --- htdocs/compta/paiement/cheque/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index ebfd598ee0b..9ea4d6eb1e0 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -160,7 +160,7 @@ if ($resql) print ''; print ''; print ''; print ''; print '"; // Num ref cheque - print ''; } @@ -847,20 +853,33 @@ foreach ($listofreferent as $key => $value) // Amount inc tax if (empty($value['disableamount'])) { + $total_ttc_by_line=null; if ($tablename == 'don') $total_ttc_by_line=$element->amount; elseif ($tablename == 'projet_task') { - $defaultvat = get_default_tva($mysoc, $mysoc); - $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + if (! empty($conf->salaries->enabled)) + { + // TODO Permission to read daily rate + $defaultvat = get_default_tva($mysoc, $mysoc); + $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)),'MT'); + } + else + { + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); + } } else { $total_ttc_by_line=$element->total_ttc; } print ''; } @@ -923,15 +942,25 @@ foreach ($listofreferent as $key => $value) if ($breakline) print $breakline; + // Total print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; //if (empty($value['disableamount']) && ! in_array($tablename, array('projet_task'))) print ''; //elseif (empty($value['disableamount']) && in_array($tablename, array('projet_task'))) print ''; - if (empty($value['disableamount'])) print ''; - else print ''; + print ''; print ''; print ''; } From fe54673a87157ba4461bab8d942bd9a0a6732b3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 18:13:23 +0100 Subject: [PATCH 32/75] FIX List of people able to validate an expense report was not complete. --- htdocs/expensereport/card.php | 14 +++++++++----- htdocs/expensereport/class/expensereport.class.php | 14 ++++++++++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 9112f8ee99b..3f827de3540 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1117,11 +1117,15 @@ if ($action == 'create') print ''; print ''; if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index a05805c7f74..9349e0e72e0 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1411,7 +1411,8 @@ class ExpenseReport extends CommonObject /** - * Return list of people with permission to validate trips and expenses + * Return list of people with permission to validate expense reports. + * Search for permission "approve expense report" * * @return array Array of user ids */ @@ -1419,10 +1420,15 @@ class ExpenseReport extends CommonObject { $users_validator=array(); - $sql = "SELECT fk_user"; + $sql = "SELECT DISTINCT ur.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd"; - $sql.= " WHERE ur.fk_id = rd.id and module = 'expensereport' AND perms = 'approve'"; // Permission 'Approve'; - + $sql.= " WHERE ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve'; + $sql.= "UNION"; + $sql.= " SELECT DISTINCT ugu.fk_user"; + $sql.= " FROM ".MAIN_DB_PREFIX."usergroup_user as ugu, ".MAIN_DB_PREFIX."usergroup_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd"; + $sql.= " WHERE ugu.fk_usergroup = ur.fk_usergroup AND ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve'; + //print $sql; + dol_syslog(get_class($this)."::fetch_users_approver_expensereport sql=".$sql); $result = $this->db->query($sql); if($result) From 80f2623f9f66ec21ec10e48817007ac8840025f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 18:20:57 +0100 Subject: [PATCH 33/75] FIX bad permission to see contract on home page --- htdocs/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.php b/htdocs/index.php index faa2eb9dcee..ee3c2490aeb 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -173,7 +173,7 @@ if (empty($user->societe_id)) ! empty($conf->propal->enabled) && $user->rights->propale->lire, ! empty($conf->commande->enabled) && $user->rights->commande->lire, ! empty($conf->facture->enabled) && $user->rights->facture->lire, - ! empty($conf->contrat->enabled) && $user->rights->contrat->activer, + ! empty($conf->contrat->enabled) && $user->rights->contrat->lire, ! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, ! empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), From b0ac0624dbf8769ebb1280fd59967f862fcc63a4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 18:21:55 +0100 Subject: [PATCH 34/75] FIX bad permission to see contract statistics --- htdocs/contrat/class/contrat.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 233bda18542..14e4f2cbf7b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2035,7 +2035,7 @@ class Contrat extends CommonObject $sql = "SELECT count(c.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."contrat as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; - if (!$user->rights->contrat->activer && !$user->societe_id) + if (!$user->rights->contrat->lire && !$user->societe_id) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; $sql.= " WHERE sc.fk_user = " .$user->id; From 09baab1076e0d427c8575ec915458a41b599c540 Mon Sep 17 00:00:00 2001 From: bgenere Date: Sat, 3 Dec 2016 18:46:12 +0100 Subject: [PATCH 35/75] Fix display issue on step 4 of import in import.php. The issue was only for custom module import as the entity was initialised with the icone name i.e. filename@modulename. Then the arrays entitytoicon and entitytolang where used. But by definition custom modules do not have entries in these arrays. So changed the assignement to proper object property when $entity is not in these 2 tables. This is not changing behaviour of default object. I have tested both with my custom objet and product object. So it should be fine now. --- htdocs/imports/import.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 3b93c40e5ef..f86197b82a8 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -867,14 +867,14 @@ if ($step == 4 && $datatoimport) print ''; $i++; - - $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_label[0]); + + $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_icon[0]); $tablealias=preg_replace('/(\..*)$/i','',$code); $tablename=$objimport->array_import_tables[0][$tablealias]; - $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity; - $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$entity; + $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$objimport->array_import_icon[0]; + $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$objimport->array_import_label[0]; - print ''; + print ''; print ''; // Note on several rows //print ''; print ''; @@ -313,13 +401,13 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('SendingMethod'); print ''; if ($action != 'editshippingmethod' && $user->rights->expedition->creer) - print ''; + print ''; print '
  ".$langs->trans("AmountHT")."".$langs->trans("AmountTTC")."
'.$langs->trans("SuppliersInvoices").'
'.$langs->trans("ExpenseReport").'
 ".$langs->trans("ExpenseReport")." userid."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount_ht).''.price(-$obj->amount_ttc).'
 '.$langs->trans("None").'".$langs->trans("ExpenseReport")." userid."\">".$obj->firstname." ".$obj->lastname."'.price(-$obj->amount_ht).''.price(-$obj->amount_ttc).'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
 '.$langs->trans("None").'
'.price(-$subtotal_ht).''.price(-$subtotal_ttc).'
'.$langs->trans("KeyForCronAccess").''; -if (! empty($conf->use_javascript_ajax)) - print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +$disabled=''; +if (! empty($conf->global->CRON_DISABLE_KEY_CHANGE)) $disabled=' disabled="disabled"'; +print ''; +if (empty($conf->global->CRON_DISABLE_KEY_CHANGE)) +{ + print ''; + if (! empty($conf->use_javascript_ajax)) + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +} +else +{ + print (! empty($conf->global->CRON_KEY)?$conf->global->CRON_KEY:''); + print ''; +} print ' 
'; print ''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($paiement)?price($paiement,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').''.(! empty($remaintopay)?price($remaintopay,0,$langs):' ').'
'.$langs->trans("Amount").''.price($expensereport->total_ttc,0,$outputlangs,1,-1,-1,$conf->currency).'
 '; - print ''; + print ''; print ''; @@ -179,7 +179,7 @@ if ($resql) print "
'; + print ''; $checkdepositstatic->id=$objp->rowid; $checkdepositstatic->ref=($objp->ref?$objp->ref:$objp->rowid); $checkdepositstatic->statut=$objp->statut; From 69b5baebc53450ce9a3fb6c12c3a5da60903266d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 15:54:06 +0100 Subject: [PATCH 31/75] FIX rendering of output of estimated amount on project overview page. --- htdocs/projet/element.php | 55 ++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index cbd22856e4c..1d9ffd61a99 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -812,6 +812,8 @@ foreach ($listofreferent as $key => $value) $warning=''; if (empty($value['disableamount'])) { + $total_ht_by_line=null; + $othermessage=''; if ($tablename == 'don') $total_ht_by_line=$element->amount; elseif ($tablename == 'projet_task') { @@ -828,7 +830,7 @@ foreach ($listofreferent as $key => $value) } else { - print $langs->trans("ModuleDisabled"); + $othermessage=$form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } } else @@ -836,9 +838,13 @@ foreach ($listofreferent as $key => $value) $total_ht_by_line=$element->total_ht; } print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ht_by_line)?price($total_ht_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ht_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ht_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print ''; - if (! $qualifiedfortotal) print ''; - print (isset($total_ttc_by_line)?price($total_ttc_by_line):' '); - if (! $qualifiedfortotal) print ''; + if ($othermessage) print $othermessage; + if (isset($total_ttc_by_line)) + { + if (! $qualifiedfortotal) print ''; + print price($total_ttc_by_line); + if (! $qualifiedfortotal) print ''; + } if ($warning) print ' '.img_warning($warning); print '
'.$langs->trans("Number").': '.$i.''.$langs->trans("TotalHT").' : '.price($total_ht).''.$langs->trans("Total").' : '.price($total_ht).''.$langs->trans("TotalHT").' : '.price($total_ht).''; + if (empty($value['disableamount'])) + { + if (! empty($conf->salaries->enabled)) print ''.$langs->trans("TotalHT").' : '.price($total_ht); + } + print ''.$langs->trans("TotalTTC").' : '.price($total_ttc).''.$langs->trans("TotalTTC").' : '.price($total_ttc).''; + if (empty($value['disableamount'])) + { + + if (! empty($conf->salaries->enabled)) print $langs->trans("TotalTTC").' : '.price($total_ttc); + } + print ' 
'; $object = new ExpenseReport($db); $include_users = $object->fetch_users_approver_expensereport(); - $defaultselectuser=$user->fk_user; // Will work only if supervisor has permission to approve so is inside include_users - if (! empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; - if (GETPOST('fk_user_validator') > 0) $defaultselectuser=GETPOST('fk_user_validator'); - $s=$form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", 0, $include_users); - print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); + if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport"); + else + { + $defaultselectuser=$user->fk_user; // Will work only if supervisor has permission to approve so is inside include_users + if (! empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver + if (GETPOST('fk_user_validator') > 0) $defaultselectuser=GETPOST('fk_user_validator'); + $s=$form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", 0, $include_users); + print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); + } print '
'.img_object('',$entityicon).' '.$langs->trans($entitylang).'=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).''; $newlabel=preg_replace('/\*$/','',$label); $text=$langs->trans($newlabel); From 6e5a8b6787a12ee0ce4b5f48d10e1d1ded0e9fa7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 19:14:16 +0100 Subject: [PATCH 36/75] FIX Some statistics not compatible with multicompany module. --- htdocs/commande/class/commandestats.class.php | 3 ++- .../class/expensereportstats.class.php | 27 ++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index e38097e4e3a..81488bdb1d6 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -81,7 +81,8 @@ class CommandeStats extends Stats $this->where.= " c.fk_statut > 2"; // Only approved & ordered } //$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity; - $this->where.= " AND c.entity = ".$conf->entity; + $this->where.= ' AND c.entity IN ('.getEntity('commande', 1).')'; + if (!$user->rights->societe->client->voir && !$this->socid) $this->where .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($this->socid) { diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 57c970b9fc8..deaa386da9d 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -56,14 +56,17 @@ class ExpenseReportStats extends Stats $this->userid = $userid; $object=new ExpenseReport($this->db); - $this->from = MAIN_DB_PREFIX.$object->table_element; + $this->from = MAIN_DB_PREFIX.$object->table_element." as e"; $this->field='total_ht'; - $this->where = " fk_statut > 0 and date_valid > '2000-01-01'"; + $this->where = " e.fk_statut > 0"; + //$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only approved + $this->where.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; + //$this->where.= " AND entity = ".$conf->entity; if ($this->socid) { - $this->where.=" AND fk_soc = ".$this->socid; + $this->where.=" AND e.fk_soc = ".$this->socid; } // Only me and subordinates @@ -71,10 +74,10 @@ class ExpenseReportStats extends Stats { $childids = $user->getAllChildIds(); $childids[]=$user->id; - $this->where.=" AND fk_user_author IN (".(join(',',$childids)).")"; + $this->where.=" AND e.fk_user_author IN (".(join(',',$childids)).")"; } - if ($this->userid > 0) $this->where.=' AND fk_user_author = '.$this->userid; + if ($this->userid > 0) $this->where.=' AND e.fk_user_author = '.$this->userid; } @@ -102,9 +105,9 @@ class ExpenseReportStats extends Stats */ function getNbByMonth($year) { - $sql = "SELECT MONTH(date_valid) as dm, count(*)"; + $sql = "SELECT MONTH(e.date_valid) as dm, count(*)"; $sql.= " FROM ".$this->from; - $sql.= " WHERE YEAR(date_valid) = ".$year; + $sql.= " WHERE YEAR(e.date_valid) = ".$year; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -123,9 +126,9 @@ class ExpenseReportStats extends Stats */ function getAmountByMonth($year) { - $sql = "SELECT date_format(date_valid,'%m') as dm, sum(".$this->field.")"; + $sql = "SELECT date_format(e.date_valid,'%m') as dm, sum(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(date_valid,'%Y') = '".$year."'"; + $sql.= " WHERE date_format(e.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -143,9 +146,9 @@ class ExpenseReportStats extends Stats */ function getAverageByMonth($year) { - $sql = "SELECT date_format(date_valid,'%m') as dm, avg(".$this->field.")"; + $sql = "SELECT date_format(e.date_valid,'%m') as dm, avg(".$this->field.")"; $sql.= " FROM ".$this->from; - $sql.= " WHERE date_format(date_valid,'%Y') = '".$year."'"; + $sql.= " WHERE date_format(e.date_valid,'%Y') = '".$year."'"; $sql.= " AND ".$this->where; $sql.= " GROUP BY dm"; $sql.= $this->db->order('dm','DESC'); @@ -160,7 +163,7 @@ class ExpenseReportStats extends Stats */ function getAllByYear() { - $sql = "SELECT date_format(date_valid,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; + $sql = "SELECT date_format(e.date_valid,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql.= " FROM ".$this->from; $sql.= " WHERE ".$this->where; $sql.= " GROUP BY year"; From 9c47f3d3fdc9ca64df9dd95c0ec197eca3280e64 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 19:41:03 +0100 Subject: [PATCH 37/75] Restore protection to avoid errors --- htdocs/expensereport/class/expensereportstats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index deaa386da9d..59bcc9841a9 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -60,7 +60,7 @@ class ExpenseReportStats extends Stats $this->field='total_ht'; $this->where = " e.fk_statut > 0"; - //$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only approved + $this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have. $this->where.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; //$this->where.= " AND entity = ".$conf->entity; From fb2f33cfac34b58c0001d35475c84def4ca8f686 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 19:48:08 +0100 Subject: [PATCH 38/75] FIX Clean corrupted data --- htdocs/install/mysql/migration/repair.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index d487217cb9a..44560366c6c 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -294,3 +294,19 @@ DELETE FROM llx_c_shipment_mode where code IN (select code from tmp_c_shipment_m drop table tmp_c_shipment_mode; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; + +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; + From 4abd417a6adf0a4713dccb9417ffabb41ce8bbb3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 19:50:52 +0100 Subject: [PATCH 39/75] Corrupted data must be fixed by repair not by code hack. --- htdocs/expensereport/class/expensereportstats.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereportstats.class.php b/htdocs/expensereport/class/expensereportstats.class.php index 59bcc9841a9..25ead4de0c1 100644 --- a/htdocs/expensereport/class/expensereportstats.class.php +++ b/htdocs/expensereport/class/expensereportstats.class.php @@ -60,7 +60,7 @@ class ExpenseReportStats extends Stats $this->field='total_ht'; $this->where = " e.fk_statut > 0"; - $this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have. + //$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only correct "valid date". If date is invalid, the group by on it will fails. Launch a repair.php if you have. $this->where.= ' AND e.entity IN ('.getEntity('expensereport', 1).')'; //$this->where.= " AND entity = ".$conf->entity; From 17bc24e83e008b84b55e6ad93a59e6a724d18832 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 20:05:49 +0100 Subject: [PATCH 40/75] Complete repair --- htdocs/install/mysql/migration/repair.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 44560366c6c..df17ce38e68 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -296,9 +296,9 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; --- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; --- VMYSQL4.1 update llx_deplacementteclib set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; @@ -306,7 +306,7 @@ drop table tmp_c_shipment_mode; -- VMYSQL4.1 update llx_expensereport set date_fin = date_debut where DATE(STR_TO_DATE(date_fin, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; --- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_fin where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; --- VMYSQL4.1 update llx_expensereport set date_valid = date_create where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 update llx_expensereport set date_valid = date_fin where DATE(STR_TO_DATE(date_valid, '%Y-%m-%d')) IS NULL; From 888c4cd2add8d33791800a7e00ae5a44c650be9a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 20:15:56 +0100 Subject: [PATCH 41/75] Fix corrupted value for pointoftax field --- htdocs/install/mysql/migration/repair.sql | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index df17ce38e68..9f192a0d9cc 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -21,6 +21,13 @@ +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_facture set date_pointoftax = NULL where DATE(STR_TO_DATE(date_pointoftax, '%Y-%m-%d')) IS NULL; + + + -- Requests to clean corrupted database From 2b8fbf200a9a1533d4c718d62ede0412ef4375fa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Dec 2016 21:29:49 +0100 Subject: [PATCH 42/75] Complete work on the new dol_banner --- htdocs/comm/propal/contact.php | 1 + htdocs/comm/propal/info.php | 12 +- htdocs/commande/contact.php | 107 +++--- htdocs/commande/document.php | 73 +++- htdocs/commande/info.php | 80 ++++- htdocs/commande/note.php | 85 +++-- htdocs/core/tpl/notes.tpl.php | 4 +- htdocs/expedition/shipment.php | 592 ++++++++++++++++++++------------ htdocs/langs/en_US/orders.lang | 1 + htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 5 + 11 files changed, 634 insertions(+), 328 deletions(-) diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index f82732a49ff..8588bfc5749 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("facture"); $langs->load("orders"); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index c4f3a3e4f4e..14a4911b80f 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -32,12 +32,21 @@ $langs->load('propal'); $langs->load('compta'); $id=GETPOST('id','int'); +$ref=GETPOST('ref','alpha'); $socid=GETPOST('socid','int'); // Security check if (! empty($user->societe_id)) $socid=$user->societe_id; $result = restrictedArea($user, 'propal', $id); +$object = new Propal($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); + exit; +} + + /* * View @@ -47,8 +56,6 @@ $form = new Form($db); llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'); -$object = new Propal($db); -$object->fetch($id); $object->fetch_thirdparty(); $head = propal_prepare_head($object); @@ -112,7 +119,6 @@ print '
'; dol_print_object_info($object); -print ''; print ''; dol_fiche_end(); diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index da584f9197c..dfa137f231e 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $langs->load("orders"); $langs->load("sendings"); @@ -139,6 +140,8 @@ if ($id > 0 || ! empty($ref)) if ($object->fetch($id, $ref) > 0) { + $object->fetch_thirdparty(); + $soc = new Societe($db); $soc->fetch($object->socid); @@ -146,62 +149,60 @@ if ($id > 0 || ! empty($ref)) $head = commande_prepare_head($object); dol_fiche_head($head, 'contact', $langs->trans("CustomerOrder"), 0, 'order'); + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - /* - * Facture synthese pour rappel - */ - print ''; + // Order card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - // Ref - print '"; - - // Ref commande client - print ''; - print ''; - - // Customer - if (is_null($object->thirdparty)) $object->fetch_thirdparty(); - - print ""; - print ''; - - // Delivery address - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) - { - print ''; - } - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
".$langs->trans("Company")."'.$object->thirdparty->getNomUrl(1).'
'; - print ''; - - if ($action != 'editdelivery_address' && $object->brouillon) print ''; - print '
'; - print $langs->trans('DeliveryAddress'); - print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'
'; - print '
'; - - if ($action == 'editdelivery_address') - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'fk_address','commande',$object->id); - } - else - { - $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,GETPOST('socid','int'),'none','commande',$object->id); - } - print '
"; - - print ''; + dol_fiche_end(); print '
'; diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index a05a6e0061d..b687e577a33 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -94,30 +94,79 @@ if ($id > 0 || ! empty($ref)) $head = commande_prepare_head($object); dol_fiche_head($head, 'documents', $langs->trans('CustomerOrder'), 0, 'order'); - // Construit liste des fichiers $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $totalsize=0; foreach($filearray as $key => $file) { - $totalsize+=$file['size']; + $totalsize+=$file['size']; } - - + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + print ''; - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print ''; - - print ''; print ''; print ''; + print "
'.$langs->trans('Ref').''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print '
'.$langs->trans('Company').''.$object->thirdparty->getNomUrl(1).'
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
\n"; + print "
\n"; + + print dol_fiche_end(); $modulepart = 'commande'; $permission = $user->rights->commande->creer; diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index ae0dd789064..ddf30b290be 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -32,12 +32,21 @@ if (!$user->rights->commande->lire) accessforbidden(); $langs->load("orders"); $langs->load("sendings"); -// Security check $socid=0; $comid = GETPOST("id",'int'); +$id = GETPOST("id",'int'); +$ref=GETPOST('ref','alpha'); + +// Security check if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$comid,''); +$object = new Commande($db); +if (! $object->fetch($id, $ref) > 0) +{ + dol_print_error($db); + exit; +} /* @@ -46,21 +55,76 @@ $result=restrictedArea($user,'commande',$comid,''); llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes'); -$commande = new Commande($db); -$commande->fetch($comid); -$commande->info($comid); -$soc = new Societe($db); -$soc->fetch($commande->socid); +$object->fetch_thirdparty(); +$object->info($object->id); -$head = commande_prepare_head($commande); +$soc = new Societe($db); +$soc->fetch($object->thirdparty->id); + +$head = commande_prepare_head($object); dol_fiche_head($head, 'info', $langs->trans("CustomerOrder"), 0, 'order'); +// Order card + +$linkback = '' . $langs->trans("BackToList") . ''; + + +$morehtmlref='
'; +// Ref customer +$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); +$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); +// Thirdparty +$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; + + +dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + +print '
'; +print '
'; + +print '
'; print '
'; -dol_print_object_info($commande); +dol_print_object_info($object); print '
'; print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index e6bf504bec7..8af3447734d 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -48,6 +48,7 @@ $object = new Commande($db); if (! $object->fetch($id, $ref) > 0) { dol_print_error($db); + exit; } $permissionnote=$user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php @@ -77,38 +78,66 @@ if ($id > 0 || ! empty($ref)) dol_fiche_head($head, 'note', $langs->trans("CustomerOrder"), 0, 'order'); - print ''; - - $linkback = ''.$langs->trans("BackToList").''; - - // Ref - print '"; - - // Ref commande client - print ''; - print ''; - - // Customer - print ""; - print ''; - - print "
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref'); - print "
'; - print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print '
'; - print '
'; - print $object->ref_client; - print '
".$langs->trans("Company")."'.$soc->getNomUrl(1).'
"; - - print '
'; - + // Order card + + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + + $cssclass="titlefield"; include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; print '
'; + + dol_fiche_end(); } diff --git a/htdocs/core/tpl/notes.tpl.php b/htdocs/core/tpl/notes.tpl.php index c971a49148f..01d0ba7b33c 100644 --- a/htdocs/core/tpl/notes.tpl.php +++ b/htdocs/core/tpl/notes.tpl.php @@ -72,13 +72,13 @@ else $typeofdata='textarea:12:95%';
-
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
societe_id)) { ?>
-
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
+
>editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0); ?>
editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1); ?>
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 4674a2a4583..887b5805533 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -31,7 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php'; require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +if (! empty($conf->projet->enabled)) { + require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; +} if (! empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -53,108 +56,165 @@ $socid=0; if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user,'commande',$id); +$object = new Commande($db); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once + + + /* * Actions */ -// Categorisation dans projet -if ($action == 'classin') +$parameters = array('socid' => $socid); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) { - $commande = new Commande($db); - $commande->fetch($id); - $commande->setProject(GETPOST('projectid','int')); + // Categorisation dans projet + if ($action == 'classin') + { + $object = new Commande($db); + $object->fetch($id); + $object->setProject(GETPOST('projectid','int')); + } + + if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') + { + $object = new Commande($db); + $object->fetch($id); + $result = $object->cloture($user); + } + + // Positionne ref commande client + else if ($action == 'setref_client' && $user->rights->commande->creer) { + $result = $object->set_ref_client($user, GETPOST('ref_client')); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + + if ($action == 'setdatedelivery' && $user->rights->commande->creer) + { + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); + + $object = new Commande($db); + $object->fetch($id); + $result=$object->set_date_livraison($user,$datelivraison); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $object->setDeliveryAddress(GETPOST('delivery_address_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setmode' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $result = $object->setPaymentMethods(GETPOST('mode_reglement_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setavailability' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->availability(GETPOST('availability_id')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setdemandreason' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->demand_reason(GETPOST('demand_reason_id')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'setconditions' && $user->rights->commande->creer) + { + $object = new Commande($db); + $object->fetch($id); + $result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + // shipping method + if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + // warehouse + if ($action == 'setwarehouse' && $user->rights->commande->creer) { + $object = new Commande($db); + $object->fetch($id); + $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); + if ($result < 0) + setEventMessages($object->error, $object->errors, 'errors'); + } + + if ($action == 'update_extras') + { + // Fill array 'array_options' with data from update form + $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); + $ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute')); + if ($ret < 0) $error++; + + if (! $error) + { + // Actions on extra fields (by external module or standard code) + $hookmanager->initHooks(array('orderdao')); + $parameters = array('id' => $object->id); + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by + // some hooks + if (empty($reshook)) { + $result = $object->insertExtraFields(); + if ($result < 0) { + $error++; + } + } else if ($reshook < 0) + $error++; + } + + if ($error) + $action = 'edit_extras'; + } + + if ($action == 'set_thirdparty' && $user->rights->commande->creer) + { + $object->fetch($id); + $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); + + header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); + exit(); + } + + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + } -if ($action == 'confirm_cloture' && GETPOST('confirm','alpha') == 'yes') -{ - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->cloture($user); -} - -// Positionne ref commande client -if ($action == 'setrefcustomer' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $commande->set_ref_client($user,GETPOST('ref_customer','alpha')); -} - -if ($action == 'setdatedelivery' && $user->rights->commande->creer) -{ - //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datelivraison=dol_mktime(0, 0, 0, GETPOST('liv_month','int'), GETPOST('liv_day','int'),GETPOST('liv_year','int')); - - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->set_date_livraison($user,$datelivraison); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $commande->setDeliveryAddress(GETPOST('delivery_address_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setmode' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->setPaymentMethods(GETPOST('mode_reglement_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setavailability' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->availability(GETPOST('availability_id')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setdemandreason' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->demand_reason(GETPOST('demand_reason_id')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -if ($action == 'setconditions' && $user->rights->commande->creer) -{ - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->setPaymentTerms(GETPOST('cond_reglement_id','int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -// shipping method -if ($action == 'setshippingmethod' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result=$commande->setShippingMethod(GETPOST('shipping_method_id', 'int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - -// warehouse -if ($action == 'setwarehouse' && $user->rights->commande->creer) { - $commande = new Commande($db); - $commande->fetch($id); - $result = $commande->setWarehouse(GETPOST('warehouse_id', 'int')); - if ($result < 0) - setEventMessages($commande->error, $commande->errors, 'errors'); -} - - /* * View */ @@ -162,81 +222,109 @@ if ($action == 'setwarehouse' && $user->rights->commande->creer) { $form = new Form($db); $formfile = new FormFile($db); $formproduct = new FormProduct($db); +if (! empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } llxHeader('',$langs->trans('OrderCard'),''); if ($id > 0 || ! empty($ref)) { - $commande = new Commande($db); - if ( $commande->fetch($id,$ref) > 0) + $object = new Commande($db); + if ( $object->fetch($id,$ref) > 0) { - $commande->loadExpeditions(1); + $object->loadExpeditions(1); $product_static=new Product($db); $soc = new Societe($db); - $soc->fetch($commande->socid); + $soc->fetch($object->socid); $author = new User($db); - $author->fetch($commande->user_author_id); + $author->fetch($object->user_author_id); - $head = commande_prepare_head($commande); + $res = $object->fetch_optionals($object->id, $extralabels); + + $head = commande_prepare_head($object); dol_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), 0, 'order'); - /* - * Confirmation de la validation - */ + + $formconfirm = ''; + + // Confirm validation if ($action == 'cloture') { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$id,$langs->trans("CloseShipment"),$langs->trans("ConfirmCloseShipment"),"confirm_cloture"); } - // Onglet commande - //$nbrow=8; - //if (! empty($conf->projet->enabled)) $nbrow++; - - print ''; - - // Ref - print ''; - print ''; - print ''; - - // Ref commande client - print ''; - print ''; + + // Print form confirm + print $formconfirm; + + + // Order card - // Third party - print ''; - print ''; - print ''; + $linkback = '' . $langs->trans("BackToList") . ''; + + + $morehtmlref='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->commande->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + + print '
'; + print '
'; + print '
'; + + print '
'.$langs->trans('Ref').''; - print $form->showrefnav($commande,'ref','',1,'ref','ref'); - print '
'; - print ''; - if ($action != 'RefCustomerOrder' && $commande->brouillon) print ''; - print '
'; - print $langs->trans('RefCustomer').''; - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->commande->creer && $action == 'RefCustomerOrder') - { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print '
'; + if (! $formconfirm) { + $parameters = array(); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; } - else - { - print $commande->ref_client; - } - print '
'.$langs->trans('Company').''.$soc->getNomUrl(1).'
'; // Discounts for third party - print ''; print ''; print ''; @@ -281,29 +369,29 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('DateDeliveryPlanned'); print ''; - if ($action != 'editdate_livraison') print ''; + if ($action != 'editdate_livraison') print ''; print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -246,7 +334,7 @@ if ($id > 0 || ! empty($ref)) $absolute_creditnote=price2num($absolute_creditnote,'MT'); if ($absolute_discount) { - if ($commande->statut > Commande::STATUS_DRAFT) + if ($object->statut > Commande::STATUS_DRAFT) { print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->transnoentities("Currency".$conf->currency)); } @@ -255,7 +343,7 @@ if ($id > 0 || ! empty($ref)) // Remise dispo de type non avoir $filter='fk_facture_source IS NULL'; print '
'; - $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$commande->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); + $form->form_remise_dispo($_SERVER["PHP_SELF"].'?id='.$object->id,0,'remise_id',$soc->id,$absolute_discount,$filter, 0, '', 1); } } if ($absolute_creditnote) @@ -268,9 +356,9 @@ if ($id > 0 || ! empty($ref)) // Date print '
'.$langs->trans('Date').''; - print dol_print_date($commande->date,'daytext'); - if ($commande->hasDelay() && empty($commande->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning"); + print dol_print_date($object->date,'daytext'); + if ($object->hasDelay() && empty($object->date_livraison)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print '
id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; print '
'; if ($action == 'editdate_livraison') { - print '
'; + print ''; print ''; print ''; - $form->select_date($commande->date_livraison>0?$commande->date_livraison:-1,'liv_','','','',"setdatedelivery"); + $form->select_date($object->date_livraison>0?$object->date_livraison:-1,'liv_','','','',"setdatedelivery"); print ''; print '
'; } else { - print dol_print_date($commande->date_livraison,'daytext'); - if ($commande->hasDelay() && ! empty($commande->date_livraison)) { - print ' '.img_picto($langs->trans("Late").' : '.$commande->showDelay(), "warning"); + print dol_print_date($object->date_livraison,'daytext'); + if ($object->hasDelay() && ! empty($object->date_livraison)) { + print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } print '
'.$langs->trans('NotePublic').' :
'; - //print nl2br($commande->note_public); + //print nl2br($object->note_public); //print '
id.'">'.img_edit($langs->trans('SetShippingMode'),1).'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; print ''; if ($action == 'editshippingmethod') { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'shipping_method_id', 1); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); } else { - $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->shipping_method_id, 'none'); + $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none'); } print ''; print ''; @@ -333,34 +421,35 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Warehouse'); print ''; if ($action != 'editwarehouse' && $user->rights->commande->creer) - print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).''; + print 'id.'">'.img_edit($langs->trans('SetWarehouse'),1).''; print ''; print ''; if ($action == 'editwarehouse') { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'warehouse_id', 1); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1); } else { - $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->warehouse_id, 'none'); + $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none'); } print ''; print ''; } // Terms of payment + /* print ''; print ''; - if ($action != 'editconditions' && ! empty($commande->brouillon)) print ''; + if ($action != 'editconditions' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; if ($action == 'editconditions') { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'cond_reglement_id'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id'); } else { - $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->cond_reglement_id,'none'); + $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none'); } print ''; @@ -369,18 +458,18 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmode' && ! empty($commande->brouillon)) print ''; + if ($action != 'editmode' && ! empty($object->brouillon)) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($action == 'editmode') { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'mode_reglement_id'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id'); } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$commande->id,$commande->mode_reglement_id,'none'); + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none'); } - print ''; + print '';*/ // Availability print ''; @@ -388,13 +477,13 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('AvailabilityPeriod'); print ''; if ($action != 'editavailability') - print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetAvailability'), 1) . ''; print ''; print ''; if ($action == 'editavailability') { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'availability_id', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1); } else { - $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->availability_id, 'none', 1); + $form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1); } print ''; @@ -404,63 +493,124 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Source'); print ''; if ($action != 'editdemandreason') - print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; + print 'id . '">' . img_edit($langs->trans('SetDemandReason'), 1) . ''; print ''; print ''; if ($action == 'editdemandreason') { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'demand_reason_id', 1); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1); } else { - $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $commande->id, $commande->demand_reason_id, 'none'); + $form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none'); } - // Project - if (! empty($conf->projet->enabled)) + $tmparray=$object->getTotalWeightVolume(); + $totalWeight=$tmparray['weight']; + $totalVolume=$tmparray['volume']; + if ($totalWeight || $totalVolume) { - $langs->load('projects'); - print ''; - print ''; - if ($action != 'classify') print ''; - print '
'; - print $langs->trans('Project'); - print ''.img_edit($langs->trans('SetProject')).'
'; - print ''; - if ($action == 'classify') - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'projectid', 0, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->fk_project, 'none', 0, 0); - } - print ''; + print ''.$langs->trans("CalculatedWeight").''; + print ''; + print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND)?$conf->global->MAIN_WEIGHT_DEFAULT_ROUND:-1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT)?$conf->global->MAIN_WEIGHT_DEFAULT_UNIT:'no'); + print ''; + print ''.$langs->trans("CalculatedVolume").''; + print ''; + print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no'); + print ''; } + + // TODO How record was recorded OrderMode (llx_c_input_method) + + // Incoterms + if (!empty($conf->incoterm->enabled)) + { + print ''; + print '
'; + print $langs->trans('IncotermLabel'); + print ''; + if ($user->rights->commande->creer) print ''.img_edit().''; + else print ' '; + print '
'; + print ''; + print ''; + if ($action != 'editincoterm') + { + print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + } + else + { + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id); + } + print ''; + } + + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; - // Lignes de 3 colonnes + print ''; + print ''; + print '
'; + print '
'; + print '
'; + + print ''; + + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) + { + // Multicurrency Amount HT + print ''; + print ''; + print ''; + + // Multicurrency Amount VAT + print ''; + print ''; + print ''; + + // Multicurrency Amount TTC + print ''; + print ''; + print ''; + } + // Total HT - print ''; - print ''; + print ''; + print ''; print ''; - // Total TVA - print ''; + // Total VAT + print ''; print ''; + // Amount Local Taxes + if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) // Localtax1 + { + print ''; + print ''; + } + if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) // Localtax2 IRPF + { + print ''; + print ''; + } + // Total TTC - print ''; + print ''; print ''; - // Statut - print ''; - print ''; - print ''; - - print '
' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . '
'.$langs->trans('AmountHT').''.price($commande->total_ht, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountHT').''.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($commande->total_tva, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountVAT').''.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'
' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '' . price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency) . '
' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '' . price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency) . '
'.$langs->trans('AmountTTC').''.price($commande->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('AmountTTC').''.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'
'.$langs->trans('Status').''.$commande->getLibStatut(4).'

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

'; + + + /** * Lines or orders with quantity shipped and remain to ship - * Note: Qty shipped are already available into $commande->expeditions[fk_product] + * Note: Qty shipped are already available into $object->expeditions[fk_product] */ print ''; @@ -472,7 +622,7 @@ if ($id > 0 || ! empty($ref)) $sql.= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc'; $sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; - $sql.= " WHERE cd.fk_commande = ".$commande->id; + $sql.= " WHERE cd.fk_commande = ".$object->id; $sql.= " ORDER BY cd.rang, cd.rowid"; //print $sql; @@ -522,7 +672,7 @@ if ($id > 0 || ! empty($ref)) // Define output language if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { - $commande->fetch_thirdparty(); + $object->fetch_thirdparty(); $prod = new Product($db); $prod->id = $objp->fk_product; @@ -532,7 +682,7 @@ if ($id > 0 || ! empty($ref)) $outputlangs = $langs; $newlang=''; if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; - if (empty($newlang)) $newlang=$commande->thirdparty->default_lang; + if (empty($newlang)) $newlang=$object->thirdparty->default_lang; if (! empty($newlang)) { $outputlangs = new Translate("",$conf); @@ -594,7 +744,7 @@ if ($id > 0 || ! empty($ref)) $qtyProdCom=$objp->qty; print ''; @@ -691,7 +841,7 @@ if ($id > 0 || ! empty($ref)) print '
'; // Bouton expedier sans gestion des stocks - if (empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED)) + if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if ($user->rights->expedition->creer) { @@ -712,12 +862,12 @@ if ($id > 0 || ! empty($ref)) // Bouton expedier avec gestion des stocks - if (! empty($conf->stock->enabled) && $commande->statut == Commande::STATUS_DRAFT) + if (! empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) { print $langs->trans("ValidateOrderFirstBeforeShipment"); } - if (! empty($conf->stock->enabled) && ($commande->statut > Commande::STATUS_DRAFT && $commande->statut < Commande::STATUS_CLOSED)) + if (! empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) { if ($user->rights->expedition->creer) { @@ -726,10 +876,10 @@ if ($id > 0 || ! empty($ref)) print '
'; print ''; - //print ''; - print ''; + //print ''; + print ''; print ''; - print ''; + print ''; //print '
'; // Nb of sending products for this line of order - $qtyAlreadyShipped = (! empty($commande->expeditions[$objp->rowid])?$commande->expeditions[$objp->rowid]:0); + $qtyAlreadyShipped = (! empty($object->expeditions[$objp->rowid])?$object->expeditions[$objp->rowid]:0); print $qtyAlreadyShipped; print '
'; $langs->load("stocks"); @@ -742,7 +892,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans("WarehouseSource"); //print ''; //print ''; print ''; print ''; @@ -862,8 +839,10 @@ if ($resql) { if ($action == 'editline' && GETPOST('lineid','int') == $pdluo->id) { //Current line edit - print "\n".''; } else @@ -901,7 +881,7 @@ if ($resql) else dol_print_error($db); print ''; -print ''; +print ''; print ''; From fbdc0c25e368427e0e740ad8b9feb38955f224ce Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 11:42:03 +0100 Subject: [PATCH 49/75] Add STATUS_OPEN_INTERNAL to stock change/move pages --- htdocs/product/class/html.formproduct.class.php | 11 ++++++----- htdocs/product/stock/massstockmove.php | 4 ++-- htdocs/product/stock/mouvement.php | 2 +- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- htdocs/product/stock/tpl/stocktransfer.tpl.php | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 55e104990fc..c077859dde1 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -21,6 +21,7 @@ * \brief Fichier de la classe des fonctions predefinie de composants html */ +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; /** * Class with static methods for building HTML components related to products @@ -168,7 +169,7 @@ class FormProduct * * @param int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value) * @param string $htmlname Name of html select html - * @param string $filtertype For filter, additional filter on status other then 1 + * @param string $filterstatus For filter, additional filter on status other then 1 (open_all). No filter when empty * @param int $empty 1=Can be empty, 0 if not * @param int $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. @@ -181,15 +182,15 @@ class FormProduct * @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse * @return string HTML select */ - function selectWarehouses($selected='',$htmlname='idwarehouse',$filtertype='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='', $showfullpath=1) + function selectWarehouses($selected='',$htmlname='idwarehouse',$filterstatus='',$empty=0,$disabled=0,$fk_product=0,$empty_label='', $showstock=0, $forcecombo=0, $events=array(), $morecss='minwidth200', $exclude='', $showfullpath=1) { global $conf,$langs,$user; - dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filtertype, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss",LOG_DEBUG); + dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss",LOG_DEBUG); $out=''; - - $this->loadWarehouses($fk_product, '', + $filtertype, true, $exclude); // filter on numeric status + if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; + $this->loadWarehouses($fk_product, '', + $filterstatus, true, $exclude); // filter on numeric status $nbofwarehouses=count($this->cache_warehouses); if ($conf->use_javascript_ajax && ! $forcecombo) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 0c96d1f7a04..7a1ef75e9fd 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -383,11 +383,11 @@ if ($conf->productbatch->enabled) } // In warehouse print ''; // Out warehouse print ''; // Qty print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index e2cb108f87d..63fc770d40e 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -791,7 +791,7 @@ if ($resql) { print ''; } if (! empty($arrayfields['m.fk_user_author']['checked'])) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 0b48be2b0d5..7a64056bdfb 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -56,7 +56,7 @@ { print ''; print ''; } if ($object->element == 'stock') diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index dfddd1e19f1..8945575d258 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -63,7 +63,7 @@ { print ''; print ''; } if ($object->element == 'stock') @@ -75,7 +75,7 @@ } print ''; print ''; print ''; From 0ff21f0beebaef57301faec7840f8e4642c7df27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 12:04:22 +0100 Subject: [PATCH 50/75] Fix example --- htdocs/comm/propal/class/api_proposals.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 00850fc7adf..c1b223f6f28 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -90,7 +90,7 @@ class Proposals extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter commercial proposal of. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" * @return array Array of order objects */ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { From 761a7952949c80b464302b9c7ae087d3a65e8e86 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 13:31:29 +0100 Subject: [PATCH 51/75] Maxi debug on REST APIs --- htdocs/adherents/class/api_members.class.php | 5 +- .../class/api_subscriptions.class.php | 2 +- htdocs/api/class/api.class.php | 3 - .../class/api_dictionnarycountries.class.php | 2 +- .../api/class/api_dictionnarytowns.class.php | 2 +- htdocs/api/index.php | 19 +++- .../categories/class/api_categories.class.php | 7 +- .../class/api_deprecated_category.class.php | 8 +- .../action/class/api_agendaevents.class.php | 4 +- htdocs/comm/index.php | 2 +- .../comm/propal/class/api_proposals.class.php | 4 +- .../class/api_deprecated_commande.class.php | 4 +- htdocs/commande/class/api_orders.class.php | 6 +- .../class/api_deprecated_invoice.class.php | 4 +- .../facture/class/api_invoices.class.php | 32 +++--- htdocs/core/modules/modFournisseur.class.php | 6 +- .../class/api_expensereports.class.php | 4 +- .../fourn/class/fournisseur.facture.class.php | 102 +++++++++++++----- htdocs/fourn/commande/list.php | 2 +- htdocs/fourn/facture/list.php | 2 +- .../class/api_deprecated_product.class.php | 8 +- htdocs/product/class/api_products.class.php | 4 +- htdocs/product/class/product.class.php | 6 +- .../stock/class/api_stockmovements.class.php | 5 +- .../stock/class/api_warehouses.class.php | 5 +- htdocs/product/stock/replenish.php | 4 +- htdocs/projet/class/api_projects.class.php | 5 +- htdocs/projet/class/api_tasks.class.php | 5 +- htdocs/societe/class/api_contacts.class.php | 2 +- .../class/api_deprecated_contact.class.php | 2 +- .../class/api_deprecated_thirdparty.class.php | 4 +- .../societe/class/api_thirdparties.class.php | 4 +- htdocs/user/class/api_users.class.php | 4 +- 33 files changed, 163 insertions(+), 115 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 59d52094515..779b5213666 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -143,7 +143,7 @@ class Members extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve member list : '.$member->error); + throw new RestException(503, 'Error when retrieve member list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No member found'); @@ -289,9 +289,6 @@ class Members extends DolibarrApi * * @param object $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index 10f25e88e42..1917e3b84ed 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -135,7 +135,7 @@ class Subscriptions extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve subscription list : '.$subscription->error); + throw new RestException(503, 'Error when retrieve subscription list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No Subscription found'); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 75c814860a3..5ffae225df1 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -81,9 +81,6 @@ class DolibarrApi * * @param object $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/api/class/api_dictionnarycountries.class.php b/htdocs/api/class/api_dictionnarycountries.class.php index 9b7b409ef19..ddb3e2474a9 100644 --- a/htdocs/api/class/api_dictionnarycountries.class.php +++ b/htdocs/api/class/api_dictionnarycountries.class.php @@ -54,7 +54,7 @@ class DictionnaryCountries extends DolibarrApi * @param int $page Page number (starting from zero) * @param string $filter To filter the countries by name * @param string $lang Code of the language the label of the countries must be translated to - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return List of countries * * @throws RestException diff --git a/htdocs/api/class/api_dictionnarytowns.class.php b/htdocs/api/class/api_dictionnarytowns.class.php index b5813d07792..da58c9109eb 100644 --- a/htdocs/api/class/api_dictionnarytowns.class.php +++ b/htdocs/api/class/api_dictionnarytowns.class.php @@ -47,7 +47,7 @@ class DictionnaryTowns extends DolibarrApi * @param int $page Page number (starting from zero) * @param string $zipcode To filter on zipcode * @param string $town To filter on city name - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" * @return List of towns * * @throws RestException diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 99ad91adde9..8ad60c4b340 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -115,6 +115,10 @@ foreach ($modulesdir as $dir) elseif ($module == 'stock') { $moduledirforclass = 'product/stock'; } + elseif ($module == 'fournisseur') { + $moduledirforclass = 'fourn'; + } + //dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass); // Defined if module is enabled $enabled=true; @@ -137,6 +141,8 @@ foreach ($modulesdir as $dir) { while (($file_searched = readdir($handle_part))!==false) { + if ($file_searched == 'api_access.class.php') continue; + // Support of the deprecated API. if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg)) { @@ -144,19 +150,28 @@ foreach ($modulesdir as $dir) require_once $dir_part.$file_searched; if (class_exists($classname)) { - dol_syslog("Found deprecated API by index.php: classname=".$classname." into ".$dir." - ".$dir_part.$file_searched); + //dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched); $api->r->addAPIClass($classname, '/'); } + else + { + dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING); + } } elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg)) { $classname = ucwords($reg[1]); + $classname = str_replace('_', '', $classname); require_once $dir_part.$file_searched; if (class_exists($classname)) { - dol_syslog("Found API by index.php: classname=".$classname." into ".$dir." - ".$dir_part.$file_searched); + //dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched); $listofapis[] = $classname; } + else + { + dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING); + } } } } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 471c6b2fdde..921198ab1be 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -157,7 +157,7 @@ class Categories extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve category list : '.$category_static->error); + throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); @@ -243,7 +243,7 @@ class Categories extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve category list : '.$category_static->error); + throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); @@ -346,9 +346,6 @@ class Categories extends DolibarrApi * * @param Categorie $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 2cb25b70779..8ec125290c5 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -152,13 +152,13 @@ class CategoryApi extends DolibarrApi $obj = $db->fetch_object($result); $category_static = new Categorie($db); if($category_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($category_static); + $obj_ret[] = $this->_cleanObjectDatas($category_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve category list : '.$category_static->error); + throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); @@ -233,13 +233,13 @@ class CategoryApi extends DolibarrApi $obj = $db->fetch_object($result); $category_static = new Categorie($db); if($category_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($category_static); + $obj_ret[] = $this->_cleanObjectDatas($category_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve category list : '.$category_static->error); + throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No category found'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 3c2f84b4700..931283b0ab0 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -146,13 +146,13 @@ class AgendaEvents extends DolibarrApi $obj = $db->fetch_object($result); $actioncomm_static = new ActionComm($db); if($actioncomm_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($actioncomm_static); + $obj_ret[] = $this->_cleanObjectDatas($actioncomm_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve Agenda Event list'); + throw new RestException(503, 'Error when retrieve Agenda Event list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No Agenda Event found'); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index ad2bf294e6b..4e99b7072fc 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -385,7 +385,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cf.fk_soc = s.rowid"; $sql.= " AND cf.fk_statut = 0"; - $sql.= " AND cf.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND cf.fk_soc = ".$socid; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index c1b223f6f28..b4a15c2aa97 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -150,13 +150,13 @@ class Proposals extends DolibarrApi $obj = $db->fetch_object($result); $propal_static = new Propal($db); if($propal_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($propal_static); + $obj_ret[] = $this->_cleanObjectDatas($propal_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve propal list'); + throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No order found'); diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index b0b22764ec7..f5d799dd477 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -167,13 +167,13 @@ class CommandeApi extends DolibarrApi $obj = $db->fetch_object($result); $commande_static = new Commande($db); if($commande_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($commande_static); + $obj_ret[] = $this->_cleanObjectDatas($commande_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list'); + throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No commande found'); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 646e9ead270..cc186367588 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -94,6 +94,8 @@ class Orders extends DolibarrApi * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of order objects + * + * @throws RestException */ function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { global $db, $conf; @@ -153,13 +155,13 @@ class Orders extends DolibarrApi $obj = $db->fetch_object($result); $commande_static = new Commande($db); if($commande_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($commande_static); + $obj_ret[] = $this->_cleanObjectDatas($commande_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve commande list'); + throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No order found'); diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index a2706b3150f..b87bb2e9dc0 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -165,13 +165,13 @@ class InvoiceApi extends DolibarrApi $obj = $db->fetch_object($result); $invoice_static = new Facture($db); if($invoice_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($invoice_static); + $obj_ret[] = $this->_cleanObjectDatas($invoice_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve invoice list'); + throw new RestException(503, 'Error when retrieve invoice list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No invoice found'); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index e0a2e12695a..888c05bff26 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -83,23 +83,23 @@ class Invoices extends DolibarrApi * * Get a list of invoices * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $socid Filter list with thirdparty ID - * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @return array Array of invoice objects + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter orders of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of invoice objects * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid=0, $status='', $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { global $db, $conf; $obj_ret = array(); - - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $socid; + // case of external user, $thirdpartyid param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; @@ -112,7 +112,7 @@ class Invoices extends DolibarrApi $sql.= ' WHERE t.entity IN ('.getEntity('facture', 1).')'; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; - if ($socid) $sql.= " AND t.fk_soc = ".$socid; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale // Filter by status @@ -156,13 +156,13 @@ class Invoices extends DolibarrApi $obj = $db->fetch_object($result); $invoice_static = new Facture($db); if($invoice_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($invoice_static); + $obj_ret[] = $this->_cleanObjectDatas($invoice_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve invoice list'); + throw new RestException(503, 'Error when retrieve invoice list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No invoice found'); @@ -255,7 +255,7 @@ class Invoices extends DolibarrApi throw new RestException(404, 'Invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('facture',$this->facture->id)) { + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } @@ -267,7 +267,7 @@ class Invoices extends DolibarrApi return array( 'success' => array( 'code' => 200, - 'message' => 'Facture deleted' + 'message' => 'Invoice deleted' ) ); } diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index c0203f7e490..2999bddd1bd 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -380,7 +380,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture_fourn'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture_fournisseur',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; $r++; @@ -443,7 +443,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn as p ON pf.fk_paiementfourn = p.rowid'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('facture_fournisseur',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; // Order @@ -552,7 +552,7 @@ class modFournisseur extends DolibarrModules $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields as extraline ON fd.rowid = extraline.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; $this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande'; - $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('commande_fournisseur',1).')'; + $this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')'; if(!$user->rights->societe->client->voir) $this->export_sql_end[$r] .=' AND sc.fk_user = '.$user->id; } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index ce7ce544f12..bf07089b71b 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -144,13 +144,13 @@ class ExpenseReports extends DolibarrApi $obj = $db->fetch_object($result); $expensereport_static = new ExpenseReport($db); if($expensereport_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($expensereport_static); + $obj_ret[] = $this->_cleanObjectDatas($expensereport_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve Expense Report list'); + throw new RestException(503, 'Error when retrieve Expense Report list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No Expense Report found'); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index af7bec526a6..878c0886918 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -208,7 +208,7 @@ class FactureFournisseur extends CommonInvoice * Create supplier invoice into database * * @param User $user object utilisateur qui cree - * @return int id facture si ok, < 0 si erreur + * @return int Id invoice created if OK, < 0 if KO */ public function create($user) { @@ -313,32 +313,84 @@ class FactureFournisseur extends CommonInvoice } } - foreach ($this->lines as $i => $val) - { - $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; - $sql .= ' VALUES ('.$this->id.');'; - - dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql_insert=$this->db->query($sql); - if ($resql_insert) + if (count($this->lines) && is_object($this->lines[0])) // If this->lines is array of InvoiceLines (preferred mode) + { + dol_syslog("There is ".count($this->lines)." lines that are invoice lines objects"); + foreach ($this->lines as $i => $val) { - $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); - - $this->updateline( - $idligne, - $this->lines[$i]->description, - $this->lines[$i]->pu_ht, - $this->lines[$i]->tva_tx, - $this->lines[$i]->localtax1_tx, - $this->lines[$i]->localtax2_tx, - $this->lines[$i]->qty, - $this->lines[$i]->fk_product, - 'HT', - (! empty($this->lines[$i]->info_bits)?$this->lines[$i]->info_bits:''), - $this->lines[$i]->product_type - ); + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; + $sql .= ' VALUES ('.$this->id.')'; + + $resql_insert=$this->db->query($sql); + if ($resql_insert) + { + $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); + + var_dump($this->lines[$i]);exit; + $this->updateline( + $idligne, + $this->lines[$i]->description, + $this->lines[$i]->pu_ht, + $this->lines[$i]->tva_tx, + $this->lines[$i]->localtax1_tx, + $this->lines[$i]->localtax2_tx, + $this->lines[$i]->qty, + $this->lines[$i]->fk_product, + 'HT', + (! empty($this->lines[$i]->info_bits)?$this->lines[$i]->info_bits:''), + $this->lines[$i]->product_type + ); + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -5; + } } - } + } + else // If this->lines is an array of invoice line arrays + { + dol_syslog("There is ".count($this->lines)." lines that are array lines"); + foreach ($this->lines as $i => $val) + { + $line = $this->lines[$i]; + + // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array + //if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object. + if (! is_object($line)) $line = (object) $line; + + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)'; + $sql .= ' VALUES ('.$this->id.')'; + + $resql_insert=$this->db->query($sql); + if ($resql_insert) + { + $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); + + $this->updateline( + $idligne, + $line->description, + $line->pu_ht, + $line->tva_tx, + $line->localtax1_tx, + $line->localtax2_tx, + $line->qty, + $line->fk_product, + 'HT', + (! empty($line->info_bits)?$line->info_bits:''), + $line->product_type + ); + } + else + { + $this->error=$this->db->lasterror(); + $this->db->rollback(); + return -5; + } + } + } + // Update total price $result=$this->update_price(); if ($result > 0) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 706ca4e143f..97153d94e2f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -293,7 +293,7 @@ if ($search_user > 0) $sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc"; } $sql.= ' WHERE cf.fk_soc = s.rowid'; -$sql.= ' AND cf.entity IN ('.getEntity('commande_fournisseur', 1).')'; +$sql.= ' AND cf.entity IN ('.getEntity('supplier_order', 1).')'; if ($socid > 0) $sql.= " AND s.rowid = ".$socid; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($search_ref) $sql .= natural_search('cf.ref', $search_ref); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 84b91bd3a27..a66e624619c 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -248,7 +248,7 @@ llxHeader('',$langs->trans("SuppliersInvoices"),'EN:Suppliers_Invoices|FR:Factur $sql = "SELECT"; if ($search_all || $search_product_category > 0) $sql = 'SELECT DISTINCT'; $sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.datef, f.date_lim_reglement as datelimite, f.fk_mode_reglement,"; -$sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label,"; +$sql.= " f.total_ht, f.total_ttc, f.total_tva as total_vat, f.paye as paye, f.fk_statut as fk_statut, f.libelle as label, f.datec as date_creation, f.tms as date_update,"; $sql.= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,"; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; diff --git a/htdocs/product/class/api_deprecated_product.class.php b/htdocs/product/class/api_deprecated_product.class.php index cdda0c45fbb..938e591226f 100644 --- a/htdocs/product/class/api_deprecated_product.class.php +++ b/htdocs/product/class/api_deprecated_product.class.php @@ -154,13 +154,13 @@ class ProductApi extends DolibarrApi $obj = $db->fetch_object($result); $product_static = new Product($db); if($product_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($product_static); + $obj_ret[] = $this->_cleanObjectDatas($product_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve product list'); + throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No product found'); @@ -240,13 +240,13 @@ class ProductApi extends DolibarrApi $obj = $db->fetch_object($result); $product_static = new Product($db); if($product_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($product_static); + $obj_ret[] = $this->_cleanObjectDatas($product_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve product list'); + throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No product found'); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 0c08fb0dc35..19fae0b6342 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -151,13 +151,13 @@ class Products extends DolibarrApi $obj = $db->fetch_object($result); $product_static = new Product($db); if($product_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($product_static); + $obj_ret[] = $this->_cleanObjectDatas($product_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve product list'); + throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No product found'); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb122dc70e8..46da76a5f57 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2054,7 +2054,7 @@ class Product extends CommonObject if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.rowid = cd.fk_commande"; $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sql.= " AND c.entity IN (".getEntity('supplier_order', 1).")"; $sql.= " AND cd.fk_product = ".$this->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; @@ -2142,7 +2142,7 @@ class Product extends CommonObject if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cf.rowid = fd.fk_commande"; $sql.= " AND cf.fk_soc = s.rowid"; - $sql.= " AND cf.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")"; $sql.= " AND fd.fk_product = ".$this->id; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND cf.fk_soc = ".$socid; @@ -2530,7 +2530,7 @@ class Product extends CommonObject else $sql.=" AND d.fk_product > 0"; if ($filteronproducttype >= 0) $sql.= " AND p.rowid = d.fk_product AND p.fk_product_type =".$filteronproducttype; $sql.= " AND c.fk_soc = s.rowid"; - $sql.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sql.= " AND c.entity IN (".getEntity('supplier_order', 1).")"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid > 0) $sql.= " AND c.fk_soc = ".$socid; $sql.= " GROUP BY date_format(c.date_commande,'%Y%m')"; diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index a246e7fc135..677d34d9fcb 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -144,7 +144,7 @@ class StockMovements extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve stock movement list : '.$stockmovement_static->error); + throw new RestException(503, 'Error when retrieve stock movement list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No stock movement found'); @@ -277,9 +277,6 @@ class StockMovements extends DolibarrApi * * @param MouvementStock $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 79eefc821c3..d19918f0789 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -142,7 +142,7 @@ class Warehouses extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve warehouse list : '.$warehouse_static->error); + throw new RestException(503, 'Error when retrieve warehouse list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No warehouse found'); @@ -246,9 +246,6 @@ class Warehouses extends DolibarrApi * * @param Entrepot $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 5281d913d95..bb755868f24 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -352,14 +352,14 @@ if ($usevirtualstock) $sqlCommandesFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd"; $sqlCommandesFourn.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sqlCommandesFourn.= " WHERE c.rowid = cd.fk_commande"; - $sqlCommandesFourn.= " AND c.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sqlCommandesFourn.= " AND c.entity IN (".getEntity('supplier_order', 1).")"; $sqlCommandesFourn.= " AND cd.fk_product = p.rowid"; $sqlCommandesFourn.= " AND c.fk_statut IN (3,4))"; $sqlReceptionFourn = "(SELECT ".$db->ifsql("SUM(fd.qty) IS NULL", "0", "SUM(fd.qty)")." as qty"; $sqlReceptionFourn.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sqlReceptionFourn.= " LEFT JOIN ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as fd ON (fd.fk_commande = cf.rowid)"; - $sqlReceptionFourn.= " WHERE cf.entity IN (".getEntity('commande_fournisseur', 1).")"; + $sqlReceptionFourn.= " WHERE cf.entity IN (".getEntity('supplier_order', 1).")"; $sqlReceptionFourn.= " AND fd.fk_product = p.rowid"; $sqlReceptionFourn.= " AND cf.fk_statut IN (3,4))"; diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index f36df0773eb..2b5ee92d878 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -162,7 +162,7 @@ class Projects extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve project list'); + throw new RestException(503, 'Error when retrieve project list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No project found'); @@ -531,9 +531,6 @@ class Projects extends DolibarrApi * * @param object $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index a5bab614a4a..c88850ca403 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -169,7 +169,7 @@ class Tasks extends DolibarrApi } } else { - throw new RestException(503, 'Error when retrieve task list'); + throw new RestException(503, 'Error when retrieve task list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No task found'); @@ -544,9 +544,6 @@ class Tasks extends DolibarrApi * * @param object $object Object to clean * @return array Array of cleaned object properties - * - * @todo use an array for properties to clean - * */ function _cleanObjectDatas($object) { diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 775d9d48cf4..9f09f7f7408 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -160,7 +160,7 @@ class Contacts extends DolibarrApi $contact_static = new Contact($db); if ($contact_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($contact_static); + $obj_ret[] = $this->_cleanObjectDatas($contact_static); } $i++; } diff --git a/htdocs/societe/class/api_deprecated_contact.class.php b/htdocs/societe/class/api_deprecated_contact.class.php index d3d085e7135..e229dc5f79b 100644 --- a/htdocs/societe/class/api_deprecated_contact.class.php +++ b/htdocs/societe/class/api_deprecated_contact.class.php @@ -173,7 +173,7 @@ class ContactApi extends DolibarrApi $contact_static = new Contact($db); if ($contact_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($contact_static); + $obj_ret[] = $this->_cleanObjectDatas($contact_static); } $i++; } diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 3e937557941..6086f2366d8 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -218,13 +218,13 @@ class ThirdpartyApi extends DolibarrApi $obj = $db->fetch_object($result); $soc_static = new Societe($db); if($soc_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($soc_static); + $obj_ret[] = $this->_cleanObjectDatas($soc_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve thirdparties : ' . $sql); + throw new RestException(503, 'Error when retrieve thirdparties : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'Thirdparties not found'); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 13f28aea705..bc156b5cc4a 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -159,13 +159,13 @@ class Thirdparties extends DolibarrApi $obj = $db->fetch_object($result); $soc_static = new Societe($db); if($soc_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($soc_static); + $obj_ret[] = $this->_cleanObjectDatas($soc_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve thirdparties : ' . $sql); + throw new RestException(503, 'Error when retrieve thirdparties : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'Thirdparties not found'); diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index db18bea229a..3fc44104628 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -111,13 +111,13 @@ class Users extends DolibarrApi $obj = $db->fetch_object($result); $user_static = new User($db); if($user_static->fetch($obj->rowid)) { - $obj_ret[] = parent::_cleanObjectDatas($user_static); + $obj_ret[] = $this->_cleanObjectDatas($user_static); } $i++; } } else { - throw new RestException(503, 'Error when retrieve User list'); + throw new RestException(503, 'Error when retrieve User list : '.$db->lasterror()); } if( ! count($obj_ret)) { throw new RestException(404, 'No User found'); From 5edf215b74aab9392f49103bf3068293d60650d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 13:32:08 +0100 Subject: [PATCH 52/75] Add missing api file --- .../class/api_supplier_invoices.class.php | 310 ++++++++++++++++++ 1 file changed, 310 insertions(+) create mode 100644 htdocs/fourn/class/api_supplier_invoices.class.php diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php new file mode 100644 index 00000000000..660e64147ed --- /dev/null +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -0,0 +1,310 @@ + + * Copyright (C) 2016 Laurent Destailleur + * + * 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 . + */ + + use Luracast\Restler\RestException; + + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + +/** + * API class for supplier invoices + * + * @access protected + * @class DolibarrApiAccess {@requires user,external} + */ +class SupplierInvoices extends DolibarrApi +{ + /** + * + * @var array $FIELDS Mandatory fields, checked when create and update object + */ + static $FIELDS = array( + 'socid' + ); + + /** + * @var FactureFournisseur $invoice {@type FactureFournisseur} + */ + public $invoice; + + /** + * Constructor + */ + function __construct() + { + global $db, $conf; + $this->db = $db; + $this->invoice = new FactureFournisseur($this->db); + } + + /** + * Get properties of a supplier invoice object + * + * Return an array with supplier invoice information + * + * @param int $id ID of supplier invoice + * @return array|mixed data without useless information + * + * @throws RestException + */ + function get($id) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->lire) { + throw new RestException(401); + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Supplier invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + return $this->_cleanObjectDatas($this->invoice); + } + + /** + * List invoices + * + * Get a list of supplier invoices + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter invoices of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $status Filter by invoice status : draft | unpaid | paid | cancelled + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')" + * @return array Array of invoice objects + * + * @throws RestException + */ + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') { + global $db, $conf; + + $obj_ret = array(); + // case of external user, $thirdpartyid param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; + + // If the internal user must only see his customers, force searching by him + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + + $sql = "SELECT t.rowid"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as t"; + + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + + $sql.= ' WHERE t.entity IN ('.getEntity('supplier_invoice', 1).')'; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale + + // Filter by status + if ($status == 'draft') $sql.= " AND t.fk_statut IN (0)"; + if ($status == 'unpaid') $sql.= " AND t.fk_statut IN (1)"; + if ($status == 'paid') $sql.= " AND t.fk_statut IN (2)"; + if ($status == 'cancelled') $sql.= " AND t.fk_statut IN (3)"; + // Insert sale filter + if ($search_sale > 0) + { + $sql .= " AND sc.fk_user = ".$search_sale; + } + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + $sql.= $db->order($sortfield, $sortorder); + if ($limit) { + if ($page < 0) + { + $page = 0; + } + $offset = $limit * $page; + + $sql.= $db->plimit($limit + 1, $offset); + } + + $result = $db->query($sql); + if ($result) + { + $num = $db->num_rows($result); + while ($i < min($num, ($limit <= 0 ? $num : $limit))) + { + $obj = $db->fetch_object($result); + $invoice_static = new FactureFournisseur($db); + if($invoice_static->fetch($obj->rowid)) { + $obj_ret[] = $this->_cleanObjectDatas($invoice_static); + } + $i++; + } + } + else { + throw new RestException(503, 'Error when retrieve supplier invoice list : '.$db->lasterror()); + } + if( ! count($obj_ret)) { + throw new RestException(404, 'No supplier invoice found'); + } + return $obj_ret; + } + + /** + * Create supplier invoice object + * + * @param array $request_data Request datas + * @return int ID of supplier invoice + */ + function post($request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + throw new RestException(401, "Insuffisant rights"); + } + // Check mandatory fields + $result = $this->_validate($request_data); + + foreach($request_data as $field => $value) { + $this->invoice->$field = $value; + } + if(! array_keys($request_data,'date')) { + $this->invoice->date = dol_now(); + } + /* We keep lines as an array + if (isset($request_data["lines"])) { + $lines = array(); + foreach ($request_data["lines"] as $line) { + array_push($lines, (object) $line); + } + $this->invoice->lines = $lines; + }*/ + + if ($this->invoice->create(DolibarrApiAccess::$user) <= 0) { + $errormsg = $this->invoice->error; + throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); + } + return $this->invoice->id; + } + + /** + * Update supplier invoice + * + * @param int $id Id of supplier invoice to update + * @param array $request_data Datas + * @return int + */ + function put($id, $request_data = NULL) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + throw new RestException(401); + } + + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Supplier invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + foreach($request_data as $field => $value) { + if ($field == 'id') continue; + $this->invoice->$field = $value; + } + + if($this->invoice->update($id, DolibarrApiAccess::$user)) + return $this->get ($id); + + return false; + } + + /** + * Delete supplier invoice + * + * @param int $id Supplier invoice ID + * @return type + */ + function delete($id) + { + if(! DolibarrApiAccess::$user->rights->fournisseur->facture->supprimer) { + throw new RestException(401); + } + $result = $this->invoice->fetch($id); + if( ! $result ) { + throw new RestException(404, 'Supplier invoice not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('facture',$this->invoice->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + if( $this->invoice->delete($id) < 0) + { + throw new RestException(500); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Supplier invoice deleted' + ) + ); + } + + + /** + * Clean sensible object datas + * + * @param Object $object Object to clean + * @return array Array of cleaned object properties + */ + function _cleanObjectDatas($object) { + + $object = parent::_cleanObjectDatas($object); + + unset($object->rowid); + + return $object; + } + + /** + * Validate fields before create or update object + * + * @param array $data Datas to validate + * @return array + * + * @throws RestException + */ + function _validate($data) + { + $invoice = array(); + foreach (Invoices::$FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $invoice[$field] = $data[$field]; + } + return $invoice; + } +} From 1a842d8366ff653d1e85deccc59dc66560764d71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 13:45:57 +0100 Subject: [PATCH 53/75] Fix translation --- htdocs/contact/card.php | 6 +++--- htdocs/core/lib/company.lib.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 5050e6f7c9b..e7896d9b9ac 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1183,10 +1183,10 @@ else print ''; print ''; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 948ce7271da..b9619c278bd 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1390,7 +1390,7 @@ function show_subsidiaries($conf,$langs,$db,$object) { $socstatic = new Societe($db); - print load_fiche_titre($langs->trans("Subsidiaries")); + print load_fiche_titre($langs->trans("Subsidiaries"), '', ''); print "\n".'
'; - print $formproduct->selectWarehouses(! empty($commande->warehouse_id)?$commande->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); + print $formproduct->selectWarehouses(! empty($object->warehouse_id)?$object->warehouse_id:-1, 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200'); if (count($formproduct->cache_warehouses) <= 0) { print '   '.$langs->trans("WarehouseSourceNotDefined").' '.$langs->trans("AddOne").''; @@ -773,7 +923,7 @@ if ($id > 0 || ! empty($ref)) } } - show_list_sending_receive('commande',$commande->id); + show_list_sending_receive('commande',$object->id); } else { diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang index 62ffb02bbcf..b752426b452 100644 --- a/htdocs/langs/en_US/orders.lang +++ b/htdocs/langs/en_US/orders.lang @@ -53,6 +53,7 @@ StatusOrderBilled=Billed StatusOrderReceivedPartially=Partially received StatusOrderReceivedAll=Everything received ShippingExist=A shipment exists +QtyOrdered=Qty ordered ProductQtyInDraft=Product quantity into draft orders ProductQtyInDraftOrWaitingApproved=Product quantity into draft or approved orders, not yet ordered MenuOrdersToBill=Orders delivered diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b00dbc174e6..c53221b3951 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2380,7 +2380,7 @@ div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border vertical-align: middle; } div .tdtop { - vertical-align: top; + vertical-align: top !important; padding-top: 5px !important; padding-bottom: 0px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index e192501354d..997b7d33dcd 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2768,6 +2768,11 @@ div.tabBar .noborder { -webkit-box-shadow: 0px 0px 0px #f4f4f4 !important; box-shadow: 0px 0px 0px #f4f4f4 !important; } +div .tdtop { + vertical-align: top !important; + padding-top: 5px !important; + padding-bottom: 0px; +} #tablelines tr.liste_titre td, .paymenttable tr.liste_titre td, .margintable tr.liste_titre td, .tableforservicepart1 tr.liste_titre td { border-bottom: 1px solid #AAA !important; From 8c428ac5b750255c82cf9b6827c15876e0f10b68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 00:51:15 +0100 Subject: [PATCH 43/75] Fix responsive design --- htdocs/admin/company.php | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 4ebbd2096f9..f114e117b6d 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -306,12 +306,12 @@ if ($action == 'edit' || $action == 'updateedit') $var=true; print ''; - print ''."\n"; + print ''."\n"; // Name $var=!$var; print ''."\n"; + print ''."\n"; // Addresse $var=!$var; @@ -320,11 +320,11 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''."\n"; + print ''."\n"; $var=!$var; print ''."\n"; + print ''."\n"; // Country $var=!$var; @@ -356,20 +356,20 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; + print ''; print ''."\n"; // Web $var=!$var; print ''; + print ''; print ''."\n"; // Barcode if (! empty($conf->barcode->enabled)) { $var=!$var; print ''; + print ''; print ''; } @@ -377,7 +377,7 @@ if ($action == 'edit' || $action == 'updateedit') $var=!$var; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; if ($conf->global->PRODUCT_USE_UNITS) print ''; print ''; @@ -1606,7 +1608,7 @@ else } // Ligne en mode update else - { + { // Ligne carac print ""; print ' +global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; } diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 9b65050b663..2fd59793a09 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -243,3 +243,6 @@ ALTER TABLE llx_expensereport ADD UNIQUE INDEX idx_expensereport_uk_ref (ref, en UPDATE llx_projet_task SET ref = NULL WHERE ref = ''; ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity); + +ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer; + diff --git a/htdocs/install/mysql/tables/llx_contrat.sql b/htdocs/install/mysql/tables/llx_contrat.sql index f229f020bf6..60a6b574d44 100644 --- a/htdocs/install/mysql/tables/llx_contrat.sql +++ b/htdocs/install/mysql/tables/llx_contrat.sql @@ -38,6 +38,7 @@ create table llx_contrat fk_commercial_signature integer, -- obsolete fk_commercial_suivi integer, -- obsolete fk_user_author integer NOT NULL default 0, + fk_user_modif integer, fk_user_mise_en_service integer, fk_user_cloture integer, note_private text, diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 19f6dfe9d81..82ff69fe88a 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -231,7 +231,7 @@ SpaceX=Space X SpaceY=Space Y FontSize=Font size Content=Content -NoticePeriod=Notice +NoticePeriod=Notice period NewByMonth=New by month Emails=E-mails EMailsSetup=E-mails setup diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 9aae20a6300..09f1604e931 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -674,14 +674,12 @@ elseif ($object->id > 0) } - print ''; print ''; print ''; print ''; print ''; - $head=project_prepare_head($object); dol_fiche_head($head, 'project', $langs->trans("Project"),0,($object->public?'projectpub':'project')); From 4b831537e501afdcbefe909edb87ffda713db083 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 21:27:08 +0100 Subject: [PATCH 46/75] Fix several problem in notes management of template invoices. --- htdocs/compta/facture.php | 48 ++++++- htdocs/compta/facture/class/facture.class.php | 39 +++++- htdocs/compta/facture/fiche-rec.php | 130 ++++++++++-------- htdocs/contrat/card.php | 2 +- htdocs/core/lib/functions.lib.php | 1 + htdocs/langs/en_US/bills.lang | 2 +- 6 files changed, 159 insertions(+), 63 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 07cb56b830b..839841e4cf9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -898,7 +898,7 @@ if (empty($reshook)) } } - // Standard or deposit or proforma invoice + // Standard or deposit or proforma invoice, not from a Predefined template invoice if (($_POST['type'] == Facture::TYPE_STANDARD || $_POST['type'] == Facture::TYPE_DEPOSIT || $_POST['type'] == Facture::TYPE_PROFORMA || ($_POST['type'] == Facture::TYPE_SITUATION && empty($_POST['situations']))) && GETPOST('fac_rec') <= 0) { if (GETPOST('socid', 'int') < 1) @@ -2075,6 +2075,8 @@ if ($action == 'create') } print '' . "\n"; + $exampletemplateinvoice=new FactureRec($db); + // Overwrite value if creation of invoice is from a predefined invoice if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0) { @@ -2109,7 +2111,10 @@ if ($action == 'create') $objp = $db->fetch_object($resql); print ''; $i ++; } @@ -2387,9 +2392,10 @@ if ($action == 'create') print ''; } + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + // Date invoice print ''; @@ -2474,9 +2480,39 @@ if ($action == 'create') print ''; } + // Help of substitution key + $htmltext=''; + if (GETPOST('fac_rec','int') > 0) + { + $dateexample=dol_now(); + if (! empty($datefacture?$datefacture:$dateinvoice)) $dateexample=($datefacture?$datefacture:$dateinvoice); + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + } + // Public note print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; - // Note public - print ''; + $note_public=GETPOST('note_public')?GETPOST('note_public'):$object->note_public; + $note_private=GETPOST('note_private')?GETPOST('note_private'):$object->note_private; - // Note private - print ''; + // Help of substitution key + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + + // Public note + print ''; + print ''; + print ''; + print ''; + print ''; + } // Author print ""; @@ -941,7 +980,7 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled) && is_object($object->thirdparty) && $object->thirdparty->id > 0) { - $projectid = $object->fk_project; + $projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project; $langs->load('projects'); print '"; // First date of execution for cron @@ -1130,21 +1169,6 @@ else print '
'; print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; - print '
'; print ''; print ''; @@ -410,13 +410,13 @@ if ($action == 'edit' || $action == 'updateedit') // Managing Director(s) $var=!$var; - print ''; + print ''; // Capital $var=!$var; - print ''; + print ''; // Juridical Status $var=!$var; @@ -432,10 +432,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''; // Object of the company $var=!$var; - print ''; print ''; @@ -543,12 +543,12 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print '
'; - print ''; + print ''; print ''; if (! empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; @@ -393,7 +393,7 @@ if ($action == 'edit' || $action == 'updateedit') // Note $var=!$var; - print '
'; + print '
'; print '
'; - print '
'; + print '
'; - print '
'; + print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -448,10 +448,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -464,10 +464,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -480,10 +480,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -496,10 +496,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -512,10 +512,10 @@ if ($action == 'edit' || $action == 'updateedit') if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print '
'; + print '
'; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -526,13 +526,13 @@ if ($action == 'edit' || $action == 'updateedit') // TVA Intra $var=!$var; - print '
'; - print ''; + print '
'; + print ''; print '
'; + print '
'; print '
'; print ''; - print ''; + print ''; print "\n"; $var=true; $var=!$var; - print ''; print "
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'; + print '
'; print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '
"; @@ -558,7 +558,7 @@ if ($action == 'edit' || $action == 'updateedit') print '
'; print ''; print ''; - print ''; + print ''; print ''; print "\n"; $var=true; From 211436b436cdf6560900c775eb99593712c28774 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 01:12:52 +0100 Subject: [PATCH 44/75] Better responsive --- htdocs/admin/company.php | 64 +++++++++++++++++---------------- htdocs/theme/eldy/style.css.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f114e117b6d..3d7202d5c70 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -699,19 +699,19 @@ else $var=true; $var=!$var; - print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; print ''; $var=!$var; - print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; $var=!$var; - print ''; + print ''; // Web $var=!$var; - print ''; + print ''; // Barcode if (! empty($conf->barcode->enabled)) { $var=!$var; - print ''; + print ''; } // Logo $var=!$var; - print ''; $var=!$var; - print ''; + print ''; print '
'.$langs->trans("VATManagement").''.$langs->trans("Description").''.$langs->trans("VATManagement").''.$langs->trans("Description").' 
'.$langs->trans("CompanyName").''; + print '
'.$langs->trans("CompanyName").''; if (! empty($conf->global->MAIN_INFO_SOCIETE_NOM)) print $conf->global->MAIN_INFO_SOCIETE_NOM; else print img_warning().' '.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("CompanyName")).''; print '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyAddress").'' . nl2br(empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyZip").'' . (empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyTown").'' . (empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN) . '
'.$langs->trans("CompanyCountry").''; @@ -731,7 +731,7 @@ else print '
'.$langs->trans("CompanyCurrency").''; + print '
'.$langs->trans("CompanyCurrency").''; print currency_name($conf->currency,1); print ' ('.$conf->currency; print ($conf->currency != $langs->getCurrencySymbol($conf->currency) ? ' - '.$langs->getCurrencySymbol($conf->currency) : ''); @@ -739,52 +739,54 @@ else print '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Phone").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_TEL,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Fax").'' . dol_print_phone($conf->global->MAIN_INFO_SOCIETE_FAX,$mysoc->country_code) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Mail").'' . dol_print_email($conf->global->MAIN_INFO_SOCIETE_MAIL,0,0,0,80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Gencod").'' . $conf->global->MAIN_INFO_SOCIETE_GENCOD . '
'.$langs->trans("Logo").''; + print '
'.$langs->trans("Logo").''; - print '
'; + $tagtd='tagtd '; + if ($conf->browser->layout == 'phone') $tagtd=''; + print '
'; print $mysoc->logo; - print '
'; + print '
'; // It offers the generation of the thumbnail if it does not exist if (!is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini) && preg_match('/(\.jpg|\.jpeg|\.png)$/i',$mysoc->logo)) { - print 'logo).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').'  '; + print '  '; } else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print ''; + print ''; } else { - print ''; + print ''; } - print '
'; + print ''; print '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'.$langs->trans("Note").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? nl2br($conf->global->MAIN_INFO_SOCIETE_NOTE) : '') . '
'; @@ -796,22 +798,22 @@ else print ''; print ''; print ''; - print ''; + print ''; $var=true; // Managing Director(s) $var=!$var; - print ''; // Capital $var=!$var; - print ''; // Juridical Status $var=!$var; - print ''; @@ -819,7 +821,7 @@ else if ($langs->transcountry("ProfId1",$mysoc->country_code) != '-') { $var=!$var; - print ''; $var=!$var; - print ''; + print ''; print '
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("CompanyIds").''.$langs->trans("Value").'
'.$langs->trans("ManagingDirectors").''; + print '
'.$langs->trans("ManagingDirectors").''; print $conf->global->MAIN_INFO_SOCIETE_MANAGERS . '
'.$langs->trans("Capital").''; + print '
'.$langs->trans("Capital").''; print $conf->global->MAIN_INFO_CAPITAL . '
'.$langs->trans("JuridicalStatus").''; + print '
'.$langs->trans("JuridicalStatus").''; print getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId1",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIREN)) { print $conf->global->MAIN_INFO_SIREN; @@ -835,7 +837,7 @@ else if ($langs->transcountry("ProfId2",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId2",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_SIRET)) { print $conf->global->MAIN_INFO_SIRET; @@ -851,7 +853,7 @@ else if ($langs->transcountry("ProfId3",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId3",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_APE)) { print $conf->global->MAIN_INFO_APE; @@ -867,7 +869,7 @@ else if ($langs->transcountry("ProfId4",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId4",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_RCS)) { print $conf->global->MAIN_INFO_RCS; @@ -883,7 +885,7 @@ else if ($langs->transcountry("ProfId5",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId5",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID5)) { print $conf->global->MAIN_INFO_PROFID5; @@ -899,7 +901,7 @@ else if ($langs->transcountry("ProfId6",$mysoc->country_code) != '-') { $var=!$var; - print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; + print '
'.$langs->transcountry("ProfId6",$mysoc->country_code).''; if (! empty($conf->global->MAIN_INFO_PROFID6)) { print $conf->global->MAIN_INFO_PROFID6; @@ -950,7 +952,7 @@ else print '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'.$langs->trans("CompanyObject").'' . (! empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? nl2br($conf->global->MAIN_INFO_SOCIETE_OBJECT) : '') . '
'; print ''; @@ -961,12 +963,12 @@ else print '
'; print ''; print ''; - print ''; + print ''; print "\n"; $var=true; $var=!$var; - print ''; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index c53221b3951..5de31c6ee59 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1439,7 +1439,7 @@ table.login_table_securitycode tr td { #img_securitycode { border: 1px solid #DDDDDD; } -#img_logo { +#img_logo, .img_logo { max-width: 200px; max-height: 100px; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 997b7d33dcd..0edf06380f5 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1479,7 +1479,7 @@ table.login_table_securitycode tr td { #img_securitycode { border: 1px solid #f4f4f4; } -#img_logo { +#img_logo, .img-logo { max-width: 200px; max-height: 100px; } From 788cbf9a01198eccb58e1da6f91d8840ed5441cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 4 Dec 2016 13:30:17 +0100 Subject: [PATCH 45/75] Complete work on dol_banner on contracts --- htdocs/contrat/card.php | 164 +++++++++--------- htdocs/contrat/class/contrat.class.php | 3 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/html.form.class.php | 5 +- htdocs/core/lib/functions.lib.php | 5 +- htdocs/core/tpl/objectline_create.tpl.php | 2 +- .../install/mysql/migration/4.0.0-5.0.0.sql | 3 + htdocs/install/mysql/tables/llx_contrat.sql | 1 + htdocs/langs/en_US/admin.lang | 2 +- htdocs/projet/card.php | 2 - 10 files changed, 97 insertions(+), 92 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index c6e9a12e338..2d53eb6abbb 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -121,7 +121,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (! GETPOST('dateend')) @@ -999,7 +999,8 @@ llxHeader('',$langs->trans("Contract"),""); $form = new Form($db); $formfile = new FormFile($db); - +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); + $objectlignestatic=new ContratLigne($db); // Load object modContract @@ -1086,34 +1087,36 @@ if ($action == 'create') print '
'.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").''.$langs->trans("FiscalYearInformation").''.$langs->trans("Value").'
'.$langs->trans("FiscalMonthStart").''; + print '
'.$langs->trans("FiscalMonthStart").''; $monthstart=(! empty($conf->global->SOCIETE_FISCAL_MONTH_START)) ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1; print dol_print_date(dol_mktime(12,0,0,$monthstart,1,2000,1),'%B','gm') . '
'; // Ref + print ''; + print $tmpcode; + print ''; // Ref customer print ''; - print ''; + print ''; // Ref supplier print ''; - print ''; + print ''; // Thirdparty print ''; print ''; if ($socid>0) { - print ''; } else { - print ''; } @@ -1122,7 +1125,7 @@ if ($action == 'create') if($socid>0) { // Ligne info remises tiers - print ''; if (empty($user->societe_id)) { @@ -1293,47 +1294,75 @@ else print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } - print '
'.$langs->trans('Ref').''; if (! empty($modCodeContract->code_auto)) { $tmpcode=$langs->trans("Draft"); } else { - $tmpcode=''; + $tmpcode=''; } - print '
'.$langs->trans('Ref').''.$tmpcode.'
'.$langs->trans('RefCustomer').'
'.$langs->trans('RefSupplier').'
'.$langs->trans('ThirdParty').''; + print ''; print $soc->getNomUrl(1); print ''; print ''; + print ''; print $form->select_company('','socid','','SelectThirdParty',1); print '
'.$langs->trans('Discounts').''; + print '
'.$langs->trans('Discounts').''; if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); print '. '; @@ -1158,11 +1161,9 @@ if ($action == 'create') } print '
'.$langs->trans("NotePublic").''; - - $doleditor=new DolEditor('note_public', $note_public, '', '100', 'dolibarr_notes', 'In', 1, true, true, ROWS_3, '90%'); print $doleditor->Create(1); - + print '
'; + // Contract card $linkback = ''.$langs->trans("BackToList").''; - // Ref du contrat - if (! empty($modCodeContract->code_auto)) { - print '"; - } else { - print ''; - print ''; - print ''; - } - - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $morehtmlref=''; + if (! empty($modCodeContract->code_auto)) { + $morehtmlref.=$object->ref; + } else { + $morehtmlref.=$form->editfieldkey("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,3); + $morehtmlref.=$form->editfieldval("",'ref',$object->ref,$object,$user->rights->contrat->creer,'string','',0,2); + } + + $morehtmlref.='
'; + // Ref customer + $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); + // Ref supplier + $morehtmlref.='
'; + $morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); + $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + // Project + if (! empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->contrat->creer) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=''; + $morehtmlref.=$proj->ref; + $morehtmlref.=''; + } else { + $morehtmlref.=''; + } + } + } + $morehtmlref.='
'; - // Customer - print ""; - print ''; + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'none', $morehtmlref); + + + print '
'; + print '
'; + + + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', ''); - print "
'; - print $form->editfieldkey("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("Ref",'ref',$object->ref,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer); - print '
'; - print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print ''; - print $form->editfieldval("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer); - print '
".$langs->trans("Customer")."'.$object->thirdparty->getNomUrl(1).'
'; + // Ligne info remises tiers - print ''; - // Statut contrat - print '"; - // Date print ''; - print ''; print ''; - /* print ''; - print '\n";*/ - // Projet - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - print '"; - } // Other attributes $cols = 3; @@ -1388,12 +1388,14 @@ else print "
'.$langs->trans('Discount').''; + print '
'.$langs->trans('Discount').''; if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); else print $langs->trans("CompanyHasNoRelativeDiscount"); $absolute_discount=$object->thirdparty->getAvailableDiscounts(); @@ -1343,44 +1372,15 @@ else print '.'; print '
'.$langs->trans("Status").''; - if ($object->statut==0) print $object->getLibStatut(2); - else print $object->getLibStatut(4); - print "
'; + print ''; print $form->editfieldkey("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer); print ''; print $form->editfieldval("Date",'date_contrat',$object->date_contrat,$object,$user->rights->contrat->creer,'datehourpicker'); print '
'.$langs->trans("Date").''.dol_print_date($object->date_contrat,"dayhour")."
'; - print ''; - if ($action != "classify" && $user->rights->projet->creer) print ''; - print '
'; - print $langs->trans("Project"); - print 'id.'">'.img_edit($langs->trans("SetProject")).'
'; - print '
'; - if ($action == "classify") - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "projectid", 1, 0, 1); - } - else - { - $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, "none", 0, 0); - } - print "
"; + print ''; + if (! empty($object->brouillon) && $user->rights->contrat->creer) { print ''; } - echo '
'; + //echo '
'; if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { @@ -1457,8 +1459,8 @@ else print '
'.$langs->trans("ServiceNb",$cursorline).''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("VAT").''.$langs->trans("PriceUHT").''.$langs->trans("Qty").''.$langs->trans("Unit").''.$langs->trans("ReductionShort").'
'; @@ -1927,8 +1929,6 @@ else '; - print '
'; - print '
'; print ''; // Array with (n*2)+1 lines diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a8f84731650..52a32e00067 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -45,7 +45,8 @@ class Contrat extends CommonObject public $table_element_line='contratdet'; public $fk_element='fk_contrat'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - + public $picto='contract'; + /** * {@inheritdoc} */ diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 05fae4f7637..de42ced0997 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3301,7 +3301,7 @@ abstract class CommonObject } // VAT - print ''; + print ''; // Price HT print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f8c81249ed1..ee5bb19bc9a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -78,9 +78,9 @@ class Form * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) - * @param string $moreparam More param to add on a href URL* + * @param string $moreparam More param to add on a href URL. * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. - * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':' + * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' * @return string HTML edit field */ function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0) @@ -119,6 +119,7 @@ class Form if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.=''; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'.$langs->trans('VAT').''.$langs->trans('VAT').''.$langs->trans('PriceUHT').''; if ($htmlname && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='id.$moreparam.'">'.img_edit($langs->trans('Edit'), ($notabletag ? 0 : 1)).''; if (! empty($notabletag) && $notabletag == 1) $ret.=' : '; + if (! empty($notabletag) && $notabletag == 3) $ret.=' '; if (empty($notabletag) && GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='
'; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 01c23ce70f6..f330fb92e84 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1061,9 +1061,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); $morehtmlstatus.=$tmptxt; } - elseif ($object->element == 'facturerec') + elseif ($object->element == 'contrat') { - $morehtmlstatus.=''; + if ($object->statut==0) $morehtmlstatus.=$object->getLibStatut(2); + else $morehtmlstatus.=$object->getLibStatut(4); } else { // Generic case $tmptxt=$object->getLibStatut(6); diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 62866e31ea1..c01f16293b6 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -107,7 +107,7 @@ if ($nolinesbefore) { -
' . $langs->trans('DateInvoice') . ''; - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1); print '
' . $langs->trans('NotePublic') . ''; + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -2485,7 +2521,9 @@ if ($action == 'create') if (empty($user->societe_id)) { print '
' . $langs->trans('NotePrivate') . ''; + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e02ec4541ef..8e443e5f556 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -296,6 +296,10 @@ class Facture extends CommonInvoice $this->mode_reglement_id = GETPOST('mode_reglement_id') > 0 ? GETPOST('mode_reglement_id') : $_facrec->mode_reglement_id; $this->fk_account = GETPOST('fk_account') > 0 ? GETPOST('fk_account') : $_facrec->fk_account; + // Set here to have this defined for substitution into notes, should be recalculated after adding lines to get same result + $this->total_ht = $_facrec->total_ht; + $this->total_ttc = $_facrec->total_ttc; + // Fields always coming from template $this->remise_absolue = $_facrec->remise_absolue; $this->remise_percent = $_facrec->remise_percent; @@ -314,7 +318,7 @@ class Facture extends CommonInvoice $this->brouillon = 1; $this->linked_objects = $_facrec->linkedObjectsIds; - + $forceduedate = $this->calculate_date_lim_reglement(); // For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice @@ -327,6 +331,39 @@ class Facture extends CommonInvoice //$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1. $result = $_facrec->setNextDate($next_date,1); } + + // Define lang of customer + $outputlangs = $langs; + $newlang=''; + + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->thirdparty->default_lang)) $newlang=$this->thirdparty->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($this->default_lang)) $newlang=$this->default_lang; // for thirdparty + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } + + // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions) + $substitutionarray=array( + '__TOTAL_HT__' => price($this->total_ht, 0, $outputlangs, 0, 0, -1, $conf->currency_code), + '__TOTAL_TTC__' => price($this->total_ttc, 0, $outputlangs, 0, 0, -1, $conf->currency_code), + '__INVOICE_PREVIOUS_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%m'), + '__INVOICE_MONTH__' => dol_print_date($this->date, '%m'), + '__INVOICE_NEXT_MONTH__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%m'), + '__INVOICE_PREVIOUS_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'm'), '%B'), + '__INVOICE_MONTH_TEXT__' => dol_print_date($this->date, '%B'), + '__INVOICE_NEXT_MONTH_TEXT__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'm'), '%B'), + '__INVOICE_PREVIOUS_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, -1, 'y'), '%Y'), + '__INVOICE_YEAR__' => dol_print_date($this->date, '%Y'), + '__INVOICE_NEXT_YEAR__' => dol_print_date(dol_time_plus_duree($this->date, 1, 'y'), '%Y'), + ); + + $substitutionisok=true; + complete_substitutions_array($substitutionarray, $outputlangs); + + $this->note_public=make_substitutions($this->note_public,$substitutionarray); + $this->note_private=make_substitutions($this->note_private,$substitutionarray); } // Define due date if not already defined diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index fccb1d00106..83d4535660d 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -37,6 +37,7 @@ if (! empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; } +require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; $langs->load('bills'); $langs->load('compta'); @@ -915,15 +916,53 @@ if ($action == 'create') print '
'.$langs->trans("Customer").''.$object->thirdparty->getNomUrl(1,'customer').'
'.$langs->trans("NotePublic").''; - print ''; - print '
'.$langs->trans("NotePrivate").''; - print ''; - print '
'; + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print ''; + $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + + // Private note + if (empty($user->societe_id)) + { + print '
'; + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print ''; + $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); + print $doleditor->Create(1); + // print ' + print '
".$langs->trans("Author")."".$user->getFullName($langs)."
' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects($socid, $projectid, 'projectid', 0); @@ -970,7 +1009,7 @@ if ($action == 'create') // Frequency print '
'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')).""; - print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); + print " ".$form->selectarray('unit_frequency', array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')), (GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')); print "
'; - - // Ref - /* - print ''; - print ''; - - print ''; - print ''; - */ print '"; @@ -1200,9 +1224,33 @@ else } print ''; + // Help of substitution key + $dateexample=dol_now(); + if (! empty($object->frequency) && ! empty($object->date_when)) $dateexample=$object->date_when; + $substitutionarray=array( + '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($object->total_ht).')', + '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($object->total_ttc).')', + '__INVOICE_PREVIOUS_MONTH__' => $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%m').')', + '__INVOICE_MONTH__' => $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%m').')', + '__INVOICE_NEXT_MONTH__' => $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'),'%m').')', + '__INVOICE_PREVIOUS_MONTH_TEXT__' => $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'),'%B').')', + '__INVOICE_MONTH_TEXT__' => $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%B').')', + '__INVOICE_NEXT_MONTH_TEXT__' => $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')', + '__INVOICE_PREVIOUS_YEAR__' => $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'),'%Y').')', + '__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')', + '__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')' + ); + + $htmltext = ''.$langs->trans("FollowingConstantsWillBeSubstituted").':
'; + foreach($substitutionarray as $key => $val) + { + $htmltext.=$key.' = '.$langs->trans($val).'
'; + } + $htmltext.='
'; + // Note public print ''; @@ -1210,39 +1258,11 @@ else // Note private print ''; print ''; - - // Project - /* - if (! empty($conf->projet->enabled)) - { - $langs->load('projects'); - print ''; - print ''; - print ''; - }*/ // Bank Account print ''; - print ''; + print ''; print "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f330fb92e84..082177b5cbc 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1216,6 +1216,7 @@ function dol_strftime($fmt, $ts=false, $is_gmt=false) * "%d %b %Y", * "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M:%S", + * "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat" * @param string $tzoutput true or 'gmt' => string is for Greenwich location * false or 'tzserver' => output string is for local PHP server TZ usage diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index d1648be1d1b..1e4a745621c 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -321,7 +321,7 @@ ListOfNextSituationInvoices=List of next situation invoices FrequencyPer_d=Every %s days FrequencyPer_m=Every %s months FrequencyPer_y=Every %s years -toolTipFrequency=Examples:
Set 7 / day: give a new invoice every 7 days
Set 3 / month: give a new invoice every 3 month +toolTipFrequency=Examples:
Set 7, Day: give a new invoice every 7 days
Set 3, Month: give a new invoice every 3 month NextDateToExecution=Date for next invoice generation DateLastGeneration=Date of latest generation MaxPeriodNumber=Max nb of invoice generation From e4006602f3bf879b4cd4c281ed0cd3dccaacdd6f Mon Sep 17 00:00:00 2001 From: Milamber Date: Mon, 5 Dec 2016 08:04:34 +0000 Subject: [PATCH 47/75] Fix the new 'Identifiant Commun de l'Entreprise' label in L10N files for Morocco (Maroc) Fix issue in pdf.lib.php to add the Prof ID 5 and 6 Ref: http://www.ice.gov.ma/ICE/ --- htdocs/core/lib/pdf.lib.php | 14 ++++++++++++++ htdocs/langs/ar_SA/companies.lang | 2 +- htdocs/langs/bg_BG/companies.lang | 2 +- htdocs/langs/bn_BD/companies.lang | 2 +- htdocs/langs/bs_BA/companies.lang | 2 +- htdocs/langs/ca_ES/companies.lang | 2 +- htdocs/langs/cs_CZ/companies.lang | 2 +- htdocs/langs/da_DK/companies.lang | 2 +- htdocs/langs/de_CH/companies.lang | 2 +- htdocs/langs/de_DE/companies.lang | 2 +- htdocs/langs/el_GR/companies.lang | 2 +- htdocs/langs/en_US/companies.lang | 2 +- htdocs/langs/es_ES/companies.lang | 2 +- htdocs/langs/et_EE/companies.lang | 2 +- htdocs/langs/eu_ES/companies.lang | 2 +- htdocs/langs/fa_IR/companies.lang | 2 +- htdocs/langs/fi_FI/companies.lang | 2 +- htdocs/langs/fr_FR/companies.lang | 2 +- htdocs/langs/he_IL/companies.lang | 2 +- htdocs/langs/hr_HR/companies.lang | 2 +- htdocs/langs/hu_HU/companies.lang | 2 +- htdocs/langs/id_ID/companies.lang | 2 +- htdocs/langs/is_IS/companies.lang | 2 +- htdocs/langs/it_IT/companies.lang | 2 +- htdocs/langs/ja_JP/companies.lang | 2 +- htdocs/langs/ka_GE/companies.lang | 2 +- htdocs/langs/kn_IN/companies.lang | 2 +- htdocs/langs/ko_KR/companies.lang | 2 +- htdocs/langs/lo_LA/companies.lang | 2 +- htdocs/langs/lt_LT/companies.lang | 2 +- htdocs/langs/lv_LV/companies.lang | 2 +- htdocs/langs/mk_MK/companies.lang | 2 +- htdocs/langs/mn_MN/companies.lang | 2 +- htdocs/langs/nb_NO/companies.lang | 2 +- htdocs/langs/nl_NL/companies.lang | 2 +- htdocs/langs/pl_PL/companies.lang | 2 +- htdocs/langs/pt_BR/companies.lang | 6 +++++- htdocs/langs/pt_PT/companies.lang | 2 +- htdocs/langs/ro_RO/companies.lang | 2 +- htdocs/langs/ru_RU/companies.lang | 2 +- htdocs/langs/sk_SK/companies.lang | 2 +- htdocs/langs/sl_SI/companies.lang | 10 +++++----- htdocs/langs/sq_AL/companies.lang | 2 +- htdocs/langs/sr_RS/companies.lang | 2 +- htdocs/langs/sv_SE/companies.lang | 2 +- htdocs/langs/sw_SW/companies.lang | 2 +- htdocs/langs/th_TH/companies.lang | 2 +- htdocs/langs/tr_TR/companies.lang | 2 +- htdocs/langs/uk_UA/companies.lang | 2 +- htdocs/langs/uz_UZ/companies.lang | 2 +- htdocs/langs/vi_VN/companies.lang | 2 +- htdocs/langs/zh_CN/companies.lang | 2 +- htdocs/langs/zh_TW/companies.lang | 2 +- 53 files changed, 74 insertions(+), 56 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 9d6201998db..082089b429f 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -941,6 +941,20 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; $line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof4); } + // Prof Id 5 + if ($fromcompany->idprof5) + { + $field=$outputlangs->transcountrynoentities("ProfId5",$fromcompany->country_code); + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; + $line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof5); + } + // Prof Id 6 + if ($fromcompany->idprof6) + { + $field=$outputlangs->transcountrynoentities("ProfId6",$fromcompany->country_code); + if (preg_match('/\((.*)\)/i',$field,$reg)) $field=$reg[1]; + $line4.=($line4?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->idprof6); + } // IntraCommunautary VAT if ($fromcompany->tva_intra != '') { diff --git a/htdocs/langs/ar_SA/companies.lang b/htdocs/langs/ar_SA/companies.lang index 7dc956c2062..312f8ac26be 100644 --- a/htdocs/langs/ar_SA/companies.lang +++ b/htdocs/langs/ar_SA/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=الرقم أ. 1 (RC) ProfId2MA=الرقم أ. 2 (Patente) ProfId3MA=الرقم أ. 3 (إذا) ProfId4MA=الرقم أ. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=الرقم أ. 5 (I.C.E.) ProfId6MA=- ProfId1MX=الأستاذ رقم 1 (RFC). ProfId2MX=الأستاذ رقم 2 (ر. P. IMSS) diff --git a/htdocs/langs/bg_BG/companies.lang b/htdocs/langs/bg_BG/companies.lang index 21345bc2ea7..2cb1043ee3e 100644 --- a/htdocs/langs/bg_BG/companies.lang +++ b/htdocs/langs/bg_BG/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/bn_BD/companies.lang b/htdocs/langs/bn_BD/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/bn_BD/companies.lang +++ b/htdocs/langs/bn_BD/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/bs_BA/companies.lang b/htdocs/langs/bs_BA/companies.lang index 941e4689903..36499b66a16 100644 --- a/htdocs/langs/bs_BA/companies.lang +++ b/htdocs/langs/bs_BA/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/ca_ES/companies.lang b/htdocs/langs/ca_ES/companies.lang index e941dcca61a..877c021c7df 100644 --- a/htdocs/langs/ca_ES/companies.lang +++ b/htdocs/langs/ca_ES/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=CIF/NIF ProfId2MA=Núm. seguretat social ProfId3MA=CNAE ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=CIF/NIF ProfId2MX=Núm. seguretat social diff --git a/htdocs/langs/cs_CZ/companies.lang b/htdocs/langs/cs_CZ/companies.lang index e3f12589593..260dba5b337 100644 --- a/htdocs/langs/cs_CZ/companies.lang +++ b/htdocs/langs/cs_CZ/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/da_DK/companies.lang b/htdocs/langs/da_DK/companies.lang index c72833f9d14..1e27f1eae37 100644 --- a/htdocs/langs/da_DK/companies.lang +++ b/htdocs/langs/da_DK/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof.. 1 (RC) ProfId2MA=Id prof.. 2 (Patente) ProfId3MA=Id prof.. 3 (IF) ProfId4MA=Id prof.. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/de_CH/companies.lang b/htdocs/langs/de_CH/companies.lang index dd71caf694a..e282336ea38 100644 --- a/htdocs/langs/de_CH/companies.lang +++ b/htdocs/langs/de_CH/companies.lang @@ -55,7 +55,7 @@ ProfId3LU=Id. Prof. 3 ProfId4LU=Id. Prof. 4 ProfId5LU=Id. Prof. 5 ProfId6LU=Id. Prof. 6 -ProfId5MA=Id prof. 5 (C.I.C.E) +ProfId5MA=Id prof. 5 ((I.C.E.) ProfId4NL=- ProfId2PT=Prof Id 2 (Social Security Number) ProfId3PT=Prof Id 3 (Commercial Record-Nummer) diff --git a/htdocs/langs/de_DE/companies.lang b/htdocs/langs/de_DE/companies.lang index 09530dba465..2390228c793 100644 --- a/htdocs/langs/de_DE/companies.lang +++ b/htdocs/langs/de_DE/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Prof ID 1 (R.C.) ProfId2MA=Prof ID 2 ProfId3MA=Prof ID 3 ProfId4MA=Prof ID 4 -ProfId5MA=Prof ID 5 +ProfId5MA=Prof ID 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/el_GR/companies.lang b/htdocs/langs/el_GR/companies.lang index b8b42d7b8cb..6b6922ab37b 100644 --- a/htdocs/langs/el_GR/companies.lang +++ b/htdocs/langs/el_GR/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (ΑΝ) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Ο καθηγητής Id 1 (RFC). ProfId2MX=Ο καθηγητής ID 2 (R.. Π. IMSS) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 73e9dab189c..4a631b092cf 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -201,7 +201,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 0b48b5ada6c..8ee41b36153 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=R.F.C. ProfId2MX=Registro Patronal IMSS diff --git a/htdocs/langs/et_EE/companies.lang b/htdocs/langs/et_EE/companies.lang index 4992b907e5e..4a602bae9e4 100644 --- a/htdocs/langs/et_EE/companies.lang +++ b/htdocs/langs/et_EE/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/eu_ES/companies.lang b/htdocs/langs/eu_ES/companies.lang index 3dea93f86d6..c23abec7f09 100644 --- a/htdocs/langs/eu_ES/companies.lang +++ b/htdocs/langs/eu_ES/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/fa_IR/companies.lang b/htdocs/langs/fa_IR/companies.lang index 124fc9a36ba..2e00664a9eb 100644 --- a/htdocs/langs/fa_IR/companies.lang +++ b/htdocs/langs/fa_IR/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=استاد آیدی. 1 (RC) ProfId2MA=استاد آیدی. 2 (Patente) ProfId3MA=استاد آیدی. 3 (IF) ProfId4MA=استاد آیدی. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=استاد آیدی. 5 (I.C.E.) ProfId6MA=- ProfId1MX=پروفسور شناسه 1 (RFC). ProfId2MX=پروفسور کد 2 (R..P. IMSS) diff --git a/htdocs/langs/fi_FI/companies.lang b/htdocs/langs/fi_FI/companies.lang index 5ee5d7168e8..c3d2fb413be 100644 --- a/htdocs/langs/fi_FI/companies.lang +++ b/htdocs/langs/fi_FI/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Professori Id 1 (RFC). ProfId2MX=Professori Id 2 (R. P. IMSS) diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 5671adf71aa..c7b163e25a1 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -207,7 +207,7 @@ ProfId1MA=Id. prof. 1 (R.C.) ProfId2MA=Id. prof. 2 (Patente) ProfId3MA=Id. prof. 3 (I.F.) ProfId4MA=Id. prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Id. Prof. 1 (R.F.C). ProfId2MX=ID. Prof. 2 (R..P. IMSS) diff --git a/htdocs/langs/he_IL/companies.lang b/htdocs/langs/he_IL/companies.lang index 0d4bfce0c8c..3ebb96b3bb8 100644 --- a/htdocs/langs/he_IL/companies.lang +++ b/htdocs/langs/he_IL/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/hr_HR/companies.lang b/htdocs/langs/hr_HR/companies.lang index bbaf240e343..1a8d5db78bf 100644 --- a/htdocs/langs/hr_HR/companies.lang +++ b/htdocs/langs/hr_HR/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/hu_HU/companies.lang b/htdocs/langs/hu_HU/companies.lang index 16f027eb0ac..6aa55ae7e77 100644 --- a/htdocs/langs/hu_HU/companies.lang +++ b/htdocs/langs/hu_HU/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Szakma id 1 (RC) ProfId2MA=Szakma id 2 (Patente) ProfId3MA=Szakma id 3 (IF) ProfId4MA=Szakma id 4 (CNSS) -ProfId5MA=Szakma id 5 (C.I.C.E.) +ProfId5MA=Szakma id 5 (I.C.E.) ProfId6MA=- ProfId1MX=Szakma ID 1 (RFC). ProfId2MX=Szakma ID 2 (R.. P. IMSS) diff --git a/htdocs/langs/id_ID/companies.lang b/htdocs/langs/id_ID/companies.lang index f9baf213027..a05add630d6 100644 --- a/htdocs/langs/id_ID/companies.lang +++ b/htdocs/langs/id_ID/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/is_IS/companies.lang b/htdocs/langs/is_IS/companies.lang index ea7a39b5d7b..c4a4ee48188 100644 --- a/htdocs/langs/is_IS/companies.lang +++ b/htdocs/langs/is_IS/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id Prof. 1 (RC) ProfId2MA=Id Prof. 2 (Patente) ProfId3MA=Id Prof. 3 (IF) ProfId4MA=Id Prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/it_IT/companies.lang b/htdocs/langs/it_IT/companies.lang index 4baaf3b514d..226d53ff853 100644 --- a/htdocs/langs/it_IT/companies.lang +++ b/htdocs/langs/it_IT/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=RC ProfId2MA=Patente ProfId3MA=SE ProfId4MA=CNSS -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=RFC ProfId2MX=R. P. IMSS diff --git a/htdocs/langs/ja_JP/companies.lang b/htdocs/langs/ja_JP/companies.lang index 1f67812bb9a..8a5db406896 100644 --- a/htdocs/langs/ja_JP/companies.lang +++ b/htdocs/langs/ja_JP/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=ID教授。 1(RC) ProfId2MA=ID教授。 2(Patente) ProfId3MA=ID教授。 3(IF) ProfId4MA=ID教授。 4(CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=ID教授。 5(I.C.E.) ProfId6MA=- ProfId1MX=教授はID 1(RFC)。 ProfId2MX=教授はID 2(R.。P. IMSS) diff --git a/htdocs/langs/ka_GE/companies.lang b/htdocs/langs/ka_GE/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/ka_GE/companies.lang +++ b/htdocs/langs/ka_GE/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/kn_IN/companies.lang b/htdocs/langs/kn_IN/companies.lang index c0454593760..a18b9817259 100644 --- a/htdocs/langs/kn_IN/companies.lang +++ b/htdocs/langs/kn_IN/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/ko_KR/companies.lang b/htdocs/langs/ko_KR/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/ko_KR/companies.lang +++ b/htdocs/langs/ko_KR/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/lo_LA/companies.lang b/htdocs/langs/lo_LA/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/lo_LA/companies.lang +++ b/htdocs/langs/lo_LA/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/lt_LT/companies.lang b/htdocs/langs/lt_LT/companies.lang index 17ca41743bc..b6c37e91f1d 100644 --- a/htdocs/langs/lt_LT/companies.lang +++ b/htdocs/langs/lt_LT/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Prof ID 1 (RC) ProfId2MA=Prof ID 2 (patente) ProfId3MA=Prof ID 3 (IF) ProfId4MA=Prof ID 4 (CNSS) -ProfId5MA=ID Prof. 5 (C.I.C.E.) +ProfId5MA=ID Prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof ID 1 (RFC). ProfId2MX=Prof ID 2 (R.. P. IMSS) diff --git a/htdocs/langs/lv_LV/companies.lang b/htdocs/langs/lv_LV/companies.lang index e2a1dd08222..e1e407e2bfe 100644 --- a/htdocs/langs/lv_LV/companies.lang +++ b/htdocs/langs/lv_LV/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (PATENTE) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof ID 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/mk_MK/companies.lang b/htdocs/langs/mk_MK/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/mk_MK/companies.lang +++ b/htdocs/langs/mk_MK/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/mn_MN/companies.lang b/htdocs/langs/mn_MN/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/mn_MN/companies.lang +++ b/htdocs/langs/mn_MN/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/nb_NO/companies.lang b/htdocs/langs/nb_NO/companies.lang index ff5ccc2489a..680a0906611 100644 --- a/htdocs/langs/nb_NO/companies.lang +++ b/htdocs/langs/nb_NO/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Prof ID 1 (RC) ProfId2MA=Prof ID 2 (patent) ProfId3MA=Prof ID 3 (IF) ProfId4MA=Prof ID 4 (CNSS) -ProfId5MA=Prof ID 5 (C.I.C.E.) +ProfId5MA=Prof ID 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof ID 1 (RFC). ProfId2MX=Prof ID 2 (R.. P. IMSS) diff --git a/htdocs/langs/nl_NL/companies.lang b/htdocs/langs/nl_NL/companies.lang index 266a9942160..3b4cf2738fa 100644 --- a/htdocs/langs/nl_NL/companies.lang +++ b/htdocs/langs/nl_NL/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/pl_PL/companies.lang b/htdocs/langs/pl_PL/companies.lang index 68e14f8b145..4aabe55cbdb 100644 --- a/htdocs/langs/pl_PL/companies.lang +++ b/htdocs/langs/pl_PL/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/pt_BR/companies.lang b/htdocs/langs/pt_BR/companies.lang index a52d84b97f3..38150e01105 100644 --- a/htdocs/langs/pt_BR/companies.lang +++ b/htdocs/langs/pt_BR/companies.lang @@ -100,7 +100,11 @@ ProfId4IN=ID prof. 4 ProfId5IN=ID prof. 5 ProfId1LU=Id. prof. 1 (R.C.S. Luxemburgo) ProfId2LU=Id. prof. 2 (Permissão para negócios) -ProfId5MA=ID prof. 5 (C.I.C.E.) +ProfId1MA=Id prof. 1 (R.C.) +ProfId2MA=Id prof. 2 (Patente) +ProfId3MA=Id prof. 3 (I.F.) +ProfId4MA=Id prof. 4 (C.N.S.S.) +ProfId5MA=Id prof. 5 (I.C.E.) VATIntra=Número ICMS VATIntraShort=Núm ICMS VATIntraSyntaxIsValid=Sintaxe é válida diff --git a/htdocs/langs/pt_PT/companies.lang b/htdocs/langs/pt_PT/companies.lang index 7ffa25e156b..87fa1a03e0b 100644 --- a/htdocs/langs/pt_PT/companies.lang +++ b/htdocs/langs/pt_PT/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/ro_RO/companies.lang b/htdocs/langs/ro_RO/companies.lang index 75cd8dda623..ac21f62c906 100644 --- a/htdocs/langs/ro_RO/companies.lang +++ b/htdocs/langs/ro_RO/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. univ. 1 (RC) ProfId2MA=Id prof. univ. 2 (Patente) ProfId3MA=Id prof. univ. 3 (IF) ProfId4MA=Id prof. univ. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id prof. univ. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof. Id-ul 1 (RFC). ProfId2MX=Prof. Id-ul 2 (R.. P. IMSS) diff --git a/htdocs/langs/ru_RU/companies.lang b/htdocs/langs/ru_RU/companies.lang index 3ec8d12f1e7..5c10dd82936 100644 --- a/htdocs/langs/ru_RU/companies.lang +++ b/htdocs/langs/ru_RU/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id проф. 1 (RC) ProfId2MA=Id проф. 2 (Patente) ProfId3MA=Id проф. 3 (IF) ProfId4MA=Id проф. 4 (НКСО) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id проф. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Проф Id 1 (RFC). ProfId2MX=Проф Id 2 (R.. P. ИМСС) diff --git a/htdocs/langs/sk_SK/companies.lang b/htdocs/langs/sk_SK/companies.lang index 55ed923d480..075ee2c38b9 100644 --- a/htdocs/langs/sk_SK/companies.lang +++ b/htdocs/langs/sk_SK/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/sl_SI/companies.lang b/htdocs/langs/sl_SI/companies.lang index bdc19663825..d0825cddbd9 100644 --- a/htdocs/langs/sl_SI/companies.lang +++ b/htdocs/langs/sl_SI/companies.lang @@ -196,11 +196,11 @@ ProfId3LU=- ProfId4LU=- ProfId5LU=- ProfId6LU=- -ProfId1MA== -ProfId2MA== -ProfId3MA== -ProfId4MA== -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId1MA=Id prof. 1 (R.C.) +ProfId2MA=Id prof. 2 (Patente) +ProfId3MA=Id prof. 3 (I.F.) +ProfId4MA=Id prof. 4 (C.N.S.S.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX== ProfId2MX== diff --git a/htdocs/langs/sq_AL/companies.lang b/htdocs/langs/sq_AL/companies.lang index 493c004fb2f..c685d2d74c6 100644 --- a/htdocs/langs/sq_AL/companies.lang +++ b/htdocs/langs/sq_AL/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/sr_RS/companies.lang b/htdocs/langs/sr_RS/companies.lang index e7e70b6b1ff..7a2c10a885e 100644 --- a/htdocs/langs/sr_RS/companies.lang +++ b/htdocs/langs/sr_RS/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/sv_SE/companies.lang b/htdocs/langs/sv_SE/companies.lang index ed439632443..5bb5ed01111 100644 --- a/htdocs/langs/sv_SE/companies.lang +++ b/htdocs/langs/sv_SE/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (Patent) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/sw_SW/companies.lang b/htdocs/langs/sw_SW/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/sw_SW/companies.lang +++ b/htdocs/langs/sw_SW/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/th_TH/companies.lang b/htdocs/langs/th_TH/companies.lang index ee0208c00fb..59b6af743d4 100644 --- a/htdocs/langs/th_TH/companies.lang +++ b/htdocs/langs/th_TH/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=ศ Id 1 (RC) ProfId2MA=ศ Id 2 (Patente) ProfId3MA=ศ Id 3 (IF) ProfId4MA=ศ Id 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=ศ Id 5 (I.C.E.) ProfId6MA=- ProfId1MX=Id ศที่ 1 (RFC) ProfId2MX=ศหมายเลข 2 (R..P. IMSS) diff --git a/htdocs/langs/tr_TR/companies.lang b/htdocs/langs/tr_TR/companies.lang index 5eba4e2c87d..88b51506365 100644 --- a/htdocs/langs/tr_TR/companies.lang +++ b/htdocs/langs/tr_TR/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (RC) ProfId2MA=Id prof. 2 (patente) ProfId3MA=Id prof. 3 (IF) ProfId4MA=Id prof. 4 (CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof. Id 1 (RFC). ProfId2MX=Prof Id 2 (R.. P. IMSS) diff --git a/htdocs/langs/uk_UA/companies.lang b/htdocs/langs/uk_UA/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/uk_UA/companies.lang +++ b/htdocs/langs/uk_UA/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/uz_UZ/companies.lang b/htdocs/langs/uz_UZ/companies.lang index 763a2c9a0e8..f4f97130cb0 100644 --- a/htdocs/langs/uz_UZ/companies.lang +++ b/htdocs/langs/uz_UZ/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/vi_VN/companies.lang b/htdocs/langs/vi_VN/companies.lang index d74617ecfe2..26ced48ae1c 100644 --- a/htdocs/langs/vi_VN/companies.lang +++ b/htdocs/langs/vi_VN/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/zh_CN/companies.lang b/htdocs/langs/zh_CN/companies.lang index c01ffcde6ef..38782d08f30 100644 --- a/htdocs/langs/zh_CN/companies.lang +++ b/htdocs/langs/zh_CN/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=Id prof. 1 (R.C.) ProfId2MA=Id prof. 2 (Patente) ProfId3MA=Id prof. 3 (I.F.) ProfId4MA=Id prof. 4 (C.N.S.S.) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=Id. prof. 5 (I.C.E.) ProfId6MA=- ProfId1MX=Prof Id 1 (R.F.C). ProfId2MX=Prof Id 2 (R..P. IMSS) diff --git a/htdocs/langs/zh_TW/companies.lang b/htdocs/langs/zh_TW/companies.lang index a394cfbc312..efe0ffac439 100644 --- a/htdocs/langs/zh_TW/companies.lang +++ b/htdocs/langs/zh_TW/companies.lang @@ -200,7 +200,7 @@ ProfId1MA=ID教授。 1(RC)的 ProfId2MA=ID教授。 2(Patente) ProfId3MA=ID教授。 3(如果) ProfId4MA=ID教授。 4(CNSS) -ProfId5MA=Id prof. 5 (C.I.C.E.) +ProfId5MA=ID教授。 5(I.C.E.) ProfId6MA=- ProfId1MX=(RFC)的ID 1教授。 ProfId2MX=ID 2教授(體育IMSS的河。) From f3bf5f82f8c7b0100bd4864fb6254d1623ac362b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Dec 2016 11:18:54 +0100 Subject: [PATCH 48/75] FIX Minor fix on stock rounding for float qty before output on screen. --- htdocs/product/stock/class/entrepot.class.php | 2 +- htdocs/product/stock/product.php | 48 ++++++------------- 2 files changed, 15 insertions(+), 35 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 36599833c2d..1538e47a9d1 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -578,7 +578,7 @@ class Entrepot extends CommonObject */ function getNomUrl($withpicto=0, $option='',$showfullpath=0, $notooltip=0) { - global $langs; + global $conf, $langs; $langs->load("stocks"); if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7a0068fdda8..2cec79d7020 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -613,14 +613,16 @@ if ($id > 0 || $ref) print ''; - print ''; print ''; + $stocktheo = price2num($object->stock_theorique, 'MS'); + // Calculating a theorical value print ''; - print "'; print ''; @@ -703,44 +705,19 @@ if ($id > 0 || $ref) dol_fiche_end(); } - /* - * Correct stock - */ + // Correct stock if ($action == "correction") { include DOL_DOCUMENT_ROOT.'/product/stock/tpl/stockcorrection.tpl.php'; print '

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

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


'; print $form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1); print ''.$object->stock_reel; + print ''.price2num($object->stock_reel, 'MS'); if ($object->seuil_stock_alerte != '' && ($object->stock_reel < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
'.$langs->trans("VirtualStock").'".(empty($object->stock_theorique)?0:$object->stock_theorique); + print "".(empty($stocktheo)?0:$stocktheo); if ($object->seuil_stock_alerte != '' && ($object->stock_theorique < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
'; - print ''; - print ''; - print '
'.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses('','id_entrepot','',1); - print ''.$langs->trans("NumberOfUnit").'
 '; - print '
'; - print ''; - } - */ } else { @@ -831,7 +808,7 @@ if ($resql) $entrepotstatic->id=$obj->rowid; $entrepotstatic->libelle=$obj->label; $entrepotstatic->lieu=$obj->lieu; - $stock_real = round($obj->reel, 10); + $stock_real = price2num($obj->reel, 'MS'); print '
'.$entrepotstatic->getNomUrl(1).''.$stock_real.($stock_real < 0 ?' '.img_warning():'').'
'; - print '
'; + print "\n".''; + print '
'; + print ''; + print ''; print ''; print ''; print ''; - print '
'; $form->select_date($pdluo->eatby,'eatby','','',1,'',1,0,1); @@ -874,7 +853,8 @@ if ($resql) print ''.$pdluo->qty.($pdluo->qty<0?' '.img_warning():'').''; print '
'; + print '
'; + print ''; print '
'.$langs->trans("Total").':'.$total.''.price2num($total, 'MS').''; print ($totalwithpmp?price(price2num($totalvalue/$totalwithpmp,'MU')):' '); // This value may have rounding errors print ''; -print $formproduct->selectWarehouses($id_sw, 'id_sw', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); +print $formproduct->selectWarehouses($id_sw, 'id_sw', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); print ''; -print $formproduct->selectWarehouses($id_tw, 'id_tw', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); +print $formproduct->selectWarehouses($id_tw, 'id_tw', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); print ''; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print ''.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', '', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, null, 'minwidth100'); print ''.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')),'id_entrepot','',1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', Entrepot::STATUS_OPEN_INTERNAL, 1); print ''.$langs->trans("WarehouseTarget").''; - print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'),'id_entrepot_destination','',1); + print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', Entrepot::STATUS_OPEN_INTERNAL, 1); print ''.$langs->trans("NumberOfUnit").'
'; - print $langs->trans("ExportCardToFormat").''; + print $langs->trans("VCard").''; print ''; - print img_picto($langs->trans("VCard"),'vcard.png').' '; - print $langs->trans("VCard"); + print img_picto($langs->trans("Download"),'vcard.png').' '; + print $langs->trans("Download"); print ''; print '
'."\n"; print ''; From 18478eaa31ad739e7bdf6b8202da4800672901fa Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 18:08:09 +0100 Subject: [PATCH 54/75] Add warehouse status filter to load_stock function --- htdocs/product/class/product.class.php | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index bb122dc70e8..e0650415a22 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -35,7 +35,7 @@ */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/productbatch.class.php'; - +require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; /** * Class to manage products or services @@ -3471,16 +3471,39 @@ class Product extends CommonObject /** * Load information about stock of a product into stock_reel, stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. + * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible. * - * @param string $option '', 'nobatch' = Do not load batch information, 'novirtual' = Do not load virtual stock + * @param string $option '' = Load all stock info, also from closed and internal warehouses, + * 'nobatch' = Do not load batch information, + * 'novirtual' = Do not load virtual stock, + * 'warehouseopen' = Load stock from open warehouses, + * 'warehouseclosed' = Load stock from closed warehouses, + * 'warehouseinternal' = Load stock from warehouses for internal correct/transfer only * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock, getBatchInfo */ function load_stock($option='') { + global $conf; + $this->stock_reel = 0; $this->stock_warehouse = array(); $this->stock_theorique = 0; + + $warehouseStatus = array(); + + if (preg_match('/warehouseclosed/', $option)) + { + $warehouseStatus[] = Entrepot::STATUS_CLOSED; + } + if (preg_match('/warehouseopen/', $option)) + { + $warehouseStatus[] = Entrepot::STATUS_OPEN_ALL; + } + if (preg_match('/warehouseinternal/', $option)) + { + $warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL; + } $sql = "SELECT ps.rowid, ps.reel, ps.fk_entrepot"; $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; @@ -3488,6 +3511,7 @@ class Product extends CommonObject $sql.= " WHERE w.entity IN (".getEntity('stock', 1).")"; $sql.= " AND w.rowid = ps.fk_entrepot"; $sql.= " AND ps.fk_product = ".$this->id; + if ($conf->global->ENTREPOT_EXTRA_STATUS && count($warehouseStatus)) $sql.= " AND w.statut IN (".implode(',',$warehouseStatus).")"; dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); $result = $this->db->query($sql); From 0aacb7ce1792c72c457d80de2ba93e1a1f06cf04 Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 18:14:03 +0100 Subject: [PATCH 55/75] Filter stock on warehouse status for shipping Do not show stock of closed and internal warehouse. --- htdocs/expedition/card.php | 2 +- htdocs/expedition/class/expedition.class.php | 2 +- htdocs/expedition/shipment.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5187d2e979a..edb0d42321c 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -862,7 +862,7 @@ if ($action == 'create') if ($line->fk_product > 0) // If predefined product { $product->fetch($line->fk_product); - $product->load_stock(); + $product->load_stock('warehouseopen'); print ''; print "\n"; print ''; -print ''; -print ''; +print ''; +print ''; print ''; -if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; +if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY)) print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index c64105bca62..cf018ddf153 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -63,7 +63,10 @@ $month=GETPOST('remonth')?GETPOST('remonth','int'):(GETPOST("month")?GETPOST("mo $day=GETPOST('reday')?GETPOST('reday','int'):(GETPOST("day")?GETPOST("day","int"):date("d")); $day = (int) $day; $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$search_project_ref = GETPOST('search_project_ref', 'alpha'); +$search_task_ref=GETPOST('search_task_ref', 'alpha'); +$search_task_label=GETPOST('search_task_label', 'alpha'); +$search_project_ref=GETPOST('search_project_ref', 'alpha'); +$search_thirdparty=GETPOST('search_thirdparty', 'alpha'); $startdayarray=dol_get_first_day_week($day, $month, $year); @@ -98,7 +101,10 @@ $object=new Task($db); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $action = ''; + $search_task_ref = ''; + $search_task_label = ''; $search_project_ref = ''; + $search_thirdparty = ''; } if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search")) { @@ -290,6 +296,9 @@ if ($id) $onlyopenedproject=1; // or -1 $morewherefilter=''; +if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref); +if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); +if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); @@ -415,10 +424,10 @@ print ''; print "\n"; print ''; -print ''; -print ''; +print ''; +print ''; print ''; -if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; +if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY)) print ''; print ''; print ''; print ''; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 27099ef4d91..15e3b154b20 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -623,7 +623,7 @@ class Task extends CommonObject * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists * @param string $filteronprojref Filter on project ref * @param string $filteronprojstatus Filter on project status - * @param string $morewherefilter Add more filter into where SQL request + * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') * @param string $filteronprojuser Filter on user that is a contact of project * @param string $filterontaskuser Filter on user assigned to task * @return array Array of tasks From 017e384f16c0f25c65163c4bb991b450abe11a80 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2016 13:10:44 +0100 Subject: [PATCH 61/75] FIX Preselected value for extrafield link was not correctly set --- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/extrafields.class.php | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index de42ced0997..e9a7607d011 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4470,10 +4470,10 @@ abstract class CommonObject switch($mode) { case "view": - $out .= $extrafields->showOutputField($key,$value); + $out .= $extrafields->showOutputField($key, $value); break; case "edit": - $out .= $extrafields->showInputField($key,$value,'',$keyprefix,'',0,$this->id); + $out .= $extrafields->showInputField($key, $value, '', $keyprefix, '', 0, $this->id); break; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ca7f0c24958..b18738bde9f 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -660,7 +660,7 @@ class ExtraFields * Return HTML string to put an input field into a page * * @param string $key Key of attribute - * @param string $value Value to show (for date type it must be in timestamp format) + * @param string $value Preselected value to show (for date type it must be in timestamp format) * @param string $moreparam To add more parametes on html input tag * @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names) * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) @@ -668,7 +668,7 @@ class ExtraFields * @param int $objectid Current object id * @return string */ - function showInputField($key,$value,$moreparam='',$keyprefix='',$keysuffix='',$showsize=0, $objectid=0) + function showInputField($key, $value, $moreparam='', $keyprefix='', $keysuffix='', $showsize=0, $objectid=0) { global $conf,$langs; @@ -1163,10 +1163,17 @@ class ExtraFields dol_include_once($InfoFieldList[1]); if ($InfoFieldList[0] && class_exists($InfoFieldList[0])) { - $object = new $InfoFieldList[0]($this->db); - if (!empty($value)) $object->fetch($value); - $valuetoshow=$object->ref; - if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique + $valuetoshow=$value; + if (!empty($value)) + { + $object = new $InfoFieldList[0]($this->db); + $resfetch=$object->fetch($value); + if ($resfetch > 0) + { + $valuetoshow=$object->ref; + if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ->ref is not name but id (because name is not unique) + } + } $out.=''; } else From cfff6a8cb80aafcf8981bbba39694924ce837215 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2016 14:05:43 +0100 Subject: [PATCH 62/75] FIX Export of opportunity status must be code, not id. --- htdocs/core/modules/modProjet.class.php | 9 +++++---- htdocs/projet/card.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 73196113751..5c6616b948b 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -214,17 +214,17 @@ class modProjet extends DolibarrModules $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.fk_opp_status'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'p.fk_opp_status'=>"project",'p.opp_percent'=>'project','p.description'=>"project"); + 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'cls.code'=>"project",'p.opp_percent'=>'project','p.description'=>"project"); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','p.fk_opp_status'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); @@ -243,7 +243,8 @@ class modProjet extends DolibarrModules $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; + $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index adc55131a10..ad1d718fc55 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -852,7 +852,7 @@ else /* Change percent of default percent of new status is higher */ if (parseFloat(jQuery("#opp_percent").val()) != parseFloat(defaultpercent)) { - if (jQuery("#opp_percent").val() != \'\' && ! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->trans("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\'); + if (jQuery("#opp_percent").val() != \'\' && ! jQuery("#oldopppercent").text()) jQuery("#oldopppercent").text(\' - '.dol_escape_js($langs->transnoentities("PreviousValue")).': \'+jQuery("#opp_percent").val()+\' %\'); jQuery("#opp_percent").val(defaultpercent); } From 2a8f23e8c580d2f6d2d10181925670667b107096 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2016 15:03:39 +0100 Subject: [PATCH 63/75] Fix labels --- htdocs/commande/card.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/langs/en_US/main.lang | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a7bd3acbbb8..d4f6b1caca4 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1629,7 +1629,7 @@ if ($action == 'create' && $user->rights->commande->creer) } // Template to use by default - print ''; + print ''; print '"; + print ""; print '\n"; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index c2872ecc8f1..ed5ab21bd6c 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -205,8 +205,8 @@ Info=Log Family=Family Description=Description Designation=Description -Model=Model -DefaultModel=Default model +Model=Doc template +DefaultModel=Default doc template Action=Event About=About Number=Number From bbbc768fa7087c70c4cf6fb07257d17322fef1ec Mon Sep 17 00:00:00 2001 From: fappels Date: Tue, 6 Dec 2016 20:07:19 +0100 Subject: [PATCH 64/75] Change filter parameter to string with comma seperated values Change warehousefilter from int to string with comma seperated values for selectWarehouses and select_produits form functions. --- htdocs/core/class/html.form.class.php | 41 +++++++++++++++---- htdocs/core/tpl/objectline_create.tpl.php | 3 +- htdocs/product/ajax/products.php | 2 +- .../product/class/html.formproduct.class.php | 33 ++++++++++++--- htdocs/product/stock/massstockmove.php | 4 +- htdocs/product/stock/mouvement.php | 2 +- .../product/stock/tpl/stockcorrection.tpl.php | 2 +- .../product/stock/tpl/stocktransfer.tpl.php | 4 +- 8 files changed, 68 insertions(+), 23 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index aefec319d65..d5b0d898a9c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1636,9 +1636,13 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label + * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used + * 'warehouseopen' = select products from open warehouses, + * 'warehouseclosed' = select products from closed warehouses, + * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return void */ - function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus=0) + function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='') { global $langs,$conf; @@ -1699,18 +1703,39 @@ class Form * @param int $forcecombo Force to use combo box * @param string $morecss Add more css on select * @param int $hidepriceinlabel 1=Hide prices in label - * @param int $warehouseStatus Additional warehousestatus to filter (products with stock from status 1 are always shown) + * @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used + * 'warehouseopen' = select products from open warehouses, + * 'warehouseclosed' = select products from closed warehouses, + * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return array Array of keys for json */ - function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus=0) + function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') { global $langs,$conf,$user,$db; $out=''; $outarray=array(); + $warehouseStatusArray = array(); + if (! empty($warehouseStatus)) + { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + if (preg_match('/warehouseclosed/', $warehouseStatus)) + { + $warehouseStatusArray[] = Entrepot::STATUS_CLOSED; + } + if (preg_match('/warehouseopen/', $warehouseStatus)) + { + $warehouseStatusArray[] = Entrepot::STATUS_OPEN_ALL; + } + if (preg_match('/warehouseinternal/', $warehouseStatus)) + { + $warehouseStatusArray[] = Entrepot::STATUS_OPEN_INTERNAL; + } + } + $selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression"; - $warehouseStatus ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; + (count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock"; $sql = "SELECT "; $sql.= $selectFields . $selectFieldsGrouped; @@ -1741,7 +1766,7 @@ class Form $selectFields.= ", price_rowid, price_by_qty"; } $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - if ($warehouseStatus) + if (count($warehouseStatusArray)) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid"; @@ -1757,9 +1782,9 @@ class Form $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='". $langs->getDefaultLang() ."'"; } $sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')'; - if ($warehouseStatus) + if (count($warehouseStatusArray)) { - $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN (1, '.$warehouseStatus.'))'; + $sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))'; } if ($finished == 0) { @@ -1796,7 +1821,7 @@ class Form if (! empty($conf->barcode->enabled)) $sql.= " OR p.barcode LIKE '".$db->escape($prefix.$filterkey)."%'"; $sql.=')'; } - if ($warehouseStatus) + if (count($warehouseStatusArray)) { $sql.= ' GROUP BY'.$selectFields; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index fa0553af1a3..beeecf9f511 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -187,8 +187,7 @@ else { if ($conf->global->ENTREPOT_EXTRA_STATUS) { // hide products in closed warehouse, but show products for internal transfer - require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; - $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, Entrepot::STATUS_OPEN_INTERNAL); + $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, 'warehouseopen,warehouseinternal'); } else { diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index bffc5f15531..0510299fbd7 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -50,7 +50,7 @@ $id = GETPOST('id', 'int'); $price_by_qty_rowid = GETPOST('pbq', 'int'); $finished = GETPOST('finished', 'int'); $alsoproductwithnosupplierprice = GETPOST('alsoproductwithnosupplierprice', 'int'); -$warehouseStatus = GETPOST('warehousestatus', 'int'); +$warehouseStatus = GETPOST('warehousestatus', 'alpha'); /* diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index c077859dde1..dda92ea0c0f 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -55,18 +55,36 @@ class FormProduct * * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. * @param string $batch Add quantity of batch stock in label for product with batch name batch, batch name precedes batch_id. Nothing if ''. - * @param int $status additional filter on status other then 1 + * @param string $status warehouse status filter, following comma separated filter options can be used + * 'warehouseopen' = select products from open warehouses, + * 'warehouseclosed' = select products from closed warehouses, + * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @param boolean $sumStock sum total stock of a warehouse, default true * @param array $exclude warehouses ids to exclude * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ - function loadWarehouses($fk_product=0, $batch = '', $status=null, $sumStock = true, $exclude='') + function loadWarehouses($fk_product=0, $batch = '', $status='', $sumStock = true, $exclude='') { global $conf, $langs; if (empty($fk_product) && count($this->cache_warehouses)) return 0; // Cache already loaded and we do not want a list with information specific to a product if (is_array($exclude)) $excludeGroups = implode("','",$exclude); + + $warehouseStatus = array(); + + if (preg_match('/warehouseclosed/', $status)) + { + $warehouseStatus[] = Entrepot::STATUS_CLOSED; + } + if (preg_match('/warehouseopen/', $status)) + { + $warehouseStatus[] = Entrepot::STATUS_OPEN_ALL; + } + if (preg_match('/warehouseinternal/', $status)) + { + $warehouseStatus[] = Entrepot::STATUS_OPEN_INTERNAL; + } $sql = "SELECT e.rowid, e.label, e.description, e.fk_parent"; if (!empty($fk_product)) @@ -95,9 +113,9 @@ class FormProduct } } $sql.= " WHERE e.entity IN (".getEntity('stock', 1).")"; - if (!empty($status)) + if (count($warehouseStatus)) { - $sql.= " AND e.statut IN (1, ".$status.")"; + $sql.= " AND e.statut IN (".implode(',',$warehouseStatus).")"; } else { @@ -169,7 +187,10 @@ class FormProduct * * @param int $selected Id of preselected warehouse ('' for no value, 'ifone'=select value if one value otherwise no value) * @param string $htmlname Name of html select html - * @param string $filterstatus For filter, additional filter on status other then 1 (open_all). No filter when empty + * @param string $filterstatus warehouse status filter, following comma separated filter options can be used + * 'warehouseopen' = select products from open warehouses, + * 'warehouseclosed' = select products from closed warehouses, + * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @param int $empty 1=Can be empty, 0 if not * @param int $disabled 1=Select is disabled * @param int $fk_product Add quantity of stock in label for product with id fk_product. Nothing if 0. @@ -190,7 +211,7 @@ class FormProduct $out=''; if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) $filterstatus = ''; - $this->loadWarehouses($fk_product, '', + $filterstatus, true, $exclude); // filter on numeric status + $this->loadWarehouses($fk_product, '', $filterstatus, true, $exclude); $nbofwarehouses=count($this->cache_warehouses); if ($conf->use_javascript_ajax && ! $forcecombo) diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index 7a1ef75e9fd..ce585fb7587 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -383,11 +383,11 @@ if ($conf->productbatch->enabled) } // In warehouse print ''; // Out warehouse print ''; // Qty print ''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 63fc770d40e..3505247862b 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -791,7 +791,7 @@ if ($resql) { print ''; } if (! empty($arrayfields['m.fk_user_author']['checked'])) diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 7a64056bdfb..ac37566457f 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -56,7 +56,7 @@ { print ''; print ''; } if ($object->element == 'stock') diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index 8945575d258..b38804c05b1 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -63,7 +63,7 @@ { print ''; print ''; } if ($object->element == 'stock') @@ -75,7 +75,7 @@ } print ''; print ''; print ''; From 03f13e99dea481c74c59e8a71ded00b6177eafbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 11:50:08 +0100 Subject: [PATCH 65/75] Fix regression. Icon was not icon of correct element. --- htdocs/imports/import.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index f86197b82a8..3952cd2d605 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -867,12 +867,13 @@ if ($step == 4 && $datatoimport) print ''; $i++; - $entity=(! empty($objimport->array_import_entities[0][$code])?$objimport->array_import_entities[0][$code]:$objimport->array_import_icon[0]); + $tablealias=preg_replace('/(\..*)$/i','',$code); $tablename=$objimport->array_import_tables[0][$tablealias]; - $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$objimport->array_import_icon[0]; - $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$objimport->array_import_label[0]; + + $entityicon=$entitytoicon[$entity]?$entitytoicon[$entity]:$entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ... + $entitylang=$entitytolang[$entity]?$entitytolang[$entity]:$objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ... print ''; print ''; print ''; -print ''; +print ''; print ''."\n"; // Add specific fields used by Dolibarr foundation for example diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 908ad220f72..cbac1692103 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -95,10 +95,10 @@ if ($id > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; - print ''; + print ''; if (isset($object->photo) && $object->photo !='') { @@ -111,7 +111,7 @@ if ($id > 0) // print "\n"; // } - print ''; + print ''; print '
'.$langs->trans("Company").''; print ''; // ancre pour retourner sur la ligne diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1ae5556a898..971a2189854 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -892,7 +892,7 @@ class Expedition extends CommonObject $result=$product->fetch($fk_product); if ($entrepot_id > 0) { - $product->load_stock(); + $product->load_stock('warehouseopen'); $product_stock = $product->stock_warehouse[$entrepot_id]->real; } else diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 887b5805533..3044a1beb10 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -766,7 +766,7 @@ if ($id > 0 || ! empty($ref)) { $product = new Product($db); $product->fetch($objp->fk_product); - $product->load_stock(); + $product->load_stock('warehouseopen'); } if ($objp->fk_product > 0 && $type == 0 && ! empty($conf->stock->enabled)) From 3ca966459510abd7e05299ec3bc38e37dfbd72cd Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 18:14:42 +0100 Subject: [PATCH 56/75] Filter stock on warehouse status for replenishment Do not show stock of closed warehouse --- htdocs/product/stock/replenish.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 5281d913d95..25232c3bf52 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -552,7 +552,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (! empty($conf->global->STOCK_SUPPORTS_SERVICES) || $objp->fk_product_type == 0) { $prod->fetch($objp->rowid); - $prod->load_stock(); + $prod->load_stock('warehouseopen, warehouseinternal'); // Multilangs if (! empty($conf->global->MAIN_MULTILANGS)) From 7776ae6da436decd4dc53f708feecf30a125ca4d Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 19:19:48 +0100 Subject: [PATCH 57/75] Fix travis --- htdocs/compta/facture.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 839841e4cf9..db9df79b91c 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2484,8 +2484,7 @@ if ($action == 'create') $htmltext=''; if (GETPOST('fac_rec','int') > 0) { - $dateexample=dol_now(); - if (! empty($datefacture?$datefacture:$dateinvoice)) $dateexample=($datefacture?$datefacture:$dateinvoice); + if (empty($dateexample)) $dateexample=dol_now(); $substitutionarray=array( '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', '__TOTAL_TTC__' => $langs->trans("AmountTTC").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ttc).')', From b918d7abc9fe442795772369601f00cad6de791d Mon Sep 17 00:00:00 2001 From: fappels Date: Mon, 5 Dec 2016 19:20:46 +0100 Subject: [PATCH 58/75] fix travis --- htdocs/compta/facture.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index db9df79b91c..ab562584b0a 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2484,6 +2484,7 @@ if ($action == 'create') $htmltext=''; if (GETPOST('fac_rec','int') > 0) { + $dateexample=($datefacture ? $datefacture : $dateinvoice); if (empty($dateexample)) $dateexample=dol_now(); $substitutionarray=array( '__TOTAL_HT__' => $langs->trans("AmountHT").' ('.$langs->trans("Example").': '.price($exampletemplateinvoice->total_ht).')', From 0d7ab3301bfd0b04ca355ac0cf21cebe80cc4196 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2016 11:52:07 +0100 Subject: [PATCH 59/75] FIX in export. Error when using a separate extrafields. --- htdocs/core/extrafieldsinexport.inc.php | 2 +- htdocs/core/modules/modAdherent.class.php | 16 +--- htdocs/core/modules/modProjet.class.php | 89 +++-------------------- htdocs/exports/class/export.class.php | 3 + 4 files changed, 18 insertions(+), 92 deletions(-) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 1a608f6bc2e..332a7d0547e 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra)) } // Add extra fields -$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND entity IN (0, ".$conf->entity.')'; +$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')'; //print $sql; $resql=$this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index ea611fe947a..871d925e069 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -272,19 +272,11 @@ class modAdherent extends DolibarrModules $this->export_label[$r]='MembersAndSubscriptions'; $this->export_permission[$r]=array(array("adherent","export")); $this->export_fields_array[$r]=array('a.rowid'=>'Id','a.civility'=>"UserTitle",'a.lastname'=>"Lastname",'a.firstname'=>"Firstname",'a.login'=>"Login",'a.morphy'=>'Nature','a.societe'=>'Company','a.address'=>"Address",'a.zip'=>"Zip",'a.town'=>"Town",'d.nom'=>"State",'co.code'=>"CountryCode",'co.label'=>"Country",'a.phone'=>"PhonePro",'a.phone_perso'=>"PhonePerso",'a.phone_mobile'=>"PhoneMobile",'a.email'=>"Email",'a.birth'=>"Birthday",'a.statut'=>"Status",'a.photo'=>"Photo",'a.note_public'=>"NotePublic",'a.note_private'=>"NotePrivate",'a.datec'=>'DateCreation','a.datevalid'=>'DateValidation','a.tms'=>'DateLastModification','a.datefin'=>'DateEndSubscription','ta.rowid'=>'MemberTypeId','ta.libelle'=>'MemberTypeLabel','c.rowid'=>'SubscriptionId','c.dateadh'=>'DateSubscription','c.cotisation'=>'Amount'); - $this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.dateadh'=>'Date','c.cotisation'=>'Numeric'); + $this->export_TypeFields_array[$r]=array('a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date','a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.cotisation'=>'Numeric'); $this->export_entities_array[$r]=array('a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.morphy'=>'member','a.societe'=>'member','a.address'=>"member",'a.zip'=>"member",'a.town'=>"member",'d.nom'=>"member",'co.code'=>"member",'co.label'=>"member",'a.phone'=>"member",'a.phone_perso'=>"member",'a.phone_mobile'=>"member",'a.email'=>"member",'a.birth'=>"member",'a.statut'=>"member",'a.photo'=>"member",'a.note_public'=>"member",'a.note_private'=>"member",'a.datec'=>'member','a.datevalid'=>'member','a.tms'=>'member','a.datefin'=>'member','ta.rowid'=>'member_type','ta.libelle'=>'member_type','c.rowid'=>'subscription','c.dateadh'=>'subscription','c.cotisation'=>'subscription'); - - // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity = ".$conf->entity; - $resql=$this->db->query($sql); - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_entities_array[$r][$fieldname]='member'; - } + // Add extra fields + $keyforselect='adherent'; $keyforelement='member'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add axtra fields $this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_end[$r] =' FROM ('.MAIN_DB_PREFIX.'adherent_type as ta, '.MAIN_DB_PREFIX.'adherent as a)'; diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 2d71eaba5a1..73196113751 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -210,101 +210,32 @@ class modProjet extends DolibarrModules $this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_permission[$r]=array(array("projet","export")); - $this->export_dependencies_array[$r]=array('task_time'=>'ptt.rowid'); + $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); $this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.description'=>"Text", - 'pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", - 'ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); + 'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','p.fk_opp_status'=>"Text",'p.opp_percent'=>'Numeric','p.description'=>"Text", + 'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", + 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text"); $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', 's.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company', - 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'p.description'=>"project"); + 'p.rowid'=>"project",'p.ref'=>"project",'p.datec'=>"project",'p.dateo'=>"project",'p.datee'=>"project",'p.duree'=>"project",'p.fk_statut'=>"project",'p.fk_opp_status'=>"project",'p.opp_percent'=>'project','p.description'=>"project"); $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', 's.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'Status','p.description'=>"Description"); + 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','p.fk_opp_status'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.description'=>"Description"); // Add fields for project $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); - // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet'"; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='project'; - } - } - // End add extra fields - + $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'RefTask','pt.label'=>'LabelTask','pt.dateo'=>"TaskDateStart",'pt.datee'=>"TaskDateEnd",'pt.duration_effective'=>"DurationEffective",'pt.planned_workload'=>"PlannedWorkload",'pt.progress'=>"Progress",'pt.description'=>"TaskDescription")); $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask','pt.label'=>'projecttask','pt.dateo'=>"projecttask",'pt.datee'=>"projecttask",'pt.duration_effective'=>"projecttask",'pt.planned_workload'=>"projecttask",'pt.progress'=>"projecttask",'pt.description'=>"projecttask")); // Add extra fields - $sql="SELECT name, label FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task'"; - $resql=$this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj=$this->db->fetch_object($resql)) - { - $fieldname='extra2.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) - { - case 'int': - case 'double': - case 'price': - $typeFilter="Numeric"; - break; - case 'date': - case 'datetime': - $typeFilter="Date"; - break; - case 'boolean': - $typeFilter="Boolean"; - break; - case 'sellist': - $tmp=''; - $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); - if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; - break; - } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='projecttask'; - } - } + $keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote")); $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time")); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 496092b7f73..c2c64f4a9eb 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -377,6 +377,9 @@ class Export case 'Duree': case 'Numeric': case 'Number': + // Must be a string text to allow to use comparison strings like "<= 999" + $szFilterField=''; + break; case 'Status': if (! empty($conf->global->MAIN_ACTIVATE_HTML5)) $szFilterField=''; else $szFilterField=''; From bd0b017571a37a643c940fed707c806210fc477f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Dec 2016 12:13:03 +0100 Subject: [PATCH 60/75] Missing filters --- htdocs/projet/activity/perday.php | 19 ++++++++++++++----- htdocs/projet/activity/perweek.php | 17 +++++++++++++---- htdocs/projet/class/task.class.php | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index d803b55c875..4dab8237c16 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -62,8 +62,10 @@ $month=GETPOST('remonth')?GETPOST('remonth'):(GETPOST("month","int")?GETPOST("mo $day=GETPOST('reday')?GETPOST('reday'):(GETPOST("day","int")?GETPOST("day","int"):date("d")); $day = (int) $day; $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$search_project_ref = GETPOST('search_project_ref', 'alpha'); - +$search_task_ref=GETPOST('search_task_ref', 'alpha'); +$search_task_label=GETPOST('search_task_label', 'alpha'); +$search_project_ref=GETPOST('search_project_ref', 'alpha'); +$search_thirdparty=GETPOST('search_thirdparty', 'alpha'); $monthofday=GETPOST('addtimemonth'); $dayofday=GETPOST('addtimeday'); @@ -84,7 +86,10 @@ $object=new Task($db); if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { $action = ''; + $search_task_ref = ''; + $search_task_label = ''; $search_project_ref = ''; + $search_thirdparty = ''; } if (GETPOST("button_search_x") || GETPOST("button_search.x") || GETPOST("button_search")) { @@ -293,6 +298,9 @@ if ($id) $onlyopenedproject=1; // or -1 $morewherefilter=''; +if ($search_task_ref) $morewherefilter.=natural_search("t.ref", $search_task_ref); +if ($search_task_label) $morewherefilter.=natural_search("t.label", $search_task_label); +if ($search_thirdparty) $morewherefilter.=natural_search("s.nom", $search_thirdparty); $tasksarray=$taskstatic->getTasksArray(0, 0, ($project->id?$project->id:0), $socid, 0, $search_project_ref, $onlyopenedproject, $morewherefilter); // We want to see all task of opened project i am allowed to see, not only mine. Later only mine will be editable later. $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); @@ -416,10 +424,11 @@ print ''.$langs->trans("Note").'
' . $langs->trans('Model') . '
' . $langs->trans('DefaultModel') . ''; include_once DOL_DOCUMENT_ROOT . '/core/modules/commande/modules_commande.php'; $liste = ModelePDFCommandes::liste_modeles($db); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 5187d2e979a..27b87a1b6fe 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -767,7 +767,7 @@ if ($action == 'create') $liste = ModelePdfExpedition::liste_modeles($db); if (count($liste) > 1) { - print "
".$langs->trans("Model")."
".$langs->trans("DefaultModel")."'; print $form->selectarray('model', $liste, $conf->global->EXPEDITION_ADDON_PDF); print "
'; -print $formproduct->selectWarehouses($id_sw, 'id_sw', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); +print $formproduct->selectWarehouses($id_sw, 'id_sw', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); print ''; -print $formproduct->selectWarehouses($id_tw, 'id_tw', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); +print $formproduct->selectWarehouses($id_tw, 'id_tw', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp'); print ''; //print ''; - print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, null, 'maxwidth200'); + print $formproduct->selectWarehouses($search_warehouse, 'search_warehouse', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'maxwidth200'); print ''.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', Entrepot::STATUS_OPEN_INTERNAL, 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); print ''.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', Entrepot::STATUS_OPEN_INTERNAL, 1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); print ''.$langs->trans("WarehouseTarget").''; - print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', Entrepot::STATUS_OPEN_INTERNAL, 1); + print $formproduct->selectWarehouses(GETPOST('id_entrepot_destination'), 'id_entrepot_destination', 'warehouseopen,warehouseinternal', 1); print ''.$langs->trans("NumberOfUnit").'
=>'.img_object('',$entityicon).' '.$langs->trans($entitylang).''; From 455a9ed4da8d5712a5ba2ee7754aee85f358e264 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 12:41:48 +0100 Subject: [PATCH 66/75] FIX security in import of files --- htdocs/core/class/html.formfile.class.php | 4 +- .../modules/import/import_csv.modules.php | 2 +- htdocs/imports/import.php | 42 +++++++++++++++---- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 05a4a8d398e..804a15de39a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -140,10 +140,8 @@ class FormFile if ($perm) { $langs->load('other'); - //$out .= ' ('.$langs->trans("MaxSize").': '.$max.' '.$langs->trans("Kb"); $out .= ' '; - $out.=info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); - //$out .= ')'; + $out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); } } else diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index fed4489c9db..08ae59d0924 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -372,7 +372,7 @@ class ImportCsv extends ModeleImports if ($isidorref == 'ref') // If value into input import file is a ref, we apply the function defined into descriptor { - $file=$objimport->array_import_convertvalue[0][$val]['classfile']; + $file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']); $class=$objimport->array_import_convertvalue[0][$val]['class']; $method=$objimport->array_import_convertvalue[0][$val]['method']; if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval] != '') diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 3952cd2d605..ec49f8e450a 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -529,7 +529,15 @@ if ($step == 3 && $datatoimport) print '
'; print ''; print ''; - + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; $filetoimport=''; @@ -543,14 +551,30 @@ if ($step == 3 && $datatoimport) $var=false; print ''; print "\n"; // Search available imports From 3abeee2d7d655521d51427ca0469524e6d7e2c98 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 13:38:53 +0100 Subject: [PATCH 67/75] Code comment --- htdocs/user/class/user.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 75af1dae8e3..7fae93b6a6e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2440,6 +2440,7 @@ class User extends CommonObject * Return and array with all instanciated first level children users of current user * * @return void + * @see getAllChildIds */ function get_children() { @@ -2602,6 +2603,7 @@ class User extends CommonObject * Return list of all child users id in herarchy (all sublevels). * * @return array Array of user id lower than user. This overwrite this->users. + * @see get_children */ function getAllChildIds() { From 1583d0e49f25411c6562724446597ff5143bce82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 14:14:03 +0100 Subject: [PATCH 68/75] Fix linkof mass action for pdf merge --- htdocs/comm/propal/list.php | 2 +- htdocs/core/class/html.form.class.php | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index cdcedf9bbcc..02afc350e97 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -289,7 +289,7 @@ if ($sall) { } if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category; if ($socid > 0) $sql.= ' AND s.rowid = '.$socid; -if ($viewstatut <> '') +if ($viewstatut != '' && $viewstatut != '-1') { $sql.= ' AND p.fk_statut IN ('.$viewstatut.')'; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ee5bb19bc9a..f5ed62e0b0c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -562,10 +562,17 @@ class Form jQuery(".checkforselect").click(function() { initCheckForSelect(); }); - /* Warning: if you set submit button to disabled, post using Enter will no more work jQuery(".massactionselect").change(function() { - console.log( $( this ).val() ); - if ($(this).val() != \'0\') + var massaction = $( this ).val(); + var urlform = $( this ).closest("form").attr("action").replace("#show_files",""); + if (massaction == "builddoc") + { + urlform = urlform + "#show_files"; + } + $( this ).closest("form").attr("action", urlform); + console.log("we select a mass action "+massaction+" - "+urlform); + /* Warning: if you set submit button to disabled, post using Enter will no more work + if ($(this).val() != \'0\') { jQuery(".massactionconfirmed").prop(\'disabled\', false); } @@ -573,8 +580,8 @@ class Form { jQuery(".massactionconfirmed").prop(\'disabled\', true); } - }); - */ + */ + }); }); '; From d23604701cc7f4cc0e6ae60a4e8b1a2ac98be65f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 15:00:20 +0100 Subject: [PATCH 69/75] Fix responsive --- dev/skeletons/modMyModule.class.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/core/class/html.form.class.php | 22 +++++++++++----------- htdocs/product/stock/massstockmove.php | 5 ++++- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/dev/skeletons/modMyModule.class.php b/dev/skeletons/modMyModule.class.php index 64890b9d9cf..4f994c7c654 100644 --- a/dev/skeletons/modMyModule.class.php +++ b/dev/skeletons/modMyModule.class.php @@ -64,7 +64,7 @@ class modMyModule extends DolibarrModules $this->description = "Description of module MyModule"; $this->descriptionlong = "A very long description. Can be a full HTML content"; $this->editor_name = 'Editor name'; - $this->editor_url = 'http://www.dolibarr.org'; + $this->editor_url = 'https://www.dolibarr.org'; // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 02afc350e97..647ed8a7b4b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -538,7 +538,7 @@ if ($resql) $moreforfilter.='
'; $moreforfilter.=$langs->trans('IncludingProductWithTag'). ': '; $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1); - $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, '', 1); + $moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1); $moreforfilter.='
'; } $parameters=array(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b1b798e2c00..a86a3b939a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4871,17 +4871,17 @@ class Form if ($addjscombo && empty($conf->dol_use_jmobile) && $jsbeautify) { $minLengthToAutocomplete=0; - $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT; - $out.=' - '; + $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?(constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; + + // Enhance with select2 + $nodatarole=''; + if ($conf->use_javascript_ajax) + { + include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php'; + $comboenhancement = ajax_combobox($htmlname); + $out.=$comboenhancement; + $nodatarole=($comboenhancement?' data-role="none"':''); + } } $out.=''; print ''; + +print '
'; print '
'; print '     '; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + $out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':''); + print ''; + $out=''; + if (! empty($conf->global->MAIN_UPLOAD_DOC)) + { + $max=$conf->global->MAIN_UPLOAD_DOC; // En Kb + $maxphp=@ini_get('upload_max_filesize'); // En inconnu + if (preg_match('/k$/i',$maxphp)) $maxphp=$maxphp*1; + if (preg_match('/m$/i',$maxphp)) $maxphp=$maxphp*1024; + if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; + if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; + // Now $max and $maxphp are in Kb + if ($maxphp > 0) $max=min($max,$maxphp); + + $langs->load('other'); + $out .= ' '; + $out.=info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); + } + else + { + $out .= ' ('.$langs->trans("UploadDisabled").')'; + } + print $out; + print '
'; //print '
'; @@ -378,7 +380,7 @@ print ''; if ($conf->productbatch->enabled) { print '
'; } // In warehouse @@ -428,6 +430,7 @@ foreach($listofdata as $key => $val) } print '
'; - print ''; + print ''; print '
'; +print ''; print '
'; From 1838670e314e78891186fdec5077855544189bbc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 19:02:39 +0100 Subject: [PATCH 70/75] Fix several security holes on api when used by external users --- .../action/class/api_agendaevents.class.php | 12 +++++-- .../comm/propal/class/api_proposals.class.php | 4 ++- .../class/api_deprecated_commande.class.php | 1 + htdocs/commande/class/api_orders.class.php | 4 ++- .../class/api_deprecated_invoice.class.php | 1 + .../facture/class/api_invoices.class.php | 15 +++++---- .../class/api_expensereports.class.php | 7 +---- .../class/api_supplier_invoices.class.php | 4 ++- htdocs/projet/class/api_projects.class.php | 4 ++- htdocs/projet/class/api_tasks.class.php | 4 ++- htdocs/societe/class/api_contacts.class.php | 31 +++++++++---------- .../class/api_deprecated_thirdparty.class.php | 1 + .../societe/class/api_thirdparties.class.php | 14 +++++---- 13 files changed, 60 insertions(+), 42 deletions(-) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 931283b0ab0..7d66dccdd63 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -102,13 +102,19 @@ class AgendaEvents extends DolibarrApi $obj_ret = array(); - // case of external user, $societe param is ignored and replaced by user's socid - //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; - + // case of external user + $socid = 0; + if (! empty(DolibarrApiAccess::$user->societe_id)) $socid = DolibarrApiAccess::$user->societe_id; + + // If the internal user must only see his customers, force searching by him + $search_sale = 0; + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + $sql = "SELECT t.id as rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as t"; $sql.= ' WHERE t.entity IN ('.getEntity('agenda', 1).')'; if ($user_ids) $sql.=" AND t.fk_user_action IN (".$user_ids.")"; + if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; // Insert sale filter if ($search_sale > 0) { diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index b4a15c2aa97..6ceac37a535 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -97,10 +97,12 @@ class Proposals extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index f5d799dd477..60c8c7f4aa8 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -115,6 +115,7 @@ class CommandeApi extends DolibarrApi $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT s.rowid"; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index cc186367588..984ef5e6f43 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -101,10 +101,12 @@ class Orders extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index b87bb2e9dc0..7dd8a7ee6bc 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -111,6 +111,7 @@ class InvoiceApi extends DolibarrApi $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $socid; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT s.rowid"; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 888c05bff26..ddbae55f0ef 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -98,21 +98,24 @@ class Invoices extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; - + // If the internal user must only see his customers, force searching by him - if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + $search_sale = 0; + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."facture as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ' WHERE t.entity IN ('.getEntity('facture', 1).')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; + if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale // Filter by status diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index bf07089b71b..cb506d32cdf 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -101,17 +101,12 @@ class ExpenseReports extends DolibarrApi // case of external user, $societe param is ignored and replaced by user's socid //$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; - + $sql = "SELECT t.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as t"; $sql.= ' WHERE t.entity IN ('.getEntity('expensereport', 1).')'; if ($user_ids) $sql.=" AND t.fk_user_author IN (".$user_ids.")"; - // Insert sale filter - if ($search_sale > 0) - { - $sql .= " AND sc.fk_user = ".$search_sale; - } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 660e64147ed..2348abfdc48 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -99,10 +99,12 @@ class SupplierInvoices extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 2b5ee92d878..78e7954a097 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -102,10 +102,12 @@ class Projects extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index c88850ca403..1678e43328f 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -109,10 +109,12 @@ class Tasks extends DolibarrApi global $db, $conf; $obj_ret = array(); - // case of external user, $thirdpartyid param is ignored and replaced by user's socid + + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 9f09f7f7408..da8e930a0ce 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -84,41 +84,40 @@ class Contacts extends DolibarrApi * * Get a list of contacts * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $socid ID of thirdparty to filter list - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" - * @return array Array of contact objects + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param string $thirdparty_ids Thirdparty ids to filter projects of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @return array Array of contact objects * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $socid = 0, $sqlfilters = '') { + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $thirdparty_ids = '', $sqlfilters = '') { global $db, $conf; $obj_ret = array(); - if (!$socid) - { - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; - } + // case of external user, $thirdparty_ids param is ignored and replaced by user's socid + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; // If the internal user must only see his customers, force searching by him - if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) + $search_sale = 0; + if (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; $sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) { + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { // We need this table joined to the select in order to filter by sale $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; } $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON t.fk_soc = s.rowid"; $sql.= ' WHERE t.entity IN (' . getEntity('socpeople', 1) . ')'; - if ($socid) $sql.= " AND t.fk_soc = " . $socid; + if ($socids) $sql.= " AND t.fk_soc IN (" . $socids . ")"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale diff --git a/htdocs/societe/class/api_deprecated_thirdparty.class.php b/htdocs/societe/class/api_deprecated_thirdparty.class.php index 6086f2366d8..8b0302f9c11 100644 --- a/htdocs/societe/class/api_deprecated_thirdparty.class.php +++ b/htdocs/societe/class/api_deprecated_thirdparty.class.php @@ -165,6 +165,7 @@ class ThirdpartyApi extends DolibarrApi $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; // If the internal user must only see his customers, force searching by him + $search_sale = 0; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT s.rowid"; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index bc156b5cc4a..674d8abcf42 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -102,25 +102,27 @@ class Thirdparties extends DolibarrApi $obj_ret = array(); - $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; + // case of external user, we force socids + $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : ''; // If the internal user must only see his customers, force searching by him - if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; + $search_sale = 0; + if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; $sql = "SELECT t.rowid"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."societe as t"; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; $sql.= " WHERE t.fk_stcomm = st.id"; if ($mode == 1) $sql.= " AND t.client IN (1, 3)"; if ($mode == 2) $sql.= " AND t.client IN (2, 3)"; if ($mode == 3) $sql.= " AND t.client IN (0)"; $sql.= ' AND t.entity IN ('.getEntity('societe', 1).')'; - if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; //if ($email != NULL) $sql.= " AND s.email = \"".$email."\""; - if ($socid) $sql.= " AND t.rowid = ".$socid; + if ($socid) $sql.= " AND t.rowid IN (".$socids.")"; if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale // Insert sale filter if ($search_sale > 0) From 49f5ec6b527c4bb4e6184f1436215fe7ccfd8cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 19:12:25 +0100 Subject: [PATCH 71/75] Fix bugs reported by scrutinizer --- htdocs/compta/facture/class/api_invoices.class.php | 6 ++++-- htdocs/fourn/class/api_supplier_invoices.class.php | 5 +++-- htdocs/fourn/class/fournisseur.facture.class.php | 1 - 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index ddbae55f0ef..6fc96a4dfe6 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -153,6 +153,7 @@ class Invoices extends DolibarrApi $result = $db->query($sql); if ($result) { + $i=0; $num = $db->num_rows($result); while ($i < min($num, ($limit <= 0 ? $num : $limit))) { @@ -177,7 +178,7 @@ class Invoices extends DolibarrApi * Create invoice object * * @param array $request_data Request datas - * @return int ID of invoice + * @return int ID of invoice */ function post($request_data = NULL) { @@ -278,7 +279,7 @@ class Invoices extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Datas to validate + * @param array|null $data Datas to validate * @return array * * @throws RestException @@ -293,4 +294,5 @@ class Invoices extends DolibarrApi } return $invoice; } + } diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 2348abfdc48..cca9743927b 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -16,9 +16,9 @@ * along with this program. If not, see . */ - use Luracast\Restler\RestException; +use Luracast\Restler\RestException; - require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; /** * API class for supplier invoices @@ -153,6 +153,7 @@ class SupplierInvoices extends DolibarrApi $result = $db->query($sql); if ($result) { + $i = 0; $num = $db->num_rows($result); while ($i < min($num, ($limit <= 0 ? $num : $limit))) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 878c0886918..05148517c23 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -326,7 +326,6 @@ class FactureFournisseur extends CommonInvoice { $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); - var_dump($this->lines[$i]);exit; $this->updateline( $idligne, $this->lines[$i]->description, From 2938e01fdd1d2c6e48e11f38ef19b05716f4dd0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 19:16:33 +0100 Subject: [PATCH 72/75] Fix a delete must be done after a fetch --- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8fa91cb57a2..8b5ab723bd3 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -148,7 +148,7 @@ if (empty($reshook)) { if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { if ($id <> $user->id) { $object = new User($db); - $object->id = $id; + $object->fetch($id); $result = $object->delete(); if ($result < 0) { $langs->load("errors"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7fae93b6a6e..d917b53078a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -159,9 +159,9 @@ class User extends CommonObject /** * Load a user from database with its id or ref (login) * - * @param int $id Si defini, id a utiliser pour recherche - * @param string $login Si defini, login a utiliser pour recherche - * @param string $sid Si defini, sid a utiliser pour recherche + * @param int $id If defined, id to used for search + * @param string $login If defined, login to used for search + * @param string $sid If defined, sid to used for search * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx) * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. * @return int <0 if KO, 0 not found, >0 if OK From cd39b1c6f0fc317e0195787d87a830c29f4a2e75 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Thu, 8 Dec 2016 00:12:54 +0100 Subject: [PATCH 73/75] Fix: Field comments not registered in new member public form & presentation --- htdocs/adherents/class/adherent.class.php | 13 +++++++++---- htdocs/public/members/new.php | 5 ++--- htdocs/public/members/public_card.php | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 79aa64fb1ab..945ed849f57 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -83,6 +83,9 @@ class Adherent extends CommonObject var $datevalid; var $birth; + var $note_public; + var $note_private; + var $typeid; // Id type adherent var $type; // Libelle type adherent var $need_subscription; @@ -410,7 +413,9 @@ class Adherent extends CommonObject $this->country_id=($this->country_id > 0?$this->country_id:$this->country_id); $this->state_id=($this->state_id > 0?$this->state_id:$this->state_id); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords(trim($this->lastname)); - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname)); + if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords(trim($this->firstname)); + $this->note_public=($this->note_public?$this->note_public:$this->note_public); + $this->note_private=($this->note_private?$this->note_private:$this->note_private); // Check parameters if (! empty($conf->global->ADHERENT_MAIL_REQUIRED) && ! isValidEMail($this->email)) @@ -440,7 +445,7 @@ class Adherent extends CommonObject $sql.= ", phone_perso=" .($this->phone_perso?"'".$this->db->escape($this->phone_perso)."'":"null"); $sql.= ", phone_mobile=" .($this->phone_mobile?"'".$this->db->escape($this->phone_mobile)."'":"null"); $sql.= ", note_private=" .($this->note_private?"'".$this->db->escape($this->note_private)."'":"null"); - $sql.= ", note_public=" .($this->note_private?"'".$this->db->escape($this->note_public)."'":"null"); + $sql.= ", note_public=" .($this->note_public?"'".$this->db->escape($this->note_public)."'":"null"); $sql.= ", photo=" .($this->photo?"'".$this->photo."'":"null"); $sql.= ", public='".$this->public."'"; $sql.= ", statut=" .$this->statut; @@ -1146,11 +1151,11 @@ class Adherent extends CommonObject $this->birth = $this->db->jdate($obj->birthday); $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; + $this->note_public = $obj->note_public; $this->morphy = $obj->morphy; $this->typeid = $obj->fk_adherent_type; - $this->type = $obj->type; + $this->type = $obj->type; $this->need_subscription = $obj->subscription; $this->user_id = $obj->user_id; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index c026ad859e5..6d2b469fb55 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -238,11 +238,10 @@ if ($action == 'add') $adh->pass = $_POST["pass1"]; } $adh->photo = $_POST["photo"]; - $adh->note = $_POST["note"]; $adh->country_id = $_POST["country_id"]; $adh->state_id = $_POST["state_id"]; $adh->typeid = $_POST["type"]; - $adh->note = $_POST["comment"]; + $adh->note_private= $_POST["note_private"]; $adh->morphy = $_POST["morphy"]; $adh->birth = $birthday; @@ -520,7 +519,7 @@ foreach($extrafields->attribute_label as $key=>$value) // Comments print '
'.$langs->trans("Comments").'
'.$langs->trans("Lastname").''.$object->lastname.' 
'.$langs->trans("Company").''.$object->societe.' 
'.$langs->trans("Address").''.nl2br($object->address).' 
'.$langs->trans("Zip").' '.$langs->trans("Town").''.$object->zip.' '.$object->town.' 
'.$langs->trans("Zip").' / '.$langs->trans("Town").''.$object->zip.' '.$object->town.' 
'.$langs->trans("Country").''.$object->country.' 
'.$langs->trans("EMail").''.$object->email.' 
'.$langs->trans("Birthday").''.$object->birth.' 
'.$langs->trans("Birthday").''.dol_print_date($object->birth,'day').'
$value".$object->array_options["options_$key"]." 
'.$langs->trans("Comments").''.nl2br($object->note).'
'.$langs->trans("Comments").''.nl2br($object->note_public).'
'; } From 521eb3a520119c8b42e1364c3c8c121f12801dd6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Dec 2016 12:44:58 +0100 Subject: [PATCH 74/75] Prepare 5.0 --- ChangeLog | 120 +++++++++++++++++++++++++++++++- build/makepack-howto.txt | 2 + htdocs/theme/eldy/style.css.php | 4 +- htdocs/theme/md/style.css.php | 4 +- 4 files changed, 125 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2f9bbcc45c3..e0b157c7dc9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,7 +15,125 @@ make a Dolibarr upgrade. ***** ChangeLog for 5.0.0 compared to 4.0.* ***** For users: -... +NEW: Add module mulicurrency. +NEW: Add module accoutancy expert (double party accountancy). +NEW: Better responsive design, above all on smartphone. +NEW: #5801 More complete change to allow to disable supplier invoice document generation. +NEW: #5830 Can choose a generic email or use remail in the mail from field. +NEW: #5896 More complete data on event sent by email (name in title, emails list in details) +NEW: Add a better icon to show when "run" in cron jobs is disabled. +NEW: Add account statement into fields of bank account transaction list. +NEW: Add a direct debit mandate PDF template. +NEW: add clone contract feature. +NEW: Add color regarding stock even on ajax autocompleter product selector. +NEW: Add date into list of print jobs for Google Print. +NEW: add field and filters on turnover by third party report. +NEW: Add last activation date as info in module list. +NEW: add option to limit stock product by warehouse. +NEW: Add missing unique key on table llx_links. +NEW: Add option "Hide images in Top menu". +NEW: Add option PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY to show thirdparty on page to submit time. +NEW: Add option "Stock can be negative". Off by default. +NEW: Add option SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED. +NEW: Add hidden option to include parent products too in stats of orders (not supported in rest of app yet). +NEW: Add Panama datas. +NEW: Add ressource extrafields. +NEW: add restrictions on standard exports (agenda, order, deplacement, facture, fournisseur, societe, propal, expedition) +NEW: Add substitution keys __SHIPPINGTRACKNUM__, __SHIPPINGTRACKNUMURL__ into shipping email template. +NEW: Add status Done on interventions. +NEW: Add system tool "Files integrity checker" to detect modified files for packaged versions. +NEW: Add tooltip in payment term edition in dictionnary. +NEW: Add type "url" as possible extrafield. +NEW: Add workflow to calculated supplier order status on stock dispatch. +NEW: Add workflow to classifed propal bill on invoice validation. +NEW: allow to save a parent warehouse. +NEW: Better filtering of automatic/manually inserted events. +NEW: Bill orders from order list. +NEW: Can add event from the card listing events. +NEW: Can change thirdparty when cloning a project. +NEW: Can create expense report for someone else (advanced permission). +NEW: Can clone an expense report. +NEW: Can edit a label for each price segment when using several segment prices for products. +NEW: Can filter on fields on admin translation page. +NEW: Can filter on project/task ref/label on the "new time consumed" page. +NEW: Can filter on status on objects on the "statistics" pages. +NEW: Can filter on type of leave requests in list. +NEW: Can generate SEPA mandate for each bank account of your customers. +NEW: Can see/make bank conciliation from bank transaction list. +NEW: Can edit RUM number of a customer bank account. +NEW: Can link template invoice to other objects. Generated invoices will be linked to same objects (example: contracts). +NEW: Can renamed attached files on some documents tabs (like products and expense reports). +NEW: Can see/edit the customer ref of a shipment. +NEW: Can select fields/extrafields on contract list + Mass delete action. +NEW: Can select fields on expense report list. Can make mass delete. +NEW: Can select fields to show on list of bank transaction. +NEW: Can set to paid automatically social or fiscal taxes after a payment was recorded. +NEW: Can sort on status of recurring invoice in list of template invoices. +NEW: Can use native php and dolibarr object on pages of module website. +NEW: Checkbox 'close order to "Everything received" automatically if all products are received' is visible on supplier orders. +NEW: conf to allow payments on different thirdparties bills but same parent company. +NEW: Consumption view on thirdparty total line and total HT by element. +NEW: Display bookkeeping by accounting account - Bookkeeping ordered by accounting account - Link with customers and suppliers invoices - Sub Total by accounting account - Ability to display more than 25 lines and filter by customer/supplier, invoice and accounting account +NEW: Each user can select its landing page (on tab "user display setup"). +NEW: Editing translation GUI become easier with tool to search existing translation. +NEW: Error code of each email sent is visible in list of email targets +NEW: Export thirdparty with payment terms and mode. +NEW: filter actiontype on thirdparty tab. +NEW: filter by supplier and fk_warehouse on replenishment page. +NEW: Filters can accept generic search key like __DAY__, __MONTH__, __YEAR__ replaced with current day, month year before making the search. +NEW: Function "crop" images available on project, product and holiday attachment tab. +NEW: function to display full path to current warehouse. +NEW: Generation of document is available on member card. +NEW: Introduce mass action "delete" on sales orders. +NEW: Introduce option MAIN_DEFAULT_PAYMENT_TERM_ID to set default payment term on company level. +NEW: introduce option PROJECT_DISABLE_PRIVATE_PROJECT and PROJECT_DISABLE_PUBLIC_PROJECT. +NEW: Link between objects can be done on both side and on all objects. +NEW: More filter on bank transaction list. +NEW: Mutualize mass action. So "Send by email" is also available on orders. +NEW: New set of icon for status easier to understand. +NEW: option "Current/Next" for limit payment date (in payment term dictionary setup) to use a specific day of current month or jump to same day of next month. +NEW: Option DOC_SHOW_FIRST_SALES_REP shows name of "user buyer or saler" on PDF. +NEW: Option MAIN_INFO_SOCIETE_MAIL_ALIASES to be able to use several identities into the "email from". +NEW: Pagination available on list of users. +NEW: Phone formatting for Canada. Add dol_print_phone into phpunit tests. +NEW: Reduce nb of picto visible after reference of an object into lists, merging preview and download. +NEW: Reduce space lost on EDM module. +NEW: Reopen a paid bill is a user advanced permission. +NEW: can set a default bank account on thirdparty card. +NEW: Show photo of contacts on thirdparty card. +NEW: Show subtotal into list of linked elements. +NEW: Show total line (planned workload and time spent) on list of tasks. +NEW: Start to introduce search filters on dictionnaries for vat list. +NEW: Support extrafields for expense reports. +NEW: Support extrafields on product lot. +NEW: Support free bottom text and watermark on expense report template. +NEW: Support mass actions for proposals +NEW: Table with list of lots/serial can be viewed (module product batch). +NEW: The autofill zip/town table option is on by default. +NEW: the count of linked files on card includes external links. +NEW: Usage of vat code seems ok everywhere. +NEW: User date of employment added. +NEW: Use small photo of user on all user links. +NEW: Use new archi to select fields into list of time spent. + +For developers: +NEW: Add ORDER_MODIFY trigger on each order modification. +NEW: Trigger on delete stock +NEW: The getURLContent return more information on success and error. +NEW: Uniformize code and correct deal with triggers +NEW: REST API explorer. Can create invoice and orders with lines. +NEW: Add a lot of API REST: expense reports, orders, commercial proposals, projects, agenda events, users, invoices, ... +NEW: Default collation for mysql is now utf8_unicode_ci +NEW: Can use any filter on all REST API to list. +NEW: ckeditor accept a parameter to disable all html filtering. +NEW: Complete table llx_ecm_files with field generated_or_uploaded +NEW: Enhance function setValueFrom so we can use it for "edit in form" feature. +NEW: getNomUrl displays full path to warehouse +NEW: Hook formObjectOptions +NEW: hook in element overview +NEW: Hook on stock product card +NEW: param socid find_min_price_product_fournisseur() function +NEW: More phpunit tests WARNING: diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 76a290708a9..f1770a692c0 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -12,6 +12,7 @@ beta version of Dolibarr, step by step. To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +- To know number of lines changes: git diff --shortstat A B - Update version number with x.y.z-w in htdocs/filefunc.inc.php - Commit all changes. @@ -35,6 +36,7 @@ complete release of Dolibarr, step by step. To generate a changelog of a major new version x.y.0 (from develop repo), you can do "cd ~/git/dolibarr; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent develop) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a major new version x.y.0 (from x.y repo), you can do "cd ~/git/dolibarr_x.y; git log `diff -u <(git rev-list --first-parent x.(y-1).0) <(git rev-list --first-parent x.y.0) | sed -ne 's/^ //p' | head -1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log x.y.z-1.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e '^FIX\|NEW' | sort -u | sed 's/FIXED:/FIX:/g' | sed 's/FIXED :/FIX:/g' | sed 's/FIX :/FIX:/g' | sed 's/FIX /FIX: /g' | sed 's/NEW :/NEW:/g' | sed 's/NEW /NEW: /g' > /tmp/aaa" +- To know number of lines changes: git diff --shortstat A B - Update version number with x.y.z in htdocs/filefunc.inc.php - Commit all changes. diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 5de31c6ee59..6c7d039239c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -3041,10 +3041,10 @@ div.error { /* Info admin */ div.info { - color: #303020; + color: #303035; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #AAAAAA; + border: 1px solid #e0e0e0; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 0edf06380f5..266ad076822 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2949,10 +2949,10 @@ div.error { /* Info admin */ div.info { - color: #303020; + color: #303035; padding: 0.4em 0.4em 0.4em 0.4em; margin: 0.5em 0em 0.5em 0em; - border: 1px solid #AAAAAA; + border: 1px solid #e0e0e0; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; From bc8b2ae33130b11c96b719f2407a50f6f26586eb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 8 Dec 2016 13:13:46 +0100 Subject: [PATCH 75/75] Update doc --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index e0b157c7dc9..f596ae1bb88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -115,6 +115,7 @@ NEW: Usage of vat code seems ok everywhere. NEW: User date of employment added. NEW: Use small photo of user on all user links. NEW: Use new archi to select fields into list of time spent. +NEW: Available substitution key (__INVOICE_MONTH__, __INVOICE_PREVIOUS_MONTH__, ...) to use into note text of recurring invoices. For developers: NEW: Add ORDER_MODIFY trigger on each order modification.