diff --git a/.tx/config b/.tx/config index b98bf7828f2..6d3518fabd4 100644 --- a/.tx/config +++ b/.tx/config @@ -128,6 +128,12 @@ source_file = htdocs/langs/en_US/errors.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.eventorganization] +file_filter = htdocs/langs//eventorganization.lang +source_file = htdocs/langs/en_US/eventorganization.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.exports] file_filter = htdocs/langs//exports.lang source_file = htdocs/langs/en_US/exports.lang @@ -278,6 +284,12 @@ source_file = htdocs/langs/en_US/other.lang source_lang = en_US type = MOZILLAPROPERTIES +[dolibarr.partnership] +file_filter = htdocs/langs//partnership.lang +source_file = htdocs/langs/en_US/partnership.lang +source_lang = en_US +type = MOZILLAPROPERTIES + [dolibarr.paybox] file_filter = htdocs/langs//paybox.lang source_file = htdocs/langs/en_US/paybox.lang diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index e99b8673981..e78438d8791 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -16,7 +16,7 @@ htdocs/conf.php */nltechno* */htdocs/includes - */htdocs/includes + source .git diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index ecd77560597..e29653a3e40 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -270,8 +270,8 @@ if (empty($pcgvercode)) { $sql = "SELECT p.rowid, p.ref, p.label, p.description, p.tosell, p.tobuy, p.tva_tx,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; - $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } else { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; @@ -280,14 +280,14 @@ $sql .= " p.tms, p.fk_product_type as product_type,"; $sql .= " aa.rowid as aaid"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = pa." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ppe." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; } else { $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; } $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; if (strlen(trim($search_current_account))) { - $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, $search_current_account); + $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, $search_current_account); } if ($search_current_account_valid == 'withoutvalidaccount') { $sql .= " AND aa.account_number IS NULL"; @@ -466,7 +466,7 @@ if ($result) { } else { print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); } - print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "pa.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); + print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); print_liste_field_titre("AssignDedicatedAccountingAccount"); $clickpitco = $form->showCheckAddButtons('checkforselect', 1); print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center '); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index f0bcd9f7a49..b3ce892b235 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -102,7 +102,7 @@ if (!empty($id)) { $sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,"; $sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell,"; + $sql .= " ppe.accountancy_code_sell as code_sell,"; } else { $sql .= " p.accountancy_code_sell as code_sell,"; } @@ -110,7 +110,7 @@ if (!empty($id)) { $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = l.fk_facture"; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 43daa2efa88..6874aacb58a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -126,15 +126,15 @@ if ($action == 'validatehistory') { $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; } $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.tva_intra,"; - if (!empty($conf->global->ACCOUNTANCY_COMPANY_SHARED)) { - $sql .= " sa.accountancy_code_sell as company_code_sell"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_sell as company_code_sell"; } else { $sql .= " s.accountancy_code_sell as company_code_sell"; } @@ -145,10 +145,10 @@ if ($action == 'validatehistory') { $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } - $alias_societe_perentity = empty($conf->global->ACCOUNTANCY_COMPANY_SHARED) ? "s" : "sa"; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 6f522750398..b8cc34c3cae 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -184,9 +184,9 @@ $sql .= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, f $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } else { - $sql .= " p.accountancy_code_sell,"; + $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } $sql .= " aa.rowid as fk_compte, aa.account_number, aa.label as label_account, aa.labelshort as labelshort_account,"; $sql .= " fd.situation_percent,"; @@ -198,7 +198,7 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index f52dfc6d589..678e5081937 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -219,8 +219,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.datef, f.type as ftype,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; - $sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; @@ -229,8 +229,8 @@ $sql .= " p.tosell as status, p.tobuy as status_buy,"; $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,"; -if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " sa.accountancy_code_sell as company_code_sell"; +if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_sell as company_code_sell"; } else { $sql .= " s.accountancy_code_sell as company_code_sell"; } @@ -240,16 +240,16 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } -$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa"; -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_sell = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index bf950182798..018cba4ca89 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -106,9 +106,17 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)) $sql = "SELECT f.rowid, f.ref as ref, f.type, f.datef as df, f.libelle,f.ref_supplier, f.date_lim_reglement as dlf, f.close_code,"; $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tva as total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.vat_src_code,"; $sql .= " s.rowid as socid, s.nom as name, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; -$sql .= " p.accountancy_code_buy , aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy,"; +} else { + $sql .= " p.accountancy_code_buy,"; +} +$sql .= " aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); +} $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = fd.fk_facture_fourn"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 1904631775d..a9b6f17a9bd 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -110,14 +110,14 @@ $sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.tot $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,"; $sql .= " p.rowid as pid, p.ref as pref, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell"; + $sql .= " ppe.accountancy_code_sell"; } else { $sql .= " p.accountancy_code_sell"; } $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index cd17df33776..1e7887c1bdc 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -101,10 +101,18 @@ $formaccounting = new FormAccounting($db); if (!empty($id)) { $sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; - $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; - $sql .= ", aa.account_number, aa.label"; + $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label,"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy as code_buy,"; + } else { + $sql .= " p.accountancy_code_buy as code_buy,"; + } + $sql .= " aa.account_number, aa.label"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn "; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = ".((int) $id); diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 91dd921f1fa..a69debeb0c0 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -132,20 +132,35 @@ if ($action == 'validatehistory') { // Supplier Invoice Lines (must be same request than into page list.php for manual binding) $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.type as ftype,"; $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; - $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type,"; - $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export, p.tva_tx as tva_tx_prod,"; + $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; + } else { + $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; + } $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export, aa4.rowid as aarowid_thirdparty,"; $sql .= " co.code as country_code, co.label as country_label,"; - $sql .= " s.tva_intra, s.accountancy_code_buy as company_code_buy"; + $sql .= " s.tva_intra,"; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " spe.accountancy_code_buy as company_code_buy"; + } else { + $sql .= " s.accountancy_code_buy as company_code_buy"; + } + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON p.accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON p.accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON s.accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; + if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); + } + $alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_product_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity; $sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0"; $sql .= " AND l.product_type <= 2"; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 1f81a5d7e2c..deed1299fd5 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2020 Alexandre Spangaro + * Copyright (C) 2013-2021 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -94,6 +94,9 @@ if (empty($user->rights->accounting->mouvements->lire)) { } +$formaccounting = new FormAccounting($db); + + /* * Actions */ @@ -116,7 +119,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_tvaintra = ''; } -if (is_array($changeaccount) && count($changeaccount) > 0) { +if (is_array($changeaccount) && count($changeaccount) > 0 && $user->rights->accounting->bind->write) { $error = 0; if (!(GETPOST('account_parent', 'int') >= 0)) { @@ -124,7 +127,6 @@ if (is_array($changeaccount) && count($changeaccount) > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); } - if (!$error) { $db->begin(); @@ -184,7 +186,11 @@ $sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invo $sql .= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,"; $sql .= " aa.label, aa.labelshort, aa.account_number,"; $sql .= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tobuy, p.tosell,"; -$sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; +} else { + $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; +} $sql .= " co.code as country_code, co.label as country,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur"; $parameters = array(); @@ -192,6 +198,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; +if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); +} $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index a1841654d3f..dda111856d3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -224,8 +224,8 @@ $sql = "SELECT f.rowid as facid, f.ref, f.ref_supplier, f.libelle as invoice_lab $sql .= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.tva_tx as tva_tx_prod,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell as code_sell, pa.accountancy_code_sell_intra as code_sell_intra, pa.accountancy_code_sell_export as code_sell_export,"; - $sql .= " pa.accountancy_code_buy as code_buy, pa.accountancy_code_buy_intra as code_buy_intra, pa.accountancy_code_buy_export as code_buy_export,"; + $sql .= " ppe.accountancy_code_sell as code_sell, ppe.accountancy_code_sell_intra as code_sell_intra, ppe.accountancy_code_sell_export as code_sell_export,"; + $sql .= " ppe.accountancy_code_buy as code_buy, ppe.accountancy_code_buy_intra as code_buy_intra, ppe.accountancy_code_buy_export as code_buy_export,"; } else { $sql .= " p.accountancy_code_sell as code_sell, p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; $sql .= " p.accountancy_code_buy as code_buy, p.accountancy_code_buy_intra as code_buy_intra, p.accountancy_code_buy_export as code_buy_export,"; @@ -235,7 +235,7 @@ $sql .= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_ $sql .= " co.code as country_code, co.label as country_label,"; $sql .= " s.rowid as socid, s.nom as name, s.tva_intra, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " sa.accountancy_code_buy as company_code_buy"; + $sql .= " spe.accountancy_code_buy as company_code_buy"; } else { $sql .= " s.accountancy_code_buy as company_code_buy"; } @@ -245,16 +245,16 @@ $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as sa ON sa.fk_soc = s.rowid AND sa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn_det as l ON f.rowid = l.fk_facture_fourn"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } -$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "sa"; -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_societe_perentity = empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED) ? "s" : "spe"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON " . $alias_product_perentity . ".accountancy_code_buy = aa.account_number AND aa.active = 1 AND aa.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 9b28cc6473e..6235ea1fa5b 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -937,17 +937,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="create"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -1167,17 +1164,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { document.formsoc.action.value="edit"; document.formsoc.submit(); }); - function initfieldrequired() - { + function initfieldrequired() { jQuery("#tdcompany").removeClass("fieldrequired"); jQuery("#tdlastname").removeClass("fieldrequired"); jQuery("#tdfirstname").removeClass("fieldrequired"); - if (jQuery("#morphy").val() == \'mor\') - { + if (jQuery("#morphy").val() == \'mor\') { jQuery("#tdcompany").addClass("fieldrequired"); } - if (jQuery("#morphy").val() == \'phy\') - { + if (jQuery("#morphy").val() == \'phy\') { jQuery("#tdlastname").addClass("fieldrequired"); jQuery("#tdfirstname").addClass("fieldrequired"); } @@ -1747,12 +1741,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print $langs->trans("SubscriptionNotNeeded"); } elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } else { print $langs->trans("SubscriptionNotReceived"); - if ($object->statut > 0) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated } } @@ -1862,7 +1856,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($action != 'editlogin' && $action != 'editthirdparty') { // Send if (empty($user->socid)) { - if ($object->statut == 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { print ''."\n"; } } @@ -1870,20 +1864,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Send card by email // TODO Remove this to replace with a template /* - if ($user->rights->adherent->creer) - { - if ($object->statut >= 1) - { + if ($user->rights->adherent->creer) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($object->email) print '\n"; else print '\n"; - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; } - } - else - { + } else { print '
'.$langs->trans("SendCardByMail")."
"; }*/ @@ -1895,7 +1883,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Validate - if ($object->statut == -1) { + if (Adherent::STATUS_DRAFT == $object->statut) { if ($user->rights->adherent->creer) { print ''."\n"; } else { @@ -1904,7 +1892,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Reactivate - if ($object->statut == 0 || $object->statut == -2) { + if (Adherent::STATUS_RESILIATED == $object->statut || Adherent::STATUS_EXCLUDED == $Object->statut) { if ($user->rights->adherent->creer) { print '\n"; } else { @@ -1913,7 +1901,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Resiliate - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1922,7 +1910,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Exclude - if ($object->statut >= 1) { + if (Adherent::STATUS_VALIDATED == $object->statut) { if ($user->rights->adherent->supprimer) { print '\n"; } else { @@ -1933,7 +1921,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create third party if (!empty($conf->societe->enabled) && !$object->socid) { if ($user->rights->societe->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n";; } else { print ''."\n"; @@ -1946,7 +1934,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create user if (!$user->socid && !$object->user_id) { if ($user->rights->user->user->creer) { - if ($object->statut != -1) { + if (Adherent::STATUS_DRAFT != $object->statut) { print ''."\n"; } else { print ''."\n"; @@ -2010,7 +1998,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Show links to link elements /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + if ($linktoelem) { + print ($somethingshown?'':'
').$linktoelem; + } */ // Show online payment link diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 1d4f2029039..80d14ee9ceb 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -204,12 +204,11 @@ class Adherent extends CommonObject */ public $morphy; + /** + * @var int Info can be public + */ public $public; - // -2:exclu, -1:brouillon, 0:resilie, >=1:valide,paye - // def in common object - //public $status; - /** * @var string photo of member */ @@ -326,7 +325,7 @@ class Adherent extends CommonObject 'fk_user_valid' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserValidation', 'enabled' => 1, 'visible' => -1, 'position' => 190), 'canvas' => array('type' => 'varchar(32)', 'label' => 'Canvas', 'enabled' => 1, 'visible' => -1, 'position' => 195), 'statut' => array('type' => 'smallint(6)', 'label' => 'Statut', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 500, - 'arrayofkeyval' => array(0 => 'Draft', 1 => 'Validated', -1 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), + 'arrayofkeyval' => array(-1 => 'Draft', 1 => 'Validated', 0 => 'MemberStatusResiliatedShort', -2 => 'MemberStatusExcludedShort')), 'model_pdf' => array('type' => 'varchar(255)', 'label' => 'Model pdf', 'enabled' => 1, 'visible' => 0, 'position' => 800), 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 805) ); @@ -334,7 +333,7 @@ class Adherent extends CommonObject /** * Draft status */ - const STATUS_DRAFT = 0; + const STATUS_DRAFT = -1; /** * Validated status */ @@ -342,7 +341,7 @@ class Adherent extends CommonObject /** * Resiliated */ - const STATUS_RESILIATED = -1; + const STATUS_RESILIATED = 0; /** * Excluded */ @@ -357,7 +356,8 @@ class Adherent extends CommonObject public function __construct($db) { $this->db = $db; - $this->statut = -1; + $this->statut = self::STATUS_DRAFT; + $this->status = $this->statut; // l'adherent n'est pas public par defaut $this->public = 0; // les champs optionnels sont vides @@ -1854,7 +1854,7 @@ class Adherent extends CommonObject $now = dol_now(); // Check parameters - if ($this->statut == 1) { + if ($this->statut == self::STATUS_VALIDATED) { dol_syslog(get_class($this)."::validate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1862,7 +1862,7 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 1"; + $sql .= " statut = ".self::STATUS_VALIDATED; $sql .= ", datevalid = '".$this->db->idate($now)."'"; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; @@ -1870,7 +1870,7 @@ class Adherent extends CommonObject dol_syslog(get_class($this)."::validate", LOG_DEBUG); $result = $this->db->query($sql); if ($result) { - $this->statut = 1; + $this->statut = self::STATUS_VALIDATED; // Call trigger $result = $this->call_trigger('MEMBER_VALIDATE', $user); @@ -1906,7 +1906,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_RESILIATED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1914,13 +1914,13 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = 0"; + $sql .= " statut = ".self::STATUS_RESILIATED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_RESILIATED; // Call trigger $result = $this->call_trigger('MEMBER_RESILIATE', $user); @@ -1956,7 +1956,7 @@ class Adherent extends CommonObject $error = 0; // Check parameters - if ($this->statut == 0) { + if ($this->statut == self::STATUS_EXCLUDED) { dol_syslog(get_class($this)."::resiliate statut of member does not allow this", LOG_WARNING); return 0; } @@ -1964,13 +1964,13 @@ class Adherent extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."adherent SET"; - $sql .= " statut = -2"; + $sql .= " statut = ".self::STATUS_EXCLUDED; $sql .= ", fk_user_valid=".$user->id; $sql .= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); if ($result) { - $this->statut = 0; + $this->statut = self::STATUS_EXCLUDED; // Call trigger $result = $this->call_trigger('MEMBER_EXCLUDE', $user); @@ -2275,11 +2275,11 @@ class Adherent extends CommonObject $labelStatus = ''; $labelStatusShort = ''; - if ($status == -1) { + if ($status == self::STATUS_DRAFT) { $statusType = 'status0'; $labelStatus = $langs->trans("MemberStatusDraft"); $labelStatusShort = $langs->trans("MemberStatusDraftShort"); - } elseif ($status >= 1) { + } elseif ($status >= self::STATUS_VALIDATED) { if ($need_subscription == 0) { $statusType = 'status4'; $labelStatus = $langs->trans("MemberStatusNoSubscription"); @@ -2297,11 +2297,11 @@ class Adherent extends CommonObject $labelStatus = $langs->trans("MemberStatusPaid"); $labelStatusShort = $langs->trans("MemberStatusPaidShort"); } - } elseif ($status == 0) { + } elseif ($status == self::STATUS_RESILIATED) { $statusType = 'status6'; $labelStatus = $langs->trans("MemberStatusResiliated"); $labelStatusShort = $langs->trans("MemberStatusResiliatedShort"); - } elseif ($status == -2) { + } elseif ($status == self::STATUS_EXCLUDED) { $statusType = 'status10'; $labelStatus = $langs->trans("MemberStatusExcluded"); $labelStatusShort = $langs->trans("MemberStatusExcludedShort"); @@ -2367,11 +2367,11 @@ class Adherent extends CommonObject $sql .= ", ".MAIN_DB_PREFIX."adherent_type as t"; $sql .= " WHERE a.fk_adherent_type = t.rowid"; if ($mode == 'expired') { - $sql .= " AND a.statut = 1"; + $sql .= " AND a.statut = ".self::STATUS_VALIDATED; $sql .= " AND a.entity IN (".getEntity('adherent').")"; $sql .= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')"; } elseif ($mode == 'shift') { - $sql .= " AND a.statut = -1"; + $sql .= " AND a.statut = ".self::STATUS_DRAFT; $sql .= " AND a.entity IN (".getEntity('adherent').")"; } @@ -2388,10 +2388,10 @@ class Adherent extends CommonObject $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; $label = $langs->trans("MembersWithSubscriptionToReceive"); $labelShort = $langs->trans("MembersWithSubscriptionToReceiveShort"); - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=1&filter=outofdate'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_VALIDATED.'&filter=outofdate'; } elseif ($mode == 'shift') { $warning_delay = $conf->adherent->subscription->warning_delay / 60 / 60 / 24; - $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut=-1'; + $url = DOL_URL_ROOT.'/adherents/list.php?mainmenu=members&statut='.self::STATUS_DRAFT; $label = $langs->trans("MembersListToValid"); $labelShort = $langs->trans("ToValidate"); } @@ -2504,7 +2504,7 @@ class Adherent extends CommonObject $this->birth = $now; $this->photo = ''; $this->public = 1; - $this->statut = 0; + $this->statut = self::STATUS_DRAFT; $this->datefin = $now; $this->datevalid = $now; @@ -2823,7 +2823,7 @@ class Adherent extends CommonObject global $conf; //Only valid members - if ($this->statut <= 0) { + if ($this->statut != self::STATUS_VALIDATED) { return false; } if (!$this->datefin) { diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 00f05152a86..4b1e34335e8 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -359,16 +359,16 @@ if (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METE print '
'; print '
'; print img_weather($text, 0, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 1, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 2, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print img_weather($text, 3, $options); - print ' <=  %'; + print ' <=  %'; print '
'; print '
'; diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 704473ac597..f1b74146c5e 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -431,7 +431,9 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; print ''; - print ''; + print ''; + print '
'; + print ''; } else { print ''.$printer->listprinterstemplates[$line]['name'].''; print ''.dol_htmlentitiesbr($printer->listprinterstemplates[$line]['template']).''; @@ -459,18 +461,15 @@ if ($mode == 'template' && $user->admin) { print ''; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; - if ($action != 'edittemplate') { - print ''; - print '
'; - } else { - print '
'; - } print ''; print dol_get_fiche_end(); diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index e3521f1d0af..b1dd28956dc 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -394,18 +394,18 @@ print ''; print ''; print ''.$langs->trans("DoNotStoreClearPassword").''; print ''; -if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { +if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print img_picto($langs->trans("Active"), 'tick'); } print ''; -if (!$conf->global->DATABASE_PWD_ENCRYPTED) { +if (!getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print ''; print ''.$langs->trans("Activate").''; print ""; } // Database conf file encryption -if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { +if (getDolGlobalString('DATABASE_PWD_ENCRYPTED')) { print ''; if ($allow_disable_encryption) { //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes @@ -453,16 +453,16 @@ print ''; print ''; print ''.$langs->trans("DisableForgetPasswordLinkOnLogonPage").''; print ''; -if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print img_picto($langs->trans("Active"), 'tick'); } print ''; -if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (!getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print ''; print ''.$langs->trans("Activate").''; print ""; } -if (!empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK)) { +if (getDolGlobalString('MAIN_SECURITY_DISABLEFORGETPASSLINK')) { print ''; print ''.$langs->trans("Disable").''; print ""; @@ -481,8 +481,8 @@ if (GETPOST('info', 'int') > 0) { } else { print $langs->trans("Note: The function password_hash does not exists on your PHP")."
\n"; } - print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."
\n"; - print 'MAIN_SECURITY_SALT = '.$conf->global->MAIN_SECURITY_SALT."
\n"; + print 'MAIN_SECURITY_HASH_ALGO = '.getDolGlobalString('MAIN_SECURITY_HASH_ALGO')."
\n"; + print 'MAIN_SECURITY_SALT = '.getDolGlobalString('MAIN_SECURITY_SALT')."
\n"; } print ''; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index b4131a4bdde..9af09164469 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -139,8 +139,8 @@ if (preg_match('/[a-z]+/i', $version)) { } print ''."\n"; -print ''.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.$conf->global->MAIN_VERSION_LAST_UPGRADE.''."\n"; -print ''.$langs->trans("VersionLastInstall").''.$conf->global->MAIN_VERSION_LAST_INSTALL.''."\n"; +print ''.$langs->trans("VersionLastUpgrade").' ('.$langs->trans("Database").')'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').''."\n"; +print ''.$langs->trans("VersionLastInstall").''.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').''."\n"; print ''; print ''; print '
'; diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 51f3b4577cf..c11436a66d9 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -25,7 +25,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -if (!$user->admin) { +if (empty($user->admin)) { accessforbidden(); } @@ -164,17 +164,17 @@ foreach ($modules as $key => $module) { $newModule->permission = $permission; // pre-filter list - if ($search_name && !stristr($newModule->name, $search_name)) { + if (!empty($search_name) && !stristr($newModule->name, $search_name)) { continue; } - if ($search_version && !stristr($newModule->version, $search_version)) { + if (!empty($search_version) && !stristr($newModule->version, $search_version)) { continue; } - if ($search_id && !stristr($newModule->id, $search_id)) { + if (!empty($search_id) && !stristr($newModule->id, $search_id)) { continue; } - if ($search_permission) { + if (!empty($search_permission)) { $found = false; foreach ($newModule->permission as $permission) { @@ -211,7 +211,7 @@ print ''; print ''; print ''; -print_barre_liste($langs->trans("AvailableModules"), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $massactionbutton, -1, '', 'title_setup', 0, '', '', 0, 1, 1); +print_barre_liste($langs->trans("AvailableModules"), empty($page) ? 0 : $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', -1, '', 'title_setup', 0, '', '', 0, 1, 1); print ''.$langs->trans("ToActivateModule").''; print '
'; diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6cb40825ee7..c760903aca4 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -72,6 +72,7 @@ class DolibarrApi //$this->r->setSupportedFormats('jsonFormat'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Check and convert a string depending on its type/name. * @@ -82,8 +83,9 @@ class DolibarrApi * @param stdClass $object Object * @return string Value cleaned */ - protected function checkValForAPI($field, $value, $object) + protected function _checkValForAPI($field, $value, $object) { + // phpcs:enable // TODO Use type detected in $object->fields if (in_array($field, array('note', 'note_private', 'note_public', 'desc', 'description'))) { return checkVal($value, 'restricthtml'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index 68da91d6ce2..c2961db7bbb 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -217,7 +217,7 @@ class AgendaEvents extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } /*if (isset($request_data["lines"])) { $lines = array(); @@ -270,7 +270,7 @@ class AgendaEvents extends DolibarrApi continue; } - $this->actioncomm->$field = $this->checkValForAPI($field, $value, $this->actioncomm); + $this->actioncomm->$field = $this->_checkValForAPI($field, $value, $this->actioncomm); } if ($this->actioncomm->update(DolibarrApiAccess::$user, 1) > 0) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index d59983925ce..d971073a1d7 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Charlene Benke + * Copyright (C) 2021 Anthony Berton * * 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 @@ -274,12 +275,123 @@ if (empty($reshook)) { $objectclass = 'Commande'; $objectlabel = 'Orders'; $permissiontoread = $user->rights->commande->lire; + $permissiontoadd = $user->rights->commande->creer; $permissiontodelete = $user->rights->commande->supprimer; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $permissiontovalidate = $user->rights->commande->order_advance->validate; + $permissiontoclose = $user->rights->commande->order_advance->close; + $permissiontocancel = $user->rights->commande->order_advance->annuler; + $permissiontosendbymail = $user->rights->commande->order_advance->send; + } else { + $permissiontovalidate = $user->rights->commande->creer; + $permissiontoclose = $user->rights->commande->creer; + $permissiontocancel = $user->rights->commande->creer; + $permissiontosendbymail = $user->rights->commande->creer; + } $uploaddir = $conf->commande->multidir_output[$conf->entity]; $triggersendname = 'ORDER_SENTBYMAIL'; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } +if ($action == 'validate' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 0) { + if (!empty($objecttmp->fk_warehouse)) { + $idwarehouse = $objecttmp->fk_warehouse; + } else { + $idwarehouse = 0; + } + if ($objecttmp->valid($user, $idwarehouse)) { + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeValidated'), 'errors'); + $error++; + } + } else { + setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +if ($action == 'shipped' && $permissiontoadd) { + if (GETPOST('confirm') == 'yes') { + $objecttmp = new $objectclass($db); + $db->begin(); + $error = 0; + foreach ($toselect as $checked) { + if ($objecttmp->fetch($checked)) { + if ($objecttmp->statut == 1) { + if ($objecttmp->cloture($user)) { + setEventMessage($objecttmp->ref." ".$langs->trans('PassedInOpenStatus'), 'mesgs'); + } else { + setEventMessage($langs->trans('CantBeValidated'), 'errors'); + $error++; + } + } else { + setEventMessage($objecttmp->ref." ".$langs->trans('IsNotADraft'), 'errors'); + $error++; + } + } else { + dol_print_error($db); + $error++; + } + } + if ($error) { + $db->rollback(); + } else { + $db->commit(); + } + } +} +// Closed records +if (!$error && $massaction === 'setbilled' && $permissiontoclose) { + $db->begin(); + $objecttmp = new $objectclass($db); + $nbok = 0; + foreach ($toselect as $toselectid) { + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + $result = $objecttmp->classifyBilled($user, 0); + if ($result <= 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else { + $nbok++; + } + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error) { + if ($nbok > 1) { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } else { + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + } + $db->commit(); + } else { + $db->rollback(); + } +} /* * View @@ -700,16 +812,29 @@ if ($resql) { // List of mass actions available $arrayofmassactions = array( - 'generate_doc'=>$langs->trans("ReGeneratePDF"), - 'builddoc'=>$langs->trans("PDFMerge"), - 'cancelorders'=>$langs->trans("Cancel"), - 'presend'=>$langs->trans("SendByMail"), + 'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); - if ($user->rights->facture->creer) { - $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisCustomer"); + if ($permissiontovalidate) { + $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } - if ($user->rights->commande->supprimer) { - $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + } + if ($permissiontoclose) { + $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); + } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + } + if ($user->rights->facture->creer) { + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); + } + if ($permissiontoclose) { + $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); + } + if ($permissiontodelete) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); @@ -720,7 +845,7 @@ if ($resql) { if (!empty($socid)) { $url .= '&socid='.$socid; } - $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $user->rights->commande->creer); + $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $contextpage == 'orderlist' && $permissiontoadd); // Lines of title fields print '
'; @@ -744,6 +869,13 @@ if ($resql) { $trackid = 'ord'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + if ($massaction == 'prevalidate') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassValidation"), $langs->trans("ConfirmMassValidationQuestion"), "validate", null, '', 0, 200, 500, 1); + } + if ($massaction == 'preshipped') { + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("CloseOrder"), $langs->trans("ConfirmCloseOrder"), "shipped", null, '', 0, 200, 500, 1); + } + if ($massaction == 'createbills') { //var_dump($_REQUEST); print ''; @@ -1740,8 +1872,8 @@ if ($resql) { $urlsource .= str_replace('&', '&', $param); $filedir = $diroutputmassaction; - $genallowed = $user->rights->commande->lire; - $delallowed = $user->rights->commande->creer; + $genallowed = $permissiontoread; + $delallowed = $permissiontoadd; print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } else { diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 4afeac70124..762bcc506da 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -157,7 +157,7 @@ class BankAccounts extends DolibarrApi $account = new Account($this->db); foreach ($request_data as $field => $value) { - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } // Date of the initial balance (required to create an account). $account->date_solde = time(); @@ -332,7 +332,7 @@ class BankAccounts extends DolibarrApi if ($field == 'id') { continue; } - $account->$field = $this->checkValForAPI($field, $value, $account); + $account->$field = $this->_checkValForAPI($field, $value, $account); } if ($account->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 9fa4168ea0a..367ffffbdea 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -113,7 +113,7 @@ $sql .= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, f $sql .= " s.rowid as socid, s.nom as name, s.code_compta, s.client,"; $sql .= " p.rowid as pid, p.ref as pref,"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " pa.accountancy_code_sell,"; + $sql .= " ppe.accountancy_code_sell,"; } else { $sql .= " p.accountancy_code_sell,"; } @@ -121,7 +121,7 @@ $sql .= " ct.accountancy_code_sell as account_tva, ct.recuperableonly"; $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $sql .= " JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; $sql .= " JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ff35ece947b..daed5b19f5e 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -144,7 +144,7 @@ class Tva extends CommonObject $sql .= " '".$this->db->escape($this->note)."',"; $sql .= " '".$this->db->escape($this->fk_account)."',"; $sql .= " '".$this->db->escape($this->type_payment)."',"; - $sql .= " '".$this->db->escape($this->fk_user_creat)."',"; + $sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',"; $sql .= " '".$this->db->escape($this->fk_user_modif)."'"; $sql .= ")"; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 2d14e0e56fb..fba3e1004f4 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -341,7 +341,6 @@ $dolibarr_cron_allow_cli='0'; //$dolibarr_js_CKEDITOR='/javascript/ckeditor'; //$dolibarr_js_JQUERY='/javascript/jquery'; //$dolibarr_js_JQUERY_UI='/javascript/jquery-ui'; -//$dolibarr_js_JQUERY_FLOT='/javascript/flot'; // Value to overwrite some path to use font instead of embedded one //$dolibarr_font_DOL_DEFAULT_TTF="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"; //$dolibarr_font_DOL_DEFAULT_TTF_BOLD="/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf"; diff --git a/htdocs/core/boxes/box_birthdays_members.php b/htdocs/core/boxes/box_birthdays_members.php index 5445ad312fa..4d367a223e2 100644 --- a/htdocs/core/boxes/box_birthdays_members.php +++ b/htdocs/core/boxes/box_birthdays_members.php @@ -88,7 +88,7 @@ class box_birthdays_members extends ModeleBoxes $sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as u"; $sql .= " WHERE u.entity IN (".getEntity('adherent').")"; - $sql .= " AND u.statut = 1"; + $sql .= " AND u.statut = ".Adherent::STATUS_VALIDATED; $sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0); $sql .= " ORDER BY DAY(u.birth) ASC"; $sql .= $this->db->plimit($max, 0); diff --git a/htdocs/core/boxes/box_members_by_type.php b/htdocs/core/boxes/box_members_by_type.php index c961ffe3f4a..5b95b58d29d 100644 --- a/htdocs/core/boxes/box_members_by_type.php +++ b/htdocs/core/boxes/box_members_by_type.php @@ -129,16 +129,16 @@ class box_members_by_type extends ModeleBoxes $adhtype->label = $objp->label; $AdherentType[$objp->rowid] = $adhtype; - if ($objp->statut == -1) { + if ($objp->statut == Adherent::STATUS_DRAFT) { $MembersToValidate[$objp->rowid] = $objp->somme; } - if ($objp->statut == 1) { + if ($objp->statut == Adherent::STATUS_VALIDATED) { $MembersValidated[$objp->rowid] = $objp->somme; } - if ($objp->statut == -2) { + if ($objp->statut == Adherent::STATUS_EXCLUDED) { $MembersExcluded[$objp->rowid] = $objp->somme; } - if ($objp->statut == 0) { + if ($objp->statut == Adherent::STATUS_RESILIATED) { $MembersResiliated[$objp->rowid] = $objp->somme; } @@ -210,27 +210,27 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(-1, 1, 0, 3), + 'text' => (isset($MembersToValidate[$key]) && $MembersToValidate[$key] > 0 ? $MembersToValidate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(1, 1, 0, 3), + 'text' => (isset($MembersValidated[$key]) && ($MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) > 0) ? $MembersValidated[$key] - (isset($MembersUpToDate[$key]) ? $MembersUpToDate[$key] : 0) : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(1, 1, $now, 3), + 'text' => (isset($MembersUpToDate[$key]) && $MembersUpToDate[$key] > 0 ? $MembersUpToDate[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(-2, 1, $now, 3), + 'text' => (isset($MembersExcluded[$key]) && $MembersExcluded[$key] > 0 ? $MembersExcluded[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, $now, 3), 'asis' => 1, ); $this->info_box_contents[$line][] = array( 'td' => 'class="right"', - 'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(0, 1, 0, 3), + 'text' => (isset($MembersResiliated[$key]) && $MembersResiliated[$key] > 0 ? $MembersResiliated[$key] : '') . ' ' . $staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), 'asis' => 1, ); @@ -249,27 +249,27 @@ class box_members_by_type extends ModeleBoxes ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumToValidate.' '.$staticmember->LibStatut(-1, 1, 0, 3), + 'text' => $SumToValidate.' '.$staticmember->LibStatut(Adherent::STATUS_DRAFT, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumValidated.' '.$staticmember->LibStatut(1, 1, 0, 3), + 'text' => $SumValidated.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumUpToDate.' '.$staticmember->LibStatut(1, 1, $now, 3), + 'text' => $SumUpToDate.' '.$staticmember->LibStatut(Adherent::STATUS_VALIDATED, 1, $now, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumExcluded.' '.$staticmember->LibStatut(-2, 1, 0, 3), + 'text' => $SumExcluded.' '.$staticmember->LibStatut(Adherent::STATUS_EXCLUDED, 1, 0, 3), 'asis' => 1 ); $this->info_box_contents[$line][] = array( 'td' => 'class="liste_total right"', - 'text' => $SumResiliated.' '.$staticmember->LibStatut(0, 1, 0, 3), + 'text' => $SumResiliated.' '.$staticmember->LibStatut(Adherent::STATUS_RESILIATED, 1, 0, 3), 'asis' => 1 ); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d4b94deba51..c996640bc2c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2197,8 +2197,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if ($tzoutput == 'tzserver') { $to_gmt = false; $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' - $offsettz = 0; - $offsetdst = 0; + $offsettz = 0; // Timezone offset with server timezone, so 0 + $offsetdst = 0; // Dst offset with server timezone, so 0 } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { $to_gmt = true; $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' @@ -2308,7 +2308,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = if ($time < 100000000000) { // Protection against bad date values $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $ret = adodb_strftime($format, $timetouse, $to_gmt); + $ret = adodb_strftime($format, $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server } else { $ret = 'Bad value '.$time.' for date'; } @@ -2318,7 +2318,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. // Here ret is string in PHP setup language (strftime was used). Now we convert to $outputlangs. - $month = adodb_strftime('%m', $timetouse, true); + $month = adodb_strftime('%m', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. if ($encodetooutput) { $monthtext = $outputlangs->transnoentities('Month'.$month); @@ -2334,9 +2334,10 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = //return $ret; } if (preg_match('/__a__/i', $format)) { + //print "time=$time offsettz=$offsettz offsetdst=$offsetdst offsettzstring=$offsettzstring"; $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. - $w = adodb_strftime('%w', $timetouse, true); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. + $w = adodb_strftime('%w', $timetouse, $to_gmt); // If to_gmt = false then adodb_strftime use TZ of server $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); $ret = str_replace('__A__', $dayweek, $ret); $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); @@ -3525,7 +3526,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_globe', 'object_holiday', 'object_hrm', 'object_invoice', 'object_intervention', 'object_inventory', 'object_intracommreport', 'object_label', 'object_margin', 'object_members', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_other', - 'object_payment', 'object_pdf', 'object_product', 'object_propal', + 'object_partnership', 'object_payment', 'object_pdf', 'object_product', 'object_propal', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_reception', 'object_recruitmentjobposition', 'object_recruitmentcandidature', 'object_salary', 'object_shipment', 'object_share-alt', 'object_supplier_invoice', 'object_supplier_invoicea', 'object_supplier_invoiced', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', @@ -3537,7 +3538,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', - 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', + 'partnership', 'payment', 'pencil-ruler', 'preview', 'project', 'projectpub', 'projecttask', 'refresh', 'salary', 'shipment', 'supplier_invoice', 'technic', 'ticket', 'error', 'warning', 'recruitmentcandidature', 'recruitmentjobposition', 'resource', 'shapes', 'supplier_proposal', 'supplier_order', 'supplier_invoice', @@ -3581,7 +3582,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'pdf'=>'file-pdf', 'poll'=>'check-double', 'pos'=>'cash-register', 'preview'=>'binoculars', 'project'=>'project-diagram', 'projectpub'=>'project-diagram', 'projecttask'=>'tasks', 'propal'=>'file-signature', - 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', + 'partnership'=>'handshake', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'refresh'=>'redo', 'resource'=>'laptop-house', @@ -3627,7 +3628,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (in_array($pictowithouttext, array('conferenceorbooth', 'collab', 'eventorganization', 'holiday', 'project', 'workstation'))) { $morecss = 'em088'; } - if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'stock', 'technic'))) { + if (in_array($pictowithouttext, array('intervention', 'info', 'payment', 'loan', 'partnership', 'stock', 'technic'))) { $morecss = 'em080'; } @@ -3679,7 +3680,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'dolly'=>'#a69944', 'dollyrevert'=>'#a69944', 'lot'=>'#a69944', 'map-marker-alt'=>'#aaa', 'mrp'=>'#a69944', 'product'=>'#a69944', 'service'=>'#a69944', 'inventory'=>'#a69944', 'stock'=>'#a69944', 'movement'=>'#a69944', 'other'=>'#ddd', - 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', + 'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', 'shipment'=>'#a69944', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'website'=>'#304', 'workstation'=>'#a69944' @@ -9716,7 +9717,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = $tag = !empty($attr['href']) ? 'a' : 'span'; - return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; + return '<'.$tag.' '.$compiledAttributes.'>'.$html.''; } /** diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index db1623387c1..d983f0298ce 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -44,7 +44,7 @@ function takepos_admin_prepare_head() $h++; $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; - $head[$h][1] = $langs->trans("Receipt"); + $head[$h][1] = $langs->trans("Printers").' / '.$langs->trans("Receipt"); $head[$h][2] = 'receipt'; $h++; @@ -62,7 +62,7 @@ function takepos_admin_prepare_head() } $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/other.php'; - $head[$h][1] = $langs->trans("Other"); + $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'other'; $h++; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 333ef747cf2..dccf36b8137 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -121,7 +121,7 @@ class modFacture extends DolibarrModules $datestart = dol_mktime(23, 0, 0, $arraydate['mon'], $arraydate['mday'], $arraydate['year']); $this->cronjobs = array( 0=>array('label'=>'RecurringInvoices', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture-rec.class.php', 'objectname'=>'FactureRec', 'method'=>'createRecurringInvoices', 'parameters'=>'', 'comment'=>'Generate recurring invoices', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>1, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), - 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), + 1=>array('label'=>'SendEmailsRemindersOnInvoiceDueDate', 'jobtype'=>'method', 'class'=>'compta/facture/class/facture.class.php', 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days. First param is the offset n of days, second parameter is "all" or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, 'status'=>0, 'test'=>'$conf->facture->enabled', 'datestart'=>$datestart), ); // Permissions @@ -208,7 +208,7 @@ class modFacture extends DolibarrModules //-------- $r = 1; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'invoice'; @@ -297,7 +297,7 @@ class modFacture extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet_extrafields as extra2 on fd.rowid = extra2.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra3 on p.rowid = extra3.fk_object'; $this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture'; diff --git a/htdocs/core/modules/modPartnership.class.php b/htdocs/core/modules/modPartnership.class.php index 17c137a7e3c..1165461368b 100644 --- a/htdocs/core/modules/modPartnership.class.php +++ b/htdocs/core/modules/modPartnership.class.php @@ -86,7 +86,7 @@ class modPartnership extends DolibarrModules // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // To use a supported fa-xxx css style of font awesome, use this->picto='xxx' - $this->picto = 'generic'; + $this->picto = 'partnership'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( @@ -144,7 +144,7 @@ class modPartnership extends DolibarrModules $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) // The language file dedicated to your module - $this->langfiles = array("partnership@partnership"); + $this->langfiles = array("partnership"); // Prerequisites $this->phpmin = array(5, 6); // Minimum version of PHP required by module diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index e9dc9688217..3459973a699 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -176,7 +176,7 @@ class modProduct extends DolibarrModules //-------- $r = 0; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; @@ -296,7 +296,7 @@ class modProduct extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; @@ -447,7 +447,7 @@ class modProduct extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON p.rowid = extra.fk_object,'; $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'product_association as pa, '.MAIN_DB_PREFIX.'product as p2'; diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index fd019ca4c68..21a26bdc750 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -143,7 +143,7 @@ class modService extends DolibarrModules //-------- $r = 0; - $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; + $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; $r++; $this->export_code[$r] = $this->rights_class.'_'.$r; @@ -259,7 +259,7 @@ class modService extends DolibarrModules $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $this->export_sql_end[$r] .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (!empty($conf->global->EXPORTTOOL_CATEGORIES)) { $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product = p.rowid LEFT JOIN '.MAIN_DB_PREFIX.'categorie as cat ON cp.fk_categorie = cat.rowid'; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index adb38aa9279..592c3283a1b 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -87,10 +87,29 @@ if ($module == 'ecm') { print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site - print 'ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; + print 'ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); print ''; } +if ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm + print ''; + print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); + print ''; +} +print ""; // Start "Add new file" area $nameforformuserfile = 'formuserfileecm'; @@ -139,22 +158,30 @@ if ($action == 'delete_section') { // End confirm if ($action == 'confirmconvertimgwebp') { - print $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref, $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', '', "yes", 1); + $section_dir=GETPOST('section_dir', 'alpha'); + $section=GETPOST('section', 'alpha'); + $form = new Form($db); + $formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); + $formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); + if ($module == 'medias') { + $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); + } + print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } if ($action == 'convertimgwebp' && $permtoadd) { if ($module == 'medias') { - $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/image/'.$websitekey.'/'; + $imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizeFileName(GETPOST('section_dir', 'alpha')); } else { - $imagefolder = $conf->ecm->dir_output; + $imagefolder = $conf->ecm->dir_output.'/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha')); } include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; $regeximgext = getListOfPossibleImageExt(); - $filelist = dol_dir_list($imagefolder, "all", 1, $regeximgext); + $filelist = dol_dir_list($imagefolder, "all", 0, $regeximgext); foreach ($filelist as $filename) { $filepath = $filename['fullname']; diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 18c27a8e36e..7d315f142a7 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -34,6 +34,7 @@ class InterfaceNotification extends DolibarrTriggers public $listofmanagedevents = array( 'BILL_VALIDATE', 'BILL_PAYED', + 'ORDER_CREATE', 'ORDER_VALIDATE', 'PROPAL_VALIDATE', 'PROPAL_CLOSE_SIGNED', diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql index 97fca0f230b..65b3af4950e 100644 --- a/htdocs/install/mysql/data/llx_10_c_regions.sql +++ b/htdocs/install/mysql/data/llx_10_c_regions.sql @@ -61,6 +61,7 @@ -- Brazil -> for Departmements -- Canada -> for Departmements -- Chile +-- China -- Colombie -> for Departmements -- Denmark -- France @@ -84,6 +85,7 @@ -- Slovenia -- Spain -- Switzerland/Suisse -> for Departmements/Cantons +-- Taiwan -> for Departmements -- Tunesia -- United Arab Emirates -> for Departmements -- United Kingdom @@ -93,7 +95,7 @@ -- TEMPLATE ------------------------------------------------------------------------------------------ -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 0, 0, '0', 0, '-'); -- Algeria Regions (id country=13) @@ -172,6 +174,43 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 67, 6715, NULL, NULL, 'Arica y Parinacota'); +-- China Regions (rowid country=9) +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 901, '京',0,'北京市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 902, '津',0,'天津市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 903, '沪',0,'上海市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 904, '渝',0,'重庆市'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 905, '冀',0,'河北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 906, '晋',0,'山西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 907, '辽',0,'辽宁省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 908, '吉',0,'吉林省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 909, '黑',0,'黑龙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 910, '苏',0,'江苏省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 911, '浙',0,'浙江省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 912, '皖',0,'安徽省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 913, '闽',0,'福建省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 914, '赣',0,'江西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 915, '鲁',0,'山东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 916, '豫',0,'河南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 917, '鄂',0,'湖北省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 918, '湘',0,'湖南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 919, '粤',0,'广东省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 920, '琼',0,'海南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 921, '川',0,'四川省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 922, '贵',0,'贵州省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 923, '云',0,'云南省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 924, '陕',0,'陕西省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 925, '甘',0,'甘肃省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 926, '青',0,'青海省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 927, '台',0,'台湾省'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 928, '蒙',0,'内蒙古自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 929, '桂',0,'广西壮族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 930, '藏',0,'西藏自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 931, '宁',0,'宁夏回族自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 932, '新',0,'新疆维吾尔自治区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 933, '港',0,'香港特别行政区'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9, 934, '澳',0,'澳门特别行政区'); + + -- Colombie Regions (id country=70) INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie'); @@ -399,31 +438,35 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 4 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 6, 601, '', 1, 'Cantons'); +-- Taiwan Regions (rowid country=213) +INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 213, 21301, 'TW', NULL, 'Taiwan'); + + -- Tunisia Regions (id country=10) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1001, '', 0, 'Ariana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1002, '', 0, 'Béja'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1003, '', 0, 'Ben Arous'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1004, '', 0, 'Bizerte'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1005, '', 0, 'Gabès'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1006, '', 0, 'Gafsa'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1007, '', 0, 'Jendouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1008, '', 0, 'Kairouan'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1009, '', 0, 'Kasserine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1010, '', 0, 'Kébili'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1011, '', 0, 'La Manouba'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1012, '', 0, 'Le Kef'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1013, '', 0, 'Mahdia'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1014, '', 0, 'Médenine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1015, '', 0, 'Monastir'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1016, '', 0, 'Nabeul'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1017, '', 0, 'Sfax'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1018, '', 0, 'Sidi Bouzid'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1019, '', 0, 'Siliana'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1020, '', 0, 'Sousse'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1021, '', 0, 'Tataouine'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1022, '', 0, 'Tozeur'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1023, '', 0, 'Tunis'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (10, 1024, '', 0, 'Zaghouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1001, '', 0, 'Ariana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1002, '', 0, 'Béja'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1003, '', 0, 'Ben Arous'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1004, '', 0, 'Bizerte'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1005, '', 0, 'Gabès'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1006, '', 0, 'Gafsa'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1007, '', 0, 'Jendouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1008, '', 0, 'Kairouan'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1009, '', 0, 'Kasserine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1010, '', 0, 'Kébili'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1011, '', 0, 'La Manouba'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1012, '', 0, 'Le Kef'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1013, '', 0, 'Mahdia'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1014, '', 0, 'Médenine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1015, '', 0, 'Monastir'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1016, '', 0, 'Nabeul'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1017, '', 0, 'Sfax'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1018, '', 0, 'Sidi Bouzid'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1019, '', 0, 'Siliana'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1020, '', 0, 'Sousse'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1021, '', 0, 'Tataouine'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1022, '', 0, 'Tozeur'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1023, '', 0, 'Tunis'); +insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 10, 1024, '', 0, 'Zaghouan'); -- United Arab Emirates (UAE) Regions (rowid country=227) @@ -452,46 +495,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2 INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental'); INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana'); - - - --- Regions China (rowid country=9) -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 901, '京',0,'北京市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 902, '津',0,'天津市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 903, '沪',0,'上海市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 904, '渝',0,'重庆市'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 905, '冀',0,'河北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 906, '晋',0,'山西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 907, '辽',0,'辽宁省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 908, '吉',0,'吉林省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 909, '黑',0,'黑龙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 910, '苏',0,'江苏省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 911, '浙',0,'浙江省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 912, '皖',0,'安徽省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 913, '闽',0,'福建省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 914, '赣',0,'江西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 915, '鲁',0,'山东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 916, '豫',0,'河南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 917, '鄂',0,'湖北省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 918, '湘',0,'湖南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 919, '粤',0,'广东省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 920, '琼',0,'海南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 921, '川',0,'四川省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 922, '贵',0,'贵州省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 923, '云',0,'云南省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 924, '陕',0,'陕西省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 925, '甘',0,'甘肃省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 926, '青',0,'青海省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 927, '台',0,'台湾省'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 928, '蒙',0,'内蒙古自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 929, '桂',0,'广西壮族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 930, '藏',0,'西藏自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 931, '宁',0,'宁夏回族自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 932, '新',0,'新疆维吾尔自治区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 933, '港',0,'香港特别行政区'); -insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values (9, 934, '澳',0,'澳门特别行政区'); - - --- Regions Taiwan (rowid country=213) -INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (213, 21301, 'TW', NULL, 'Taiwan'); - diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index e1e363e9c62..96431caf5b1 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -55,7 +55,10 @@ -- Luxembourg -- Netherlands -- (Moroco) +-- Panama -- Romania +-- Slovenia (need to check code SI-Id) +-- Taiwan -- Tunisia @@ -759,6 +762,19 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('MA19B', 1214, '', 0, '', 'Province de Tan-Tan', 1); +-- Panama - 10 Provinces (id country=178) +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-1', '', 0, '', 'Bocas del Toro'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-2', '', 0, '', 'Coclé'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-3', '', 0, '', 'Colón'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-4', '', 0, '', 'Chiriquí'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-5', '', 0, '', 'Darién'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-6', '', 0, '', 'Herrera'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-7', '', 0, '', 'Los Santos'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-8', '', 0, '', 'Panamá'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-9', '', 0, '', 'Veraguas'); +INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom) VALUES (17801, 'PA-13', '', 0, '', 'Panamá Oeste'); + + -- Romania Provinces (id country=188) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AB', '', 0, '', 'Alba'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'AR', '', 0, '', 'Arad'); @@ -804,6 +820,55 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'VN', '', 0, '', 'Vrancea'); +-- Slovenia Provinces (rowid country=202) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI031', NULL, NULL, 'MURA', 'Mura'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI032', NULL, NULL, 'DRAVA', 'Drava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20203, 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (20204, 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); + + +-- Taiwan Divisions / Provinces / Counties (rowid country=886) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); + + -- Tunisia Governorates / Provinces / Wilaya (id country=10) INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN01', '', 0, '', 'Ariana'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN02', '', 0, '', 'Béja'); @@ -1628,17 +1693,6 @@ INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, nc INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2503', 18126, '', 0, '', 'Padre Abad', 1); INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('2504', 18126, '', 0, '', 'Purús', 1); --- Provinces Panama (id country=178) -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-1', 17801, '', 0, '', 'Bocas del Toro', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-2', 17801, '', 0, '', 'Coclé', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-3', 17801, '', 0, '', 'Colón', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-4', 17801, '', 0, '', 'Chiriquí', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-5', 17801, '', 0, '', 'Darién', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-6', 17801, '', 0, '', 'Herrera', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-7', 17801, '', 0, '', 'Los Santos', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-8', 17801, '', 0, '', 'Panamá', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-9', 17801, '', 0, '', 'Veraguas', 1); -INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('PA-13', 17801, '', 0, '', 'Panamá Oeste', 1); -- Provinces United Arab Emirates (id country=227) INSERT INTO llx_c_departements (code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES ('AE-1', 22701, '', 0, '', 'Abu Dhabi', 1); @@ -1673,52 +1727,3 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VR', NULL, NULL, 'VILA REAL', 'Vila Real'); INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('15001', 'PT-VI', NULL, NULL, 'VISEU', 'Viseu'); --- Provinces Slovenia (rowid country=202) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI031', NULL, NULL, 'MURA', 'Mura'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI032', NULL, NULL, 'DRAVA', 'Drava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI033', NULL, NULL, 'CARINTHIA', 'Carinthia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI034', NULL, NULL, 'SAVINJA', 'Savinja'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI035', NULL, NULL, 'CENTRAL SAVA', 'Central Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI036', NULL, NULL, 'LOWER SAVA', 'Lower Sava'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI037', NULL, NULL, 'SOUTHEAST SLOVENIA', 'Southeast Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20203', 'SI038', NULL, NULL, 'LITTORAL–INNER CARNIOLA', 'Littoral–Inner Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI041', NULL, NULL, 'CENTRAL SLOVENIA', 'Central Slovenia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst'); - - --- Provinces Taiwan (rowid country=886) -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KLU', 'KLU', NULL, '基隆市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPE', 'TPE', NULL, '臺北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TPH', 'TPH', NULL, '新北市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TYC', 'TYC', NULL, '桃園市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSH', 'HSH', NULL, '新竹縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HSC', 'HSC', NULL, '新竹市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAL', 'MAL', NULL, '苗栗縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-MAC', 'MAC', NULL, '苗栗市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TXG', 'TXG', NULL, '臺中市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWH', 'CWH', NULL, '彰化縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CWS', 'CWS', NULL, '彰化市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTC', 'NTC', NULL, '南投市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-NTO', 'NTO', NULL, '南投縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-YLH', 'YLH', NULL, '雲林縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CHY', 'CHY', NULL, '嘉義縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-CYI', 'CYI', NULL, '嘉義市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TNN', 'TNN', NULL, '臺南市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KHH', 'KHH', NULL, '高雄市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-IUH', 'IUH', NULL, '屏東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PTS', 'PTS', NULL, '屏東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILN', 'ILN', NULL, '宜蘭縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-ILC', 'ILC', NULL, '宜蘭市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWA', 'HWA', NULL, '花蓮縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-HWC', 'HWC', NULL, '花蓮市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTC', 'TTC', NULL, '臺東市'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-TTT', 'TTT', NULL, '臺東縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-PEH', 'PEH', NULL, '澎湖縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-GNI', 'GNI', NULL, '綠島'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KYD', 'KYD', NULL, '蘭嶼'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-KMN', 'KMN', NULL, '金門縣'); -INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, nom) VALUES (21301, 'TW-LNN', 'LNN', NULL, '連江縣'); - - diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 10822a8ec2a..48095160c69 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -259,7 +259,7 @@ create table llx_salary rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) label varchar(255), - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/mysql/tables/llx_salary.sql b/htdocs/install/mysql/tables/llx_salary.sql index af4b869d9bf..b68ac1e7a1e 100644 --- a/htdocs/install/mysql/tables/llx_salary.sql +++ b/htdocs/install/mysql/tables/llx_salary.sql @@ -21,7 +21,7 @@ create table llx_salary ( rowid integer AUTO_INCREMENT PRIMARY KEY, ref varchar(30) NULL, -- payment reference number (currently NULL because there is no numbering manager yet) - tms timestamp, + tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, datec datetime, -- Create date fk_user integer NOT NULL, datep date, -- payment date diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 17339c1f605..d73678bcbab 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -169,6 +169,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitm CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentjobposition_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_recruitment_recruitmentcandidature_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_salary FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_address FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_societe_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 4bcf8439271..47bf937a90e 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -41,7 +41,8 @@ Floor=Floor AddTable=Add table Place=Place TakeposConnectorNecesary='TakePOS Connector' required -OrderPrinters=Order printers +OrderPrinters=Add a button to send the order to some given printers, without payment (for example to send an order to a kitchen) +NotAvailableWithBrowserPrinter=Not available when printer for receipt is set to browser: SearchProduct=Search product Receipt=Receipt Header=Header @@ -58,7 +59,7 @@ BillsCoinsPad=Coins and banknotes Pad DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr TakeposNeedsCategories=TakePOS needs at least one product categorie to work TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category %s to work -OrderNotes=Printing the receipt will set all items to 'Order confirmed' +OrderNotes=Can add some notes to each ordered items CashDeskBankAccountFor=Default account to use for payments in NoPaimementModesDefined=No paiment mode defined in TakePOS configuration TicketVatGrouped=Group VAT by rate in tickets|receipts @@ -83,7 +84,7 @@ InvoiceIsAlreadyValidated=Invoice is already validated NoLinesToBill=No lines to bill CustomReceipt=Custom Receipt ReceiptName=Receipt Name -ProductSupplements=Product Supplements +ProductSupplements=Manage supplements of products SupplementCategory=Supplement category ColorTheme=Color theme Colorful=Colorful @@ -93,7 +94,7 @@ Browser=Browser BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. TakeposConnectorMethodDescription=External module with extra features. Posibility to print from the cloud. PrintMethod=Print method -ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. +ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. The server hosting the application can't be in the Cloud (must be able to reach the printers in your network). ByTerminal=By terminal TakeposNumpadUsePaymentIcon=Use icon instead of text on payment buttons of numpad CashDeskRefNumberingModules=Numbering module for POS sales diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 63b3bec0bb6..7681449755e 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -51,4 +51,6 @@ DatePartnershipEnd=End date PartnershipDraft = Draft PartnershipAccepted = Accepted PartnershipRefused = Refused -PartnershipCanceled = Canceled \ No newline at end of file +PartnershipCanceled = Canceled + +PartnershipManagedFor=Partners are \ No newline at end of file diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index e4b5fcca219..769c1529aff 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -213,7 +213,7 @@ class MyModuleApi extends DolibarrApi $result = $this->_validate($request_data); foreach ($request_data as $field => $value) { - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data @@ -255,7 +255,7 @@ class MyModuleApi extends DolibarrApi if ($field == 'id') { continue; } - $this->myobject->$field = $this->checkValForAPI($field, $value, $this->myobject); + $this->myobject->$field = $this->_checkValForAPI($field, $value, $this->myobject); } // Clean data diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index fe4cd496df0..7de7d8d9c5c 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -492,10 +492,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Back to draft if ($object->status == $object::STATUS_VALIDATED) { - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); } - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Validate if ($object->status == $object::STATUS_DRAFT) { @@ -509,7 +509,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=scrumsprint', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken(), '', $permissiontoadd); /* if ($permissiontoadd) { @@ -529,7 +529,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea */ // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print ''."\n"; } diff --git a/htdocs/partnership/README.md b/htdocs/partnership/README.md deleted file mode 100644 index ca8d9f7b551..00000000000 --- a/htdocs/partnership/README.md +++ /dev/null @@ -1,86 +0,0 @@ -# PARTNERSHIP FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) - -## Features - -Description of the module... - - - -Other external modules are available on [Dolistore.com](https://www.dolistore.com). - -## Translations - -Translations can be completed manually by editing files into directories *langs*. - - - - - -## Licenses - -### Main code - -GPLv3 or (at your option) any later version. See file COPYING for more information. - -### Documentation - -All texts and readmes are licensed under GFDL. diff --git a/htdocs/partnership/admin/about.php b/htdocs/partnership/admin/about.php deleted file mode 100644 index 2d5f17b1877..00000000000 --- a/htdocs/partnership/admin/about.php +++ /dev/null @@ -1,103 +0,0 @@ - - * Copyright (C) 2021 Dorian Laurent - * - * 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 partnership/admin/about.php - * \ingroup partnership - * \brief About page of module Partnership. - */ - -// Load Dolibarr environment -$res = 0; -// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { - $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; -} -// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME -$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { - $i--; $j--; -} -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { - $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -} -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { - $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; -} -// Try main.inc.php using relative path -if (!$res && file_exists("../../main.inc.php")) { - $res = @include "../../main.inc.php"; -} -if (!$res && file_exists("../../../main.inc.php")) { - $res = @include "../../../main.inc.php"; -} -if (!$res) { - die("Include of main fails"); -} - -// Libraries -require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once '../lib/partnership.lib.php'; - -// Translations -$langs->loadLangs(array("errors", "admin", "partnership@partnership")); - -// Access control -if (!$user->admin) { - accessforbidden(); -} - -// Parameters -$action = GETPOST('action', 'aZ09'); -$backtopage = GETPOST('backtopage', 'alpha'); - - -/* - * Actions - */ - -// None - - -/* - * View - */ - -$form = new Form($db); - -$page_name = "PartnershipAbout"; -llxHeader('', $langs->trans($page_name)); - -// Subheader -$linkback = ''.$langs->trans("BackToModuleList").''; - -print load_fiche_titre($langs->trans($page_name), $linkback, 'object_partnership@partnership'); - -// Configuration header -$head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'about', '', 0, 'partnership@partnership'); - -dol_include_once('/partnership/core/modules/modPartnership.class.php'); -$tmpmodule = new modPartnership($db); -print $tmpmodule->getDescLong(); - -// Page end -print dol_get_fiche_end(); -llxFooter(); -$db->close(); diff --git a/htdocs/partnership/admin/partnership_extrafields.php b/htdocs/partnership/admin/partnership_extrafields.php index a69ec9d1372..a7f8bd9409e 100644 --- a/htdocs/partnership/admin/partnership_extrafields.php +++ b/htdocs/partnership/admin/partnership_extrafields.php @@ -58,7 +58,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once '../lib/partnership.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('partnership@partnership', 'admin')); +$langs->loadLangs(array('partnership', 'admin')); $extrafields = new ExtraFields($db); $form = new Form($db); @@ -91,17 +91,18 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; * View */ +$help_url = ''; llxHeader('', $langs->trans("PartnershipSetup"), $help_url); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'title_setup'); +print load_fiche_titre($langs->trans("PartnershipSetup"), $linkback, 'object_partnership'); $head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, 'account'); +print dol_get_fiche_head($head, 'partnership_extrafields', $langs->trans("PartnershipExtraFields"), -1, ''); require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php'; diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index d55daab2347..7894b24b5bb 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -58,7 +58,7 @@ require_once '../lib/partnership.lib.php'; //require_once "../class/myclass.class.php"; // Translations -$langs->loadLangs(array("admin", "partnership@partnership")); +$langs->loadLangs(array("admin", "partnership")); // Security check if (!$user->admin) { @@ -71,6 +71,7 @@ $value = GETPOST('value', 'alpha'); $error = 0; + /* * Actions */ @@ -91,10 +92,10 @@ if ($action == 'setting') { $partnership->tabs = array(); if ($modulemenu == 'member') { - $partnership->tabs[] = array('data'=>'member:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); + $partnership->tabs[] = array('data'=>'member:+partnership:Partnership:partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); $fk_mainmenu = "members"; } else { - $partnership->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership@partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); + $partnership->tabs[] = array('data'=>'thirdparty:+partnership:Partnership:partnership:$user->rights->partnership->read:/partnership/partnership.php?socid=__ID__'); $fk_mainmenu = "companies"; } @@ -131,10 +132,10 @@ $tab = $langs->trans("PartnershipSetup"); llxHeader('', $title); $linkback = ''.$langs->trans("BackToModuleList").''; -print load_fiche_titre($title, $linkback, 'title_setup'); +print load_fiche_titre($title, $linkback, 'object_partnership'); $head = partnershipAdminPrepareHead(); -print dol_get_fiche_head($head, 'settings', $tab, -1, 'partnership'); +print dol_get_fiche_head($head, 'settings', $tab, -1, ''); $form = new Form($db); diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 019d72a6012..4be5256062b 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -61,7 +61,7 @@ class Partnership extends CommonObject /** * @var string String with name of icon for partnership. Must be the part after the 'object_' into object_partnership.png */ - public $picto = 'partnership@partnership'; + public $picto = 'partnership'; const STATUS_DRAFT = 0; @@ -113,7 +113,7 @@ class Partnership extends CommonObject 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Accepté', '2'=>'Refusé', '9'=>'Annulé'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>4, 'default'=>0, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'Refused', '9'=>'Canceled'),), 'fk_member' => array('type'=>'integer:Adherent:adherents/class/adherent.class.php:1', 'label'=>'Member', 'enabled'=>'1', 'position'=>51, 'notnull'=>-1, 'visible'=>1, 'index'=>1,), 'date_partnership_start' => array('type'=>'datetime', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,), 'date_partnership_end' => array('type'=>'datetime', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>1, 'visible'=>1,), @@ -969,7 +969,7 @@ class Partnership extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - //$langs->load("partnership@partnership"); + //$langs->load("partnership"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); $this->labelStatus[self::STATUS_ACCEPTED] = $langs->trans('Accepted'); $this->labelStatus[self::STATUS_REFUSED] = $langs->trans('Refused'); @@ -1076,7 +1076,7 @@ class Partnership extends CommonObject public function getNextNumRef() { global $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); if (empty($conf->global->PARTNERSHIP_ADDON)) { $conf->global->PARTNERSHIP_ADDON = 'mod_partnership_standard'; @@ -1141,7 +1141,7 @@ class Partnership extends CommonObject $result = 0; $includedocgeneration = 0; - $langs->load("partnership@partnership"); + $langs->load("partnership"); if (!dol_strlen($modele)) { $modele = 'standard_partnership'; diff --git a/htdocs/partnership/core/modules/partnership/modules_partnership.php b/htdocs/partnership/core/modules/partnership/modules_partnership.php index aea00b41415..005d77835b6 100644 --- a/htdocs/partnership/core/modules/partnership/modules_partnership.php +++ b/htdocs/partnership/core/modules/partnership/modules_partnership.php @@ -91,7 +91,7 @@ abstract class ModeleNumRefPartnership public function info() { global $langs; - $langs->load("partnership@partnership"); + $langs->load("partnership"); return $langs->trans("NoDescription"); } @@ -103,7 +103,7 @@ abstract class ModeleNumRefPartnership public function getExample() { global $langs; - $langs->load("partnership@partnership"); + $langs->load("partnership"); return $langs->trans("NoExample"); } diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index 0cb4f1d0ea1..5305f86132e 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -30,7 +30,7 @@ function partnershipAdminPrepareHead() { global $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); $h = 0; $head = array(); @@ -46,11 +46,12 @@ function partnershipAdminPrepareHead() $head[$h][2] = 'partnership_extrafields'; $h++; - + /* $head[$h][0] = dol_buildpath("/partnership/admin/about.php", 1); $head[$h][1] = $langs->trans("About"); $head[$h][2] = 'about'; $h++; + */ // Show more tabs from modules // Entries must be declared in modules descriptor with line @@ -75,7 +76,7 @@ function partnershipPrepareHead($object) { global $db, $langs, $conf; - $langs->load("partnership@partnership"); + $langs->load("partnership"); $h = 0; $head = array(); @@ -128,9 +129,9 @@ function partnershipPrepareHead($object) //$this->tabs = array( // 'entity:-tabname:Title:@partnership:/partnership/mypage.php?id=__ID__' //); // to remove a tab - complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership@partnership'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership'); - complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership@partnership', 'remove'); + complete_head_from_modules($conf, $langs, $object, $head, $h, 'partnership', 'remove'); return $head; } diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 712455840b8..51f417399df 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_agenda.php @@ -82,7 +82,7 @@ dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index dbf889137d8..aa6c136146e 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -81,7 +81,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); // Get parameters $id = GETPOST('id', 'int'); @@ -590,11 +590,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Accept if ($object->status == $object::STATUS_DRAFT) { if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { - print dolGetButtonAction($langs->trans('Accept'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', $permissiontoadd); + print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', $permissiontoadd); } else { $langs->load("errors"); //print dolGetButtonAction($langs->trans('Accept'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_accept&confirm=yes', '', 0); - print ''.$langs->trans("Accept").''; + print ''.$langs->trans("Validate").''; } } @@ -628,7 +628,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Delete (need delete permission, or if draft, just need create/modify permission) - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)); } print ''."\n"; } diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 02aa67f7365..632047acf25 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -59,7 +59,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies", "other", "mails")); +$langs->loadLangs(array("partnership", "companies", "other", "mails")); $id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index d455f342516..d6f89c07d00 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -82,7 +82,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies", "other", "mails")); +$langs->loadLangs(array("partnership", "companies", "other", "mails")); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 0e0ee3da9c3..441ef1a2de8 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -85,7 +85,7 @@ require_once __DIR__.'/class/partnership.class.php'; //dol_include_once('/othermodule/class/otherobject.class.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "other")); +$langs->loadLangs(array("partnership", "other")); $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index 5e752666b39..29a59f67ef4 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -78,7 +78,7 @@ dol_include_once('/partnership/class/partnership.class.php'); dol_include_once('/partnership/lib/partnership.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership", "companies")); +$langs->loadLangs(array("partnership", "companies")); // Get parameters $id = GETPOST('id', 'int'); diff --git a/htdocs/partnership/partnershipindex.php b/htdocs/partnership/partnershipindex.php index 8db6be052bb..8076f105dbb 100644 --- a/htdocs/partnership/partnershipindex.php +++ b/htdocs/partnership/partnershipindex.php @@ -58,7 +58,7 @@ if (!$res) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("partnership@partnership")); +$langs->loadLangs(array("partnership")); $action = GETPOST('action', 'aZ09'); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 9b06b30765d..0c70af86c9c 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -158,17 +158,18 @@ class Products extends DolibarrApi * * Get a list of products * - * @param string $sortfield Sort field - * @param string $sortorder Sort order - * @param int $limit Limit for list - * @param int $page Page number - * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) - * @param int $category Use this param to filter list by category - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" - * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) - * @return array Array of product objects + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Limit for list + * @param int $page Page number + * @param int $mode Use this param to filter list (0 for all, 1 for only product, 2 for only service) + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.tobuy:=:0) and (t.tosell:=:1)" + * @param bool $ids_only Return only IDs of product instead of all properties (faster, above all if list is long) + * @param int $variant_filter Use this param to filter list (0 = all, 1=products without variants, 2=parent of variants, 3=variants only) + * @return array Array of product objects */ - public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false) + public function index($sortfield = "t.ref", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '', $ids_only = false, $variant_filter = 0) { global $db, $conf; @@ -186,6 +187,18 @@ class Products extends DolibarrApi $sql .= ", ".MAIN_DB_PREFIX."categorie_product as c"; } $sql .= ' WHERE t.entity IN ('.getEntity('product').')'; + + if ($variant_filter == 1) { + $sql .= ' AND t.rowid not in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + $sql .= ' AND t.rowid not in (select distinct fk_product_child from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } + if ($variant_filter == 2) { + $sql .= ' AND t.rowid in (select distinct fk_product_parent from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } + if ($variant_filter == 3) { + $sql .= ' AND t.rowid in (select distinct fk_product_child from '.MAIN_DB_PREFIX.'product_attribute_combination)'; + } + // Select products of given category if ($category > 0) { $sql .= " AND c.fk_categorie = ".$this->db->escape($category); @@ -1793,6 +1806,51 @@ class Products extends DolibarrApi return $result; } + /** + * Get stock data for the product id given. + * Optionaly with $selected_warehouse_id parameter user can get stock of specific warehouse + * + * @param int $id ID of Product + * @param int $selected_warehouse_id ID of warehouse + * @return int + * + * @throws RestException 500 + * @throws RestException 401 + * @throws RestException 404 + * + * @url GET {id}/stock + */ + public function getStock($id, $selected_warehouse_id = null) + { + + if (!DolibarrApiAccess::$user->rights->produit->lire) { + throw new RestException(401); + } + + if (!DolibarrApi::_checkAccessToResource('product', $id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $product_model = new Product($this->db); + $product_model->fetch($id); + $product_model->load_stock(); + + $stockData = $this->_cleanObjectDatas($product_model)->stock_warehouse; + if ($selected_warehouse_id) { + foreach ($stockData as $warehouse_id => $warehouse) { + if ($warehouse_id != $selected_warehouse_id) { + unset($stockData[$warehouse_id]); + } + } + } + + if (empty($stockData)) { + throw new RestException(404, 'No stock found'); + } + + return ['stock_warehouses'=>$stockData]; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index a1fd7a5b1dc..f7275b54570 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -734,6 +734,8 @@ class Product extends CommonObject // update accountancy for this entity if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "product_perentity WHERE fk_product = " . $this->id . " AND entity = " . $conf->entity); + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity ("; $sql .= " fk_product"; $sql .= ", entity"; @@ -2179,13 +2181,13 @@ class Product extends CommonObject if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { - $sql .= " pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export, pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export,"; + $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; } $sql .= " p.stock,p.pmp, p.datec, p.tms, p.import_key, p.entity, p.desiredstock, p.tobatch, p.batch_mask, p.fk_unit,"; $sql .= " p.fk_price_expression, p.price_autogen, p.model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if ($id) { $sql .= " WHERE p.rowid = ".((int) $id); @@ -2268,7 +2270,7 @@ class Product extends CommonObject $this->barcode_type = $obj->fk_barcode_type; $this->accountancy_code_buy = $obj->accountancy_code_buy; - $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; + $this->accountancy_code_buy_intra = $obj->accountancy_code_buy_intra; $this->accountancy_code_buy_export = $obj->accountancy_code_buy_export; $this->accountancy_code_sell = $obj->accountancy_code_sell; $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index d95c2222553..073643fe235 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -191,7 +191,7 @@ if (empty($conf->global->PRODUIT_MULTIPRICES)) { $isInEEC = isInEEC($mysoc); -$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "pa"; +$alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p" : "ppe"; // Definition of fields for lists $arrayfields = array( @@ -364,7 +364,7 @@ $sql .= ' p.tobatch,'; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; } else { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.datec as date_creation, p.tms as date_update, p.pmp, p.stock, p.cost_price,'; $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, fk_country, fk_state,'; @@ -387,7 +387,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as pa ON pa.fk_product = p.rowid AND pa.entity = " . ((int) $conf->entity); + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_extrafields as ef on (p.rowid = ef.fk_object)"; @@ -523,7 +523,7 @@ $sql .= ' p.datec, p.tms, p.entity, p.tobatch, p.pmp, p.cost_price, p.stock,'; if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { $sql .= " p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export,"; } else { - $sql .= " pa.accountancy_code_sell, pa.accountancy_code_sell_intra, pa.accountancy_code_sell_export, pa.accountancy_code_buy, pa.accountancy_code_buy_intra, pa.accountancy_code_buy_export,"; + $sql .= " ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export, ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export,"; } $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units, p.fk_country, p.fk_state'; if (!empty($conf->global->PRODUCT_USE_UNITS)) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index c9109b348d6..73124fd7bad 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -6,6 +6,7 @@ * Copyright (C) 2016 ATM Consulting * Copyright (C) 2019 Frédéric France * Copyright (C) 2021 Ferran Marcet + * Copyright (C) 2021 Antonin MARCHAL * * 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 @@ -64,6 +65,25 @@ $draftorder = GETPOST('draftorder', 'alpha'); $fourn_id = GETPOST('fourn_id', 'int'); $fk_supplier = GETPOST('fk_supplier', 'int'); $fk_entrepot = GETPOST('fk_entrepot', 'int'); + +//List all visible warehouses +$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")"); +$listofqualifiedwarehousesid = ""; +$count = 0; +while ($tmpobj = $db->fetch_object($resWar)) { + if (!empty($listofqualifiedwarehousesid)) { + $listofqualifiedwarehousesid .= ","; + } + $listofqualifiedwarehousesid .= $tmpobj->rowid; + $lastWarehouseID = $tmpobj->rowid; + $count++; +}; + +//MultiCompany : If only 1 Warehouse is visible, filter will automatically be set to it. +if ($count == 1 && (empty($fk_entrepot) || $fk_entrepot <= 0) && !empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { + $fk_entrepot = $lastWarehouseID; +}; + $texte = ''; $sortfield = GETPOST('sortfield', 'aZ09comma'); @@ -324,8 +344,8 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // N $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product'; -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product AND s.fk_entrepot IN ('.$db->sanitize($listofqualifiedwarehousesid).')'; +//$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')'; if ($fk_supplier > 0) { $sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'product_fournisseur_price pfp ON (pfp.fk_product = p.rowid AND pfp.fk_soc = '.$fk_supplier.')'; } diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 3c67673ad49..b0195200dd5 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -81,13 +81,16 @@ $monthofday = GETPOST('addtimemonth'); $dayofday = GETPOST('addtimeday'); $yearofday = GETPOST('addtimeyear'); -$daytoparse = $now; -if ($yearofday && $monthofday && $dayofday) { - $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' -} elseif ($year && $month && $day) { - $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' -} +/*var_dump(GETPOST('remonth')); +var_dump(GETPOST('button_search_x')); +var_dump(GETPOST('button_addtime'));*/ +$daytoparse = $now; +if ($year && $month && $day) { + $daytoparse = dol_mktime(0, 0, 0, $month, $day, $year); // this are value submited after submit of action 'submitdateselect' +} elseif ($yearofday && $monthofday && $dayofday) { + $daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime' +} if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) { $usertoprocess = $user; @@ -416,10 +419,10 @@ $search_options_pattern = 'search_task_options_'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Show navigation bar -$nav = ''.img_previous($langs->trans("Previous"))."\n"; +$nav = ''.img_previous($langs->trans("Previous"))."\n"; $nav .= dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "%A").' '; $nav .= " ".dol_print_date(dol_mktime(0, 0, 0, $month, $day, $year), "day")." \n"; -$nav .= ''.img_next($langs->trans("Next"))."\n"; +$nav .= ''.img_next($langs->trans("Next"))."\n"; $nav .= ' '.$form->selectDate(-1, '', 0, 0, 2, "addtime", 1, 1).' '; $nav .= ' '; @@ -773,7 +776,7 @@ print ''; print ''."\n"; print '
'; -print ''; +print ''; print '
'; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 3d380ab7f4e..0a275cb46e3 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -665,7 +665,12 @@ if (!empty($arrayfields['timeconsumed']['checked'])) { for ($idw = 0; $idw < 7; $idw++) { $dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0 $dayinloop = dol_time_plus_duree($startday, $idw, 'd'); - + /*print $dayinloopfromfirstdaytoshow; + print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour', 'gmt'); + print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour'); + print dol_print_date($dayinloopfromfirstdaytoshow, '%a', 'gmt'); + print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); + print '
';*/ $cssweekend = ''; if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css. $cssweekend = 'weekend'; @@ -682,7 +687,9 @@ for ($idw = 0; $idw < 7; $idw++) { $cssonholiday .= 'onholidayafternoon '; } - print ''.dol_print_date($dayinloopfromfirstdaytoshow, '%a').'
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').''; + print ''; + print dol_print_date($dayinloopfromfirstdaytoshow, '%a'); + print '
'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').''; } //print ''; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index e3dbb9b735d..e7f1af66e0c 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -146,7 +146,7 @@ class Salary extends CommonObject $sql .= " note='".$this->db->escape($this->note)."',"; $sql .= " fk_bank=".($this->fk_bank > 0 ? (int) $this->fk_bank : "null").","; $sql .= " fk_user_author=".((int) $this->fk_user_author).","; - $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : 'null'); + $sql .= " fk_user_modif=".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id); $sql .= " WHERE rowid=".((int) $this->id); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9e234559aad..14ebede6b07 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -879,8 +879,10 @@ class Societe extends CommonObject $sql .= ", import_key"; $sql .= ", fk_multicurrency"; $sql .= ", multicurrency_code"; - $sql .= ", accountancy_code_buy"; - $sql .= ", accountancy_code_sell"; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + } $sql .= ") VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'"; $sql .= ", ".(!empty($user->id) ? ((int) $user->id) : "null"); $sql .= ", ".(!empty($this->typent_id) ? ((int) $this->typent_id) : "null"); @@ -893,8 +895,10 @@ class Societe extends CommonObject $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); $sql .= ", ".(int) $this->fk_multicurrency; $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; - $sql .= ", '".$this->db->escape($this->accountancy_code_sell)."'"; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + } $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -904,6 +908,28 @@ class Societe extends CommonObject $ret = $this->update($this->id, $user, 0, 1, 1, 'add'); + // update accountancy for this entity + if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . $this->id . " AND entity = " . $conf->entity); + + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql .= " fk_soc"; + $sql .= ", entity"; + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + $sql .= ") VALUES ("; + $sql .= $this->id; + $sql .= ", " . $conf->entity; + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ")"; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'ErrorFailedToUpdateAccountancyForEntity'; + } + } + // Ajout du commercial affecte if ($this->commercial_id != '' && $this->commercial_id != -1) { $this->add_commercial($user, $this->commercial_id); @@ -1414,10 +1440,10 @@ class Societe extends CommonObject $sql .= ",order_min_amount= ".($this->order_min_amount != '' ? $this->order_min_amount : 'null'); $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; - - $sql.= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy)."'"; - $sql.= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell)."'"; - + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", accountancy_code_sell= '" . $this->db->escape($this->accountancy_code_sell) . "'"; + } $sql .= ",webservices_url = ".(!empty($this->webservices_url) ? "'".$this->db->escape($this->webservices_url)."'" : "null"); $sql .= ",webservices_key = ".(!empty($this->webservices_key) ? "'".$this->db->escape($this->webservices_key)."'" : "null"); @@ -1499,6 +1525,28 @@ class Societe extends CommonObject $action = 'update'; + // update accountancy for this entity + if (!$error && !empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $this->db->query("DELETE FROM " . MAIN_DB_PREFIX . "societe_perentity WHERE fk_soc = " . $this->id . " AND entity = " . $conf->entity); + + $sql = "INSERT INTO " . MAIN_DB_PREFIX . "societe_perentity ("; + $sql .= " fk_soc"; + $sql .= ", entity"; + $sql .= ", accountancy_code_buy"; + $sql .= ", accountancy_code_sell"; + $sql .= ") VALUES ("; + $sql .= $this->id; + $sql .= ", " . $conf->entity; + $sql .= ", '" . $this->db->escape($this->accountancy_code_buy) . "'"; + $sql .= ", '" . $this->db->escape($this->accountancy_code_sell) . "'"; + $sql .= ")"; + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->error = 'ErrorFailedToUpdateAccountancyForEntity'; + } + } + // Actions on extra fields if (!$error) { $result = $this->insertExtraFields(); @@ -1589,7 +1637,11 @@ class Societe extends CommonObject $sql .= ', s.fk_effectif as effectif_id'; $sql .= ', s.fk_forme_juridique as forme_juridique_code'; $sql .= ', s.webservices_url, s.webservices_key'; - $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; + if (empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= ', s.accountancy_code_buy, s.accountancy_code_sell'; + } else { + $sql .= ', spe.accountancy_code_buy, spe.accountancy_code_sell'; + } $sql .= ', s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.parent, s.barcode'; $sql .= ', s.fk_departement as state_id, s.fk_pays as country_id, s.fk_stcomm, s.remise_supplier, s.mode_reglement, s.cond_reglement, s.transport_mode'; $sql .= ', s.fk_account, s.tva_assuj'; @@ -1609,6 +1661,9 @@ class Societe extends CommonObject $sql .= ', i.libelle as label_incoterms'; $sql .= ', sr.remise_client, model_pdf'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; + if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); + } $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcomm as st ON s.fk_stcomm = st.id'; @@ -3897,7 +3952,7 @@ class Societe extends CommonObject $state_code = $tmp[1]; $state_label = $tmp[2]; } else { // For backward compatibility - dol_syslog("Your state setup use an old syntax (entity=".$conf->entity."). Reedit it using setup area.", LOG_ERR); + dol_syslog("Your setup of State an old syntax (entity=".$conf->entity."). Go in Home - Setup - Organization then Save should remove this error.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore $state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 863b6eda42c..d330e792f53 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -105,8 +105,10 @@ function Floors() { '; print $langs->trans("EnableBarOrRestaurantFeatures"); print ajax_constantonoff("TAKEPOS_BAR_RESTAURANT", array(), $conf->entity, 0, 0, 1, 0); +print ''; print '
'; @@ -137,6 +139,20 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT) { print ajax_constantonoff("TAKEPOS_ORDER_NOTES", array(), $conf->entity, 0, 0, 1, 0); //print $form->selectyesno("TAKEPOS_ORDER_NOTES", $conf->global->TAKEPOS_ORDER_NOTES, 1); print ''; + } else { + print ''; + print $langs->trans("OrderPrinters"); + print ''; + print ''; + print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; + print ''; + + print ''; + print $langs->trans("OrderNotes"); + print ''; + print ''; + print ''.$langs->trans("NotAvailableWithBrowserPrinter").''; + print ''; } print ''; diff --git a/htdocs/takepos/admin/other.php b/htdocs/takepos/admin/other.php index f933472a443..e5114a446bd 100644 --- a/htdocs/takepos/admin/other.php +++ b/htdocs/takepos/admin/other.php @@ -61,44 +61,7 @@ if ($resql) { * Actions */ -if (GETPOST('action', 'alpha') == 'set') { - $db->begin(); - - $res = dolibarr_set_const($db, "CASHDESK_SERVICES", GETPOST('CASHDESK_SERVICES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_PRINTERS", GETPOST('TAKEPOS_ORDER_PRINTERS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_ORDER_NOTES", GETPOST('TAKEPOS_ORDER_NOTES', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_PHONE_BASIC_LAYOUT", GETPOST('TAKEPOS_PHONE_BASIC_LAYOUT', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS", GETPOST('TAKEPOS_SUPPLEMENTS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUPPLEMENTS_CATEGORY", GETPOST('TAKEPOS_SUPPLEMENTS_CATEGORY', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_NUMPAD", GETPOST('TAKEPOS_NUMPAD', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SORTPRODUCTFIELD", GETPOST('TAKEPOS_SORTPRODUCTFIELD', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_COLOR_THEME", GETPOST('TAKEPOS_COLOR_THEME', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_NUM_TERMINALS", GETPOST('TAKEPOS_NUM_TERMINALS', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_DIRECT_PAYMENT", GETPOST('TAKEPOS_DIRECT_PAYMENT', 'int'), 'int', 0, '', $conf->entity); - //$res = dolibarr_set_const($db, "TAKEPOS_HEAD_BAR", GETPOST('TAKEPOS_HEAD_BAR', 'int'), 'int', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_EMAIL_TEMPLATE_INVOICE", GETPOST('TAKEPOS_EMAIL_TEMPLATE_INVOICE', 'alpha'), 'chaine', 0, '', $conf->entity); - if (!empty($conf->global->TAKEPOS_ENABLE_SUMUP)) { - $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); - $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); - } - - dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha')); - - if (!($res > 0)) { - $error++; - } - - if (!$error) { - $db->commit(); - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($langs->trans("Error"), null, 'errors'); - } -} +// Nothing /* diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 8c201949034..9b236fc837a 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -118,8 +118,12 @@ print ''; print $langs->trans('DolibarrReceiptPrinter'); print ''; print $langs->trans('ReceiptPrinterMethodDescription'); -print '
'; -print ''.$langs->trans("Setup").''; +if ($conf->receiptprinter->enabled) { + if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { + print '
'; + print img_picto('', 'printer', 'class="paddingright"').''.$langs->trans("Setup").''; + } +} print ''; if ($conf->receiptprinter->enabled) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { @@ -139,6 +143,13 @@ print ''; print "TakePOS Connector"; print ''; print $langs->trans('TakeposConnectorMethodDescription'); + +if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { + print '
'; + print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; + print ' '; +} + print ''; if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print img_picto($langs->trans("Activated"), 'switch_on'); @@ -150,7 +161,7 @@ print ''; print ''; -print load_fiche_titre($langs->trans("Setup"), '', ''); +print load_fiche_titre($langs->trans("Receipt"), '', ''); print '
'; print ''; @@ -166,14 +177,6 @@ print ajax_constantonoff("TAKEPOS_TICKET_VAT_GROUPPED", array(), $conf->entity, //print $form->selectyesno("TAKEPOS_TICKET_VAT_GROUPPED", $conf->global->TAKEPOS_TICKET_VAT_GROUPPED, 1); print "\n"; -if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { - print ''; -} - if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 52f451ae163..922a5c5032c 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -152,6 +152,7 @@ $atleastonefound = 0; if (!empty($conf->banque->enabled)) { print ''; print ''; print ''; print ''; print ''; print ''; print ''; } @@ -217,6 +222,7 @@ if (!empty($conf->stock->enabled)) { print ''; // Force warehouse (this is not a default value) print '
'; - print $langs->trans("URL")." / ".$langs->trans("IPAddress").' ('.$langs->trans("TakeposConnectorNecesary").')'; - print ''; - print ''; - print '
'.$langs->trans("CashDeskBankAccountForSell").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse, 0, "courant=2", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse})) { $atleastonefound++; @@ -159,6 +160,7 @@ if (!empty($conf->banque->enabled)) { print '
'.$langs->trans("CashDeskBankAccountForCheque").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$terminaltouse})) { $atleastonefound++; @@ -166,6 +168,7 @@ if (!empty($conf->banque->enabled)) { print '
'.$langs->trans("CashDeskBankAccountForCB").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$terminaltouse})) { $atleastonefound++; @@ -174,6 +177,7 @@ if (!empty($conf->banque->enabled)) { if ($conf->global->TAKEPOS_ENABLE_SUMUP) { print '
'.$langs->trans("CashDeskBankAccountForSumup").''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse}, 'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse, 0, "courant=1", 1); if (!empty($conf->global->{'CASHDESK_ID_BANKACCOUNT_SUMUP'.$terminaltouse})) { $atleastonefound++; @@ -192,6 +196,7 @@ if (!empty($conf->banque->enabled)) { $atleastonefound++; } $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); $form->select_comptes($conf->global->$name, $name, 0, "courant=".$cour, 1); print '
'.$langs->trans("CashDeskIdWareHouse").''; if (!$disabled) { + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled, 0, '', 0, 0, array(), 'maxwidth250'); print ' '; } else { diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 4c3ef11294f..1f9e6c32b2b 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1029,7 +1029,7 @@ if ($conf->global->TAKEPOS_DIRECT_PAYMENT) { // BAR RESTAURANT specific menu if ($conf->global->TAKEPOS_BAR_RESTAURANT) { if ($conf->global->TAKEPOS_ORDER_PRINTERS) { - $menus[$r++] = array('title'=>$langs->trans("Order"), 'action'=>'TakeposPrintingOrder();'); + $menus[$r++] = array('title'=>'
'.$langs->trans("Order").'', 'action'=>'TakeposPrintingOrder();'); } //Button to print receipt before payment if ($conf->global->TAKEPOS_BAR_RESTAURANT) { diff --git a/test/phpunit/DateLibTest.php b/test/phpunit/DateLibTest.php index 78f5b36da49..7ff09de495e 100644 --- a/test/phpunit/DateLibTest.php +++ b/test/phpunit/DateLibTest.php @@ -390,6 +390,17 @@ class DateLibTest extends PHPUnit\Framework\TestCase print __METHOD__." result=".$result."\n"; $this->assertEquals('Jeu Jan. Janvier', $result); + + $result=dol_print_date(1619388000, '%Y-%m-%d %a', 'gmt', $outputlangs); + print __METHOD__." result=".$result."\n"; + $this->assertEquals('2021-04-25 Dim', $result); + + /* This test is disabled because result depends on TZ of server + $result=dol_print_date(1619388000, '%Y-%m-%d %a', 'tzserver', $outputlangs); // If TZ is +2, then result will be Lun for 1619388000 + print __METHOD__." result=".$result."\n"; + $this->assertEquals('2021-04-26 Lun', $result); + */ + // Check day format for en_US $outputlangs=new Translate('', $conf); $outputlangs->setDefaultLang('en_US');