diff --git a/ChangeLog b/ChangeLog index 410e49eaf4b..fac6c0a3c06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,43 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 7.0.3 compared to 7.0.2 ***** +FIX: 7.0 task contact card without withproject parameters +FIX: #8722 +FIX: #8762 +FIX: #8813 +FIX: #8858 #8860 Backport better compatibility fix +FIX: #8893 to get formatted price as substitution vars +FIX: Avoid converting into reduction twice and draft invoice +FIX: bad result on fetch ProductStockEntrepot +FIX: Bad substitution key used for default send proposal email +FIX: button to pay still visible when amount null used +FIX: clause must not be there +FIX: Contact tab not visible when using canvas +FIX: dol_delete_file must work in a context without db handler loaded +FIX: entity test must be on product_fourn_price table and not product table +FIX: Fetch shipping will now fetch project id +FIX: If we enable 3 steps for supplier order approbation, we must not delete all fourn rights def. +FIX: intervention: extrafield error when calling insertExtrafields +FIX: It's not possible to remove a contact which is assigned to an event #8852 +FIX: javascript showempty error +FIX: Keep supplier proposal price for supplier order +FIX: link for projets not linked to a thirdparties +FIX: Missing extrafields in export of stock or products +FIX: missing filters during ordering +FIX: missing filters during reordering +FIX: missing parenthesis +FIX: need to filter on aa.entity for same accounting accounts available in several entities +FIX: picto for type in product link in accountany list is wrong +FIX: Problems in accountancy module when using multicompany module. +FIX: proposal: missing contact type translation key +FIX: pu_ht_devise was not converted to numeric so decimals were lost when calculating total_ht_devise +FIX: Select user on add time spent form +FIX: shipment: fk_proje(c)t not handled in fetch() and update() methods +FIX: sometimes amounts are identical but php find them different. +FIX: supplier order: product supplier ref not saved on addline +FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url +FIX: wrong var name $search_month_lim ***** ChangeLog for 8.0.0 compared to 7.0.0 ***** @@ -22,7 +59,8 @@ Following changes may create regressions for some external modules, but were nec * The hook contaxt commcard has been renamed thirdpartycomm * The hook contaxt thirdpartycard has been renamed thirdpartycontact * Remove method Categorie:get_nb_categories() that was not used. - +* Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip + are now replaced with hook getNomUrl. ***** ChangeLog for 7.0.2 compared to 7.0.1 ***** diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 4a5e77a434b..ff3a38769b8 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -21,6 +21,7 @@ * \ingroup Advanced accountancy * \brief Setup page to configure journals */ + require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index f9cf6eec5e5..284ead4fb56 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -38,8 +38,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php'; $langs->loadLangs(array("accountancy")); $page = GETPOST("page"); -$sortorder = GETPOST("sortorder"); -$sortfield = GETPOST("sortfield"); +$sortorder = GETPOST("sortorder", 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); $action = GETPOST('action', 'alpha'); $search_date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $search_date_end = dol_mktime(0, 0, 0, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); @@ -53,7 +53,7 @@ if ($search_accountancy_code_end == - 1) { $search_accountancy_code_end = ''; } -if (GETPOST("exportcsv")) $action = 'export_csv'; +if (GETPOST("exportcsv",'alpha')) $action = 'export_csv'; $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):$conf->liste_limit; @@ -186,8 +186,8 @@ else { print ''; print ''; - $button = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; - print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button); + $button = 'global->ACCOUNTING_EXPORT_FORMAT.')" />'; + print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, $button, $result, $result, 'title_accountancy', 0); $moreforfilter = ''; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 10b3b5434fd..92c5713880c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -555,8 +555,9 @@ if ($action == 'create') */ print "\n"; - print ''; - print ''; + print ''; + + dol_fiche_end(); print '
'; @@ -712,5 +713,6 @@ if ($action == 'create') } dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 277e2b59cb6..18e23826314 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -66,38 +66,53 @@ $year_current = $year_start; $action = GETPOST('action','aZ09'); - /* * Actions */ +if ($action == 'clean' || $action == 'validatehistory') +{ + // Clean database + $db->begin(); + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; + $sql1 .= " SET fk_code_ventilation = 0"; + $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN'; + $sql1 .= ' (SELECT accnt.rowid '; + $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; + $sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; + $sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ' AND accnt.entity = '.$conf->entity.')'; + $sql1 .= ' AND fd.fk_facture IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture WHERE entity = '.$conf->entity.')'; + $sql1 .= ' AND fk_code_ventilation <> 0'; + + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + $db->rollback(); + setEventMessage($db->lasterror(), 'errors'); + } else { + $db->commit(); + } + // End clean database +} + if ($action == 'validatehistory') { $error = 0; $db->begin(); - // First clean corrupted data - $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fk_code_ventilation = 0"; - $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; - $sqlclean .= ' (SELECT accnt.rowid '; - $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; - $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; - $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; - $resql = $db->query($sqlclean); - // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " FROM " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE " . MAIN_DB_PREFIX . "facturedet.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; $sql1 .= " SET fk_code_ventilation = accnt.rowid"; - $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; + $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS.' AND accnt.entity = '.$conf->entity; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; } @@ -128,26 +143,6 @@ $textnextyear = ' begin(); -$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; -$sql1 .= " SET fk_code_ventilation = 0"; -$sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; -$sql1 .= ' (SELECT accnt.rowid '; -$sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; -$sql1 .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; -$sql1 .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; -dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); -$resql1 = $db->query($sql1); -if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); -} else { - $db->commit(); -} -// End clean database - print $langs->trans("DescVentilCustomer") . '
'; print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '
'; print '
'; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 4eccef67246..cc0ced6b067 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -169,9 +169,9 @@ print ''; $form = new Form($db); $formadvtargetemaling = new FormAdvTargetEmailing($db); @@ -490,487 +462,9 @@ if ($object->fetch($id) >= 0) { // Show email selectors if ($object->statut == 0 && $user->rights->mailing->creer) { - print_fiche_titre($langs->trans("AdvTgtTitle")); - - print '
' . "\n"; - print '
' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - - print '' . "\n"; - - print '' . "\n"; - - // Customer name - print '' . "\n"; - - // Code Client - print '' . "\n"; - - // Address Client - print '' . "\n"; - - // Zip Client - print '' . "\n"; - - // City Client - print '' . "\n"; - - // Customer Country - print '' . "\n"; - - // State Customer - print '' . "\n"; - - // Mother Company - print '' . "\n"; - - // Prospect/Customer - $selected = $array_query['cust_typecust']; - print '' . "\n"; - - // Prospection status - print '' . "\n"; - - // Prospection comm status - print '' . "\n"; - - // Customer Type - print '' . "\n"; - - // Staff number - print '' . "\n"; - - // Sales manager - print '' . "\n"; - - // Customer Default Langauge - if (! empty($conf->global->MAIN_MULTILANGS)) { - - print '' . "\n"; - } - - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extralabels = $extrafields->fetch_name_optionals_label('societe'); - foreach ( $extralabels as $key => $val ) { - if ($key != 'ts_nameextra' && $key != 'ts_payeur') { - print '' . "\n"; - } - } - } else { - $std_soc = new Societe($db); - $action_search = 'query'; - - // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context - include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; - $hookmanager = new HookManager($db); - $hookmanager->initHooks(array ('thirdpartycard')); - - $parameters=array(); - if (! empty($advTarget->id)) { - $parameters = array('array_query' => $advTarget->filtervalue); - } - // Other attributes - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); - print $hookmanager->resPrint; - } - - // State Contact - print '' . "\n"; - - // Civility - print ''; - - // contact name - print '' . "\n"; - print '' . "\n"; - - // Contact Country - print '' . "\n"; - - // Never send mass mailing - print '' . "\n"; - - // Contact Date Create - print '' . "\n"; - - // Contact update Create - print '' . "\n"; - - if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { - // Customer Categories - print '' . "\n"; - } - - // Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - // fetch optionals attributes and labels - dol_include_once('/core/class/extrafields.class.php'); - $extrafields = new ExtraFields($db); - $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); - foreach($extrafields->attribute_type as $key=>&$value) { - if($value == 'radio')$value = 'select'; - } - - - foreach ( $extralabels as $key => $val ) { - - print '' . "\n"; - } - } - - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '
' . "\n"; - - print '' . "\n"; - - print '
' . $langs->trans('AdvTgtNameTemplate') . ''; - if (! empty($template_id)) { - $default_template = $template_id; - } else { - $default_template = $advTarget->id; - } - print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template); - print ''; - print ''; - print ''; - print $langs->trans('AdvTgtOrCreateNewFilter'); - print ''; - print ''; - print '' . "\n"; - print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; - print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); - print '
' . $langs->trans('ThirdPartyName'); - if (! empty($array_query['cust_name'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('CustomerCode'); - if (! empty($array_query['cust_code'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Address'); - if (! empty($array_query['cust_adress'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Zip'); - if (! empty($array_query['cust_zip'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Town'); - if (! empty($array_query['cust_city'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans("Country"); - if (count($array_query['cust_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); - print '' . "\n"; - print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('cust_status', array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), $array_query['cust_status']); - print '' . "\n"; - print '
' . $langs->trans("Maison mère"); - if (! empty($array_query['cust_mothercompany'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); - if (count($array_query['cust_typecust']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - $options_array = array ( - 2 => $langs->trans('Prospect'), - 3 => $langs->trans('ProspectCustomer'), - 1 => $langs->trans('Customer'), - 0 => $langs->trans('NorProspectNorCustomer') - ); - print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); - print '' . "\n"; - print '
' . $langs->trans('ProspectLevel'); - if (count($array_query['cust_prospect_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); - print '' . "\n"; - print '
' . $langs->trans('StatusProsp'); - if (count($array_query['cust_comm_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); - print '' . "\n"; - print '
' . $langs->trans("ThirdPartyType"); - if (count($array_query['cust_typeent']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); - print '' . "\n"; - print '
' . $langs->trans("Staff"); - if (count($array_query['cust_effectif_id']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); - print '' . "\n"; - print '
' . $langs->trans("SalesRepresentatives"); - if (count($array_query['cust_saleman']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); - print '' . "\n"; - print '
' . $langs->trans("DefaultLang"); - if (count($array_query['cust_language']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); - print '' . "\n"; - print '
' . $langs->trans("CustomersCategoryShort"); - if (count($array_query['cust_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); - print '' . "\n"; - print '
' . $extrafields->attribute_label[$key]; - if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { - - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date('', 'options_' . $key . '_st_dt'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date('', 'options_' . $key . '_end_dt'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'boolean')) { - print $form->selectarray('options_' . $key, array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['options_' . $key]); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); - print '' . "\n"; - } else { - - print ''; - print '
'; - if (is_array($array_query['options_' . $key])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key]); - } - print '
'; - - print '
' . "\n"; - } - print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); - if (count($array_query['contact_status']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->advMultiselectarray('contact_status', array ( - '0' => $langs->trans('ActivityCeased'), - '1' => $langs->trans('InActivity') - ), $array_query['contact_status']); - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); - print '
' . $langs->trans("UserTitle"); - if (count($array_query['contact_civility']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); - if (! empty($array_query['contact_lastname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); - if (! empty($array_query['contact_firstname'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); - if (count($array_query['contact_country']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); - if (! empty($array_query['contact_no_email'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $form->selectarray('contact_no_email', array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['contact_no_email']); - print '' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); - if (! empty($array_query['contact_create_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); - if (! empty($array_query['contact_update_st_dt'])) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); - print '
'; - print '
' . "\n"; - print '
' . $langs->trans("ContactCategoriesShort"); - if (count($array_query['contact_categ']) > 0) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print '' . "\n"; - print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); - print '' . "\n"; - print '
' . $extrafields->attribute_label[$key]; - if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { - print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); - } - print ''; - if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { - print $langs->trans("AdvTgtMinVal") . ''; - print $langs->trans("AdvTgtMaxVal") . ''; - print '' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { - - print ''; - print '
' . $langs->trans("AdvTgtStartDt") . ''; - print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct'); - print '' . $langs->trans("AdvTgtEndDt") . ''; - print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct'); - print '
'; - - print '
' . "\n"; - print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); - } elseif (($extrafields->attribute_type[$key] == 'boolean')) { - print $form->selectarray('options_' . $key . '_cnct', array ( - '' => '', - '1' => $langs->trans('Yes'), - '0' => $langs->trans('No') - ), $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'select')) { - print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } elseif (($extrafields->attribute_type[$key] == 'sellist')) { - print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); - print '' . "\n"; - } else { - - print ''; - print '
'; - if (is_array($array_query['options_' . $key . '_cnct'])) { - print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); - } else { - print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); - } - print '
'; - - print '
' . "\n"; - } - print '
' . "\n"; - - print '' . "\n"; - - print '
' . "\n"; - print '
' . "\n"; - print '
' . "\n"; - - print '
'; - print ''; - print_titre($langs->trans("ToClearAllRecipientsClickHere")); - print ''; - print ''; - print ''; - print ''; - print '
'; - print '
'; - print '
'; + + include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php'; + } } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ef3fa3d81a9..d3a627a1695 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -76,8 +76,6 @@ if ($action == 'add') $module=GETPOST("module"); $result=-1; - $var=true; - foreach ($modulesdir as $dir) { // Load modules attributes in arrays (name, numero, orders) from dir directory @@ -278,8 +276,6 @@ if ($object->fetch($id) >= 0) clearstatcache(); - $var = true; - foreach ($modulesdir as $dir) { $modulenames=array(); @@ -332,16 +328,15 @@ if ($object->fetch($id) >= 0) // Si le module mailing est qualifie if ($qualified) { - $var = !$var; if ($allowaddtarget) { - print '
'; + print ''; print ''; } else { - print '
'; + print '
'; } print '
'; diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 70efeccead3..50d9faf0637 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -39,7 +39,8 @@ class AdvanceTargetingMailing extends CommonObject var $name; var $entity; - var $fk_mailing; + var $fk_element; + var $type_element; var $filtervalue; var $fk_user_author; var $datec=''; @@ -92,7 +93,9 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing); + if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->type_element)) $this->type_element=trim($this->type_element); + if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); @@ -108,7 +111,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= "name,"; $sql.= "entity,"; - $sql.= "fk_mailing,"; + $sql.= "fk_element,"; + $sql.= "type_element,"; $sql.= "filtervalue,"; $sql.= "fk_user_author,"; $sql.= "datec,"; @@ -119,7 +123,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " ".(! isset($this->name)?'NULL':"'".$this->db->escape($this->name)."'").","; $sql.= " ".$conf->entity.","; - $sql.= " ".(! isset($this->fk_mailing)?'NULL':"'".$this->db->escape($this->fk_mailing)."'").","; + $sql.= " ".(! isset($this->fk_element)?'NULL':"'".$this->db->escape($this->fk_element)."'").","; + $sql.= " ".(! isset($this->type_element)?'NULL':"'".$this->db->escape($this->type_element)."'").","; $sql.= " ".(! isset($this->filtervalue)?'NULL':"'".$this->db->escape($this->filtervalue)."'").","; $sql.= " ".$user->id.","; $sql.= " '".$this->db->idate(dol_now())."',"; @@ -184,7 +189,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " t.name,"; $sql.= " t.entity,"; - $sql.= " t.fk_mailing,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; $sql.= " t.filtervalue,"; $sql.= " t.fk_user_author,"; $sql.= " t.datec,"; @@ -206,7 +212,8 @@ class AdvanceTargetingMailing extends CommonObject $this->name = $obj->name; $this->entity = $obj->entity; - $this->fk_mailing = $obj->fk_mailing; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; $this->filtervalue = $obj->filtervalue; $this->fk_user_author = $obj->fk_user_author; $this->datec = $this->db->jdate($obj->datec); @@ -240,7 +247,8 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " t.name,"; $sql.= " t.entity,"; - $sql.= " t.fk_mailing,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; $sql.= " t.filtervalue,"; $sql.= " t.fk_user_author,"; $sql.= " t.datec,"; @@ -249,9 +257,9 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; if (!empty($id)) { - $sql.= " WHERE t.fk_mailing = ".$id; + $sql.= " WHERE t.fk_element = ".$id." AND type_element='mailing'"; }else { - $sql.= " WHERE t.fk_mailing = ".$this->fk_mailing; + $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='mailing'"; } dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); @@ -266,7 +274,74 @@ class AdvanceTargetingMailing extends CommonObject $this->name = $obj->name; $this->entity = $obj->entity; - $this->fk_mailing = $obj->fk_mailing; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; + $this->filtervalue = $obj->filtervalue; + $this->fk_user_author = $obj->fk_user_author; + $this->datec = $this->db->jdate($obj->datec); + $this->fk_user_mod = $obj->fk_user_mod; + $this->tms = $this->db->jdate($obj->tms); + + } + $this->db->free($resql); + + return 1; + } + else + { + $this->error="Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); + return -1; + } + } + + + + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $type_element Type target + * @return int <0 if KO, >0 if OK + */ + function fetch_by_element($id=0, $type_element='mailing') + { + global $langs; + $sql = "SELECT"; + $sql.= " t.rowid,"; + + $sql.= " t.name,"; + $sql.= " t.entity,"; + $sql.= " t.fk_element,"; + $sql.= " t.type_element,"; + $sql.= " t.filtervalue,"; + $sql.= " t.fk_user_author,"; + $sql.= " t.datec,"; + $sql.= " t.fk_user_mod,"; + $sql.= " t.tms"; + + $sql.= " FROM ".MAIN_DB_PREFIX."advtargetemailing as t"; + if (!empty($id)) { + $sql.= " WHERE t.fk_element = ".$id." AND type_element='$type_element'"; + }else { + $sql.= " WHERE t.fk_element = ".$this->fk_element." AND type_element='$type_element'"; + } + + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + + $this->name = $obj->name; + $this->entity = $obj->entity; + $this->fk_element = $obj->fk_element; + $this->type_element = $obj->type_element; $this->filtervalue = $obj->filtervalue; $this->fk_user_author = $obj->fk_user_author; $this->datec = $this->db->jdate($obj->datec); @@ -299,7 +374,8 @@ class AdvanceTargetingMailing extends CommonObject $error=0; // Clean parameters - if (isset($this->fk_mailing)) $this->fk_mailing=trim($this->fk_mailing); + if (isset($this->fk_element)) $this->fk_element=trim($this->fk_element); + if (isset($this->type_element)) $this->type_element=trim($this->type_element); if (isset($this->name)) $this->name=trim($this->name); if (isset($this->filtervalue)) $this->filtervalue=trim($this->filtervalue); if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); @@ -315,14 +391,14 @@ class AdvanceTargetingMailing extends CommonObject $sql.= " name=".(isset($this->name)?"'".$this->db->escape($this->name)."'":"''").","; $sql.= " entity=".$conf->entity.","; - $sql.= " fk_mailing=".(isset($this->fk_mailing)?$this->fk_mailing:"null").","; + $sql.= " fk_element=".(isset($this->fk_element)?$this->fk_element:"null").","; + $sql.= " type_element=".(isset($this->type_element)?"'".$this->db->escape($this->type_element)."'":"null").","; $sql.= " filtervalue=".(isset($this->filtervalue)?"'".$this->db->escape($this->filtervalue)."'":"null").","; $sql.= " fk_user_mod=".$user->id; $sql.= " WHERE rowid=".$this->id; $this->db->begin(); - dol_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } @@ -432,7 +508,7 @@ class AdvanceTargetingMailing extends CommonObject global $langs,$conf; if (!empty($arrayquery)) { - $result=$this->fetch_by_mailing($this->fk_mailing); + $result=$this->fetch_by_mailing($this->fk_element); $this->filtervalue=json_encode($arrayquery); if ($result<0) { return -1; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index c7f425f8f7a..7408bb27d37 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -409,21 +409,22 @@ class FormAdvTargetEmailing extends Form } /** - * selectAdvtargetemailingTemplate + * Return a combo list to select emailing target selector * - * @param string $htmlname control name - * @param integer $selected defaut selected - * @param integer $showempty empty lines - * - * @return string HTML combo + * @param string $htmlname control name + * @param integer $selected defaut selected + * @param integer $showempty empty lines + * @param string $type_element Type element. Example: 'mailing' + * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id',$selected=0,$showempty=0) { + public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') { global $conf, $user, $langs; $out = ''; - $sql = "SELECT c.rowid, c.name, c.fk_mailing"; + $sql = "SELECT c.rowid, c.name, c.fk_element"; $sql .= " FROM " . MAIN_DB_PREFIX . "advtargetemailing as c"; + $sql .= " WHERE type_element='$type_element'"; $sql .= " ORDER BY c.name"; dol_syslog ( get_class ( $this ) . "::".__METHOD__, LOG_DEBUG ); @@ -441,7 +442,7 @@ class FormAdvTargetEmailing extends Form $obj = $this->db->fetch_object ( $resql ); $label = $obj->name; if (empty($label)) { - $label=$obj->fk_mailing; + $label=$obj->fk_element; } if ($selected > 0 && $selected == $obj->rowid) { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 1f6c27a1c05..703ed95a1b2 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -3579,9 +3580,10 @@ class Propal extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -3600,7 +3602,7 @@ class Propal extends CommonObject $modelpath = "core/modules/propale/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 08860bc3c08..1a23c0b8728 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -488,7 +488,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $i = 0; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index bb8f6f623bb..cd49ca863e6 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -45,12 +45,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("propal"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 80b71c2a428..b0cea3318cb 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1959,7 +1959,6 @@ if ($action == 'create' && $user->rights->commande->creer) // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' // => 1), array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=3)'))); - // Paiement incomplet. On demande si motif = escompte ou autre $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneOrder'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ccdc03da9ab..a9970a95a51 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2016-2017 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -3677,9 +3678,10 @@ class Commande extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -3698,7 +3700,7 @@ class Commande extends CommonOrder $modelpath = "core/modules/commande/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 22d2e00a0c2..a63847421eb 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -526,7 +526,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 5381143d8ac..758a37eddb8 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -40,12 +40,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("orders"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index a262a63e045..e52e285742c 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -257,7 +257,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index aba6460d8e2..ceb9324961e 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -172,14 +172,10 @@ if ($resql) print ''; print "\n"; - $var=true; - while ($i < min($num,$conf->liste_limit)) { $obj = $db->fetch_object($resql); - - print ''; print ''; $thirdpartystatic->id=$obj->rowid; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 6f66352fe75..68a24a20933 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -12,7 +12,7 @@ * Copyright (C) 2013 Jean-Francois FERRY * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014-2018 Ferran Marcet * Copyright (C) 2015-2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -4324,7 +4324,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badcustomer' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'badcustomer') { @@ -4332,7 +4332,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; // $resteapayeraffiche=0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'product_returned') { @@ -4340,7 +4340,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == Facture::STATUS_CLOSED || $object->statut == Facture::STATUS_ABANDONED) && $object->close_code == 'abandon') { @@ -4351,7 +4351,7 @@ else if ($id > 0 || ! empty($ref)) print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); print '' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . ' '; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed @@ -4665,7 +4665,7 @@ else if ($id > 0 || ! empty($ref)) print '
'; } // For deposit invoice - if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && empty($discount->id)) + if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && $object->statut > 0 && empty($discount->id)) { print ''; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4d102e73377..71123d1c6e2 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1118,7 +1118,21 @@ class FactureRec extends CommonInvoice global $langs; $result=''; - $label=$langs->trans("ShowInvoice").': '.$this->ref; + + $label = '' . $langs->trans("ShowInvoice") . ''; + if (! empty($this->ref)) + $label .= '
'.$langs->trans('Ref') . ': ' . $this->ref; + if (! empty($this->date_last_gen)) + $label .= '
'.$langs->trans('DateLastGeneration') . ': ' . dol_print_date($this->date_last_gen, 'dayhour'); + if ($this->frequency > 0) + { + if (! empty($this->date_when)) + { + $label .= '
'.$langs->trans('NextDateToExecution') . ': '; + $label .= (empty($this->suspended)?'':''). dol_print_date($this->date_when, 'day').(empty($this->suspended)?'':''); // No hour for this property + if (! empty($this->suspended)) $label .= ' ('.$langs->trans("Disabled").')'; + } + } $url = DOL_URL_ROOT.'/compta/facture/fiche-rec.php?facid='.$this->id; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index ec8f1f67bdf..6719e7091c8 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -44,7 +44,7 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; // Load translation files required by the page -$langs->loadLangs(array('bills', 'compta', 'admin', 'other')); +$langs->loadLangs(array('bills', 'compta', 'admin', 'other', 'products')); $action = GETPOST('action','alpha'); $massaction = GETPOST('massaction','alpha'); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 87310d9b215..13db00a02c2 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -425,7 +425,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } @@ -434,7 +434,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle'); print ''; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9d3e87f2d3c..d5d320e6d32 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -79,7 +79,7 @@ $search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_localtax1=GETPOST('search_montant_localtax1','alpha'); $search_montant_localtax2=GETPOST('search_montant_localtax2','alpha'); $search_montant_ttc=GETPOST('search_montant_ttc','alpha'); -$search_status=GETPOST('search_status','int'); +$search_status=GETPOST('search_status','intcomma'); $search_paymentmode=GETPOST('search_paymentmode','int'); $search_town=GETPOST('search_town','alpha'); $search_zip=GETPOST('search_zip','alpha'); @@ -108,7 +108,7 @@ $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page; -if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == 1) $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; +if (! $sortorder && ! empty($conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER) && $search_status == '1') $sortorder=$conf->global->INVOICE_DEFAULT_UNPAYED_SORT_ORDER; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='f.datef'; $pageprev = $page - 1; @@ -442,12 +442,19 @@ if ($search_montant_localtax2 != '') $sql.= natural_search('f.localtax2', $searc if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; -if ($search_status != '' && $search_status >= 0) +if ($search_status != '') { - if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft - if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed - if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) - if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + if (is_numeric($search_status) && $search_status >= 0) + { + if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft + if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed + if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) + if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned + } + else + { + $sql.= " AND f.fk_statut IN (".$search_status.")"; // When search_status is '1,2' for example + } } if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$db->escape($search_paymentmode); if ($search_month > 0) @@ -457,7 +464,7 @@ if ($search_month > 0) else if ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $serch_year))."'"; else - $sql.= " AND date_format(f.datef, '%m') = '".$month."'"; + $sql.= " AND date_format(f.datef, '%m') = '".$search_month."'"; } else if ($search_year > 0) { @@ -633,7 +640,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } // If the user can view prospects other than his' @@ -730,7 +737,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print ''; } @@ -739,7 +746,7 @@ if ($resql) { print ''; if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print ''; - print ''; + print ''; $formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); print '
'.$langs->trans("Late"); print ''; @@ -854,7 +861,7 @@ if ($resql) if (! empty($arrayfields['f.fk_statut']['checked'])) { print ''; - $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); + $liststatus=array('0'=>$langs->trans("BillShortStatusDraft"), '1'=>$langs->trans("BillShortStatusNotPaid"), '2'=>$langs->trans("BillShortStatusPaid"), '1,2'=>$langs->trans("BillShortStatusNotPaid").'+'.$langs->trans("BillShortStatusPaid"), '3'=>$langs->trans("BillShortStatusCanceled")); print $form->selectarray('search_status', $liststatus, $search_status, 1); print ''; } diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 3964800fd2b..1a55771b963 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index 91056746565..5f224bc2026 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -39,15 +39,14 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> - > + trans("RepeatableInvoice"); ?> getNomUrl(1); ?> diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 0416fa875e0..09a528b1ce7 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -313,7 +313,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- print '
'; -// Last modified customer invoices +// Latest modified customer invoices if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { $langs->load("boxes"); @@ -323,7 +323,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.= ", f.date_lim_reglement as datelimite"; $sql.= ", s.nom as name"; $sql.= ", s.rowid as socid"; - $sql.= ", s.code_client, s.code_compta"; + $sql.= ", s.code_client, s.code_compta, s.email"; $sql.= ", sum(pf.amount) as am"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; @@ -338,7 +338,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $sql.=$hookmanager->resPrint; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,"; - $sql.= " s.nom, s.rowid, s.code_client, s.code_compta"; + $sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email"; $sql.= " ORDER BY f.tms DESC "; $sql.= $db->plimit($max, 0); @@ -374,6 +374,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $thirdpartystatic->id=$obj->socid; $thirdpartystatic->name=$obj->name; + $thirdpartystatic->email=$obj->email; $thirdpartystatic->client=1; $thirdpartystatic->code_client = $obj->code_client; //$thirdpartystatic->code_fournisseur = $obj->code_fournisseur; @@ -567,10 +568,8 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) print ''; if ($num) { - $var = true; $total_ttc = $totalam = $total = 0; - $var=true; while ($i < $num && $i < $max) { $objp = $db->fetch_object($result); @@ -631,7 +630,6 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $resql = $db->query($sql); if ( $resql ) { - $var = false; $num = $db->num_rows($resql); print ''; @@ -663,7 +661,6 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ''; $tot_ttc+=$obj->amount; - $var = !$var; $i++; } @@ -721,7 +718,6 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us $resql = $db->query($sql); if ( $resql ) { - $var=false; $num = $db->num_rows($resql); if ($num) @@ -837,7 +833,6 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $resql = $db->query($sql); if ($resql) { - $var=false; $num = $db->num_rows($resql); $i = 0; @@ -971,7 +966,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $resql=$db->query($sql); if ($resql) { - $var=false; $num = $db->num_rows($resql); print '
'; @@ -1022,7 +1016,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture- $total_ttc += $obj->total_ttc; $totalam += $obj->am; $i++; - $var = !$var; } print '
'; @@ -1056,7 +1049,6 @@ if ($resql) print '
'.$chargestatic->getLibStatut(3).'
'.$langs->trans("Total").'   ('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')
'; print ''.$langs->trans("TasksToDo").''; print "\n"; - $var = true; $i = 0; while ($i < $db->num_rows($resql)) { diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 6c9f8014e19..c2ce95dd827 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -589,7 +589,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print "\n"; - $var=true; $total=0; $totalrecu=0; $totalrecucreditnote=0; @@ -599,7 +598,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $objp = $db->fetch_object($resql); - $soc = new Societe($db); $soc->fetch($objp->socid); @@ -842,7 +840,6 @@ if (! GETPOST('action','aZ09')) { $num = $db->num_rows($resql); $i = 0; - $var=true; print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print '
 
'; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 8b71cf40064..539c70f591b 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Marcos García * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * 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 @@ -292,39 +293,40 @@ class Paiement extends CommonObject { $amount_ht = $amount_tva = $amount_ttc = array(); - // Loop on each vat rate - $i = 0; - foreach ($invoice->lines as $line) - { - if ($line->total_ht!=0) - { // no need to create discount if amount is null - $amount_ht[$line->tva_tx] += $line->total_ht; - $amount_tva[$line->tva_tx] += $line->total_tva; - $amount_ttc[$line->tva_tx] += $line->total_ttc; - $i ++; - } - } + // Insert one discount by VAT rate category + $discount = new DiscountAbsolute($this->db); + $discount->fetch('',$invoice->id); + if (empty($discount->id)) { // If the invoice was not yet converted into a discount (this may have been done manually before we come here) - // Insert one discount by VAT rate category - $discount = new DiscountAbsolute($this->db); - $discount->description = '(DEPOSIT)'; - $discount->fk_soc = $invoice->socid; - $discount->fk_facture_source = $invoice->id; - foreach ($amount_ht as $tva_tx => $xxx) - { - $discount->amount_ht = abs($amount_ht[$tva_tx]); - $discount->amount_tva = abs($amount_tva[$tva_tx]); - $discount->amount_ttc = abs($amount_ttc[$tva_tx]); - $discount->tva_tx = abs($tva_tx); + $discount->description = '(DEPOSIT)'; + $discount->fk_soc = $invoice->socid; + $discount->fk_facture_source = $invoice->id; - $result = $discount->create($user); - if ($result < 0) - { - $error++; - break; - } - } + // Loop on each vat rate + $i = 0; + foreach ($invoice->lines as $line) { + if ($line->total_ht != 0) { // no need to create discount if amount is null + $amount_ht[$line->tva_tx] += $line->total_ht; + $amount_tva[$line->tva_tx] += $line->total_tva; + $amount_ttc[$line->tva_tx] += $line->total_ttc; + $i++; + } + } + + foreach ($amount_ht as $tva_tx => $xxx) { + $discount->amount_ht = abs($amount_ht[$tva_tx]); + $discount->amount_tva = abs($amount_tva[$tva_tx]); + $discount->amount_ttc = abs($amount_ttc[$tva_tx]); + $discount->tva_tx = abs($tva_tx); + + $result = $discount->create($user); + if ($result < 0) { + $error++; + break; + } + } + } if ($error) { diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index cadf897c57f..fba8723d818 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -272,7 +272,6 @@ if ($action == 'create') print ''; print "\n"; - $var=true; $total=0; $totalrecu=0; @@ -280,8 +279,6 @@ if ($action == 'create') { $objp = $charge; - - print ''; if ($objp->date_ech > 0) @@ -325,7 +322,7 @@ if ($action == 'create') if ($i > 1) { // Print total - print ""; + print ''; print ''; print ""; print ""; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index b6e2ea26647..3a22666e2f7 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -129,7 +129,6 @@ if ($id > 0) $resql=$db->query($sql); if ($resql) { - $var=true; $num = $db->num_rows($resql); // Boucle sur chaque facture diff --git a/htdocs/compta/salaries/index.php b/htdocs/compta/salaries/index.php index 8b8d732e9b8..0b70275654f 100644 --- a/htdocs/compta/salaries/index.php +++ b/htdocs/compta/salaries/index.php @@ -140,7 +140,6 @@ if ($result) $num = $db->num_rows($result); $i = 0; $total = 0 ; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/compta/sociales/index.php b/htdocs/compta/sociales/index.php index c5f9cfcbead..bd323c972fe 100644 --- a/htdocs/compta/sociales/index.php +++ b/htdocs/compta/sociales/index.php @@ -137,7 +137,6 @@ if ($resql) { $num = $db->num_rows($resql); $i = 0; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 379abd7af09..3b7f68f8c83 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -158,12 +158,10 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $total = 0; $totalnb = 0; $totalpaye = 0; - $var=true; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); - $var = !$var; print ''; // Ref payment $payment_sc_static->id=$obj->pid; @@ -253,14 +251,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; @@ -355,14 +352,13 @@ while($j<$numlt) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; @@ -437,14 +433,13 @@ if (! empty($conf->salaries->enabled) && $user->rights->salaries->read) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print "\n"; - $var=1; + while ($i < $num) { $obj = $db->fetch_object($result); $total = $total + $obj->amount; - print ''; print ''."\n"; diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 78a9187be57..2c43db42d13 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -190,13 +190,15 @@ $namesup=$namecust; +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; // Show report header -$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByVatRate"); - if ($modecompta=="CREANCES-DETTES") { + $name=$langs->trans("Turnover").', '.$langs->trans("ByVatRate"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -206,14 +208,27 @@ if ($modecompta=="CREANCES-DETTES") { } $builddate=dol_now(); -} else { +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 5c2a50325a7..5d28ab3e077 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -158,12 +158,15 @@ llxHeader(); $form=new Form($db); $formother = new FormOther($db); -// Show report header -$name=$langs->trans("SalesTurnover").', '.$langs->trans("ByProductsAndServices"); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; +// Show report header if ($modecompta=="CREANCES-DETTES") { + $name=$langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { @@ -173,15 +176,29 @@ if ($modecompta=="CREANCES-DETTES") { } $builddate=dol_now(); -} else { +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); } +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + +} + $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; else $periodlink = ''; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 8b1e1f0f106..ccb286c1420 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -142,24 +142,40 @@ llxHeader(); $form=new Form($db); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; + // Show report header if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); + $name=$langs->trans("Turnover").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} else { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; @@ -328,7 +344,6 @@ print_liste_field_titre( 'align="center" width="20%"' ); print "\n"; -$var=true; if (count($amount)) { $arrayforsort=$name; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 1555b3c79ac..8e00dfe5fbe 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -167,25 +167,41 @@ $form=new Form($db); $thirdparty_static=new Societe($db); $formother = new FormOther($db); +// TODO Report from bookkeeping not yet available, so we switch on report on business events +if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; +if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; + // Show report header if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); + $name=$langs->trans("Turnover").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description=$langs->trans("RulesCADue"); if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.= $langs->trans("DepositsAreNotIncluded"); else $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} else { - $name=$langs->trans("SalesTurnover").', '.$langs->trans("ByThirdParties"); +} +else if ($modecompta=="RECETTES-DEPENSES") +{ + $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; $description=$langs->trans("RulesCAIn"); $description.= $langs->trans("DepositsAreIncluded"); $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); +} +else if ($modecompta=="BOOKKEEPING") +{ + + +} +else if ($modecompta=="BOOKKEEPINGCOLLECTED") +{ + + } $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; @@ -230,8 +246,8 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.=" AND cs.fk_soc is null"; } else if ($selected_cat) { // Into a specific category - $sql.= " AND (c.rowid = ".$selected_cat; - if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; + $sql.= " AND (c.rowid = ".$db->escape($selected_cat); + if ($subcat) $sql.=" OR c.fk_parent = " . $db->escape($selected_cat); $sql.= ")"; $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; } @@ -270,10 +286,10 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; } } -if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"'; -if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"'; -if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"'; -if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.''; +if (!empty($search_societe)) $sql.= natural_search('s.nom', $search_societe); +if (!empty($search_zip)) $sql.= natural_search('s.zip', $search_zip); +if (!empty($search_town)) $sql.= natural_search('s.town', $search_town); +if ($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.''; $sql.= " AND f.entity = ".$conf->entity; if ($socid) $sql.= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index dd24a6cd507..c255d236664 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -115,9 +115,9 @@ $form=new Form($db); // Affiche en-tete du rapport if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeDebt"); - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); @@ -129,10 +129,10 @@ if ($modecompta=="CREANCES-DETTES") } else if ($modecompta=="RECETTES-DEPENSES") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("TurnoverCollected"); $calcmode=$langs->trans("CalcModeEngagement"); - $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInBookkeepingMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCAIn"); @@ -142,10 +142,10 @@ else if ($modecompta=="RECETTES-DEPENSES") } else if ($modecompta=="BOOKKEEPING") { - $name=$langs->trans("SalesTurnover"); + $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeBookkeeping"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; + //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $period=$form->select_date($date_start,'date_start',0,0,0,'',1,0,1).' - '.$form->select_date($date_end,'date_end',0,0,0,'',1,0,1); $periodlink=($year_start?"".img_previous()."".img_next()."":""); $description=$langs->trans("RulesCATotalSaleJournal"); diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 97932d7b1ba..d835b0264e1 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -141,7 +141,6 @@ if ($result) $num = $db->num_rows($result); $i = 0; $total = 0 ; - $var=true; $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 7a5503d07ca..d837a6c6421 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -42,6 +42,7 @@ $massaction=GETPOST('massaction','alpha'); $show_files=GETPOST('show_files','int'); $confirm=GETPOST('confirm','alpha'); $toselect = GETPOST('toselect', 'array'); +$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contactlist'; // Security check $id = GETPOST('id','int'); @@ -81,8 +82,8 @@ if ($search_status=='') $search_status=1; // always display activ customer first $optioncss = GETPOST('optioncss','alpha'); -$type=GETPOST("type"); -$view=GETPOST("view"); +$type=GETPOST("type",'aZ'); +$view=GETPOST("view",'alpha'); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST('sortfield', 'alpha'); @@ -95,29 +96,28 @@ if (! $sortfield) $sortfield="p.lastname"; if (empty($page) || $page < 0) { $page = 0; } $offset = $limit * $page; -$contextpage='contactlist'; $titre = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); if ($type == "p") { - $contextpage='contactprospectlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactprospectlist'; $titre.=' ('.$langs->trans("ThirdPartyProspects").')'; $urlfiche="card.php"; } if ($type == "c") { - $contextpage='contactcustomerlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactcustomerlist'; $titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; $urlfiche="card.php"; } else if ($type == "f") { - $contextpage='contactsupplierlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactsupplierlist'; $titre.=' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche="card.php"; } else if ($type == "o") { - $contextpage='contactotherlist'; + if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactotherlist'; $titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; $urlfiche=""; } @@ -435,6 +435,7 @@ print ''; print ''; print ''; +print ''; print ''; print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies.png', 0, $newcardbutton, '', $limit); @@ -448,11 +449,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } if ($search_firstlast_only) { - print $langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname"); + print '
'.$langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname").'
'; } $moreforfilter=''; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d1b53e58495..d0120d130df 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -897,10 +897,7 @@ if (empty($reshook)) $cancelbutton = GETPOST('cancel','alpha'); if (!$cancelbutton) { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->oldcopy = dol_clone($object); $result = $object->setValueFrom('ref_supplier', GETPOST('ref_supplier','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { @@ -922,10 +919,7 @@ if (empty($reshook)) if (!$cancelbutton) { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessages($object->error, $object->errors, 'errors'); - } + $object->oldcopy = dol_clone($object); $result = $object->setValueFrom('ref_customer', GETPOST('ref_customer','alpha'), '', null, 'text', '', $user, 'CONTRACT_MODIFY'); if ($result < 0) { @@ -2153,13 +2147,28 @@ else if ($object->nbofservicesclosed > 0 || $object->nbofserviceswait > 0) { - print ''; + if ($user->rights->contrat->activer) + { + print ''; + } + else + { + print ''; + } } if ($object->nbofservicesclosed < $nbofservices) { + if ($user->rights->contrat->desactiver) + { + print ''; + } + else + { + print ''; + } + //if (! $numactive) //{ - print ''; //} //else //{ diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e32ebaff987..640793b7f37 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2015-2017 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -406,7 +407,10 @@ class Contrat extends CommonObject $this->fetch_thirdparty(); // A contract is validated so we can move thirdparty to status customer - $result=$this->thirdparty->set_as_client(); + if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION)) + { + $result=$this->thirdparty->set_as_client(); + } // Define new ref if ($force_number) @@ -674,14 +678,14 @@ class Contrat extends CommonObject } else { - dol_syslog(get_class($this)."::Fetch Erreur contrat non trouve"); + dol_syslog(get_class($this)."::fetch Contract not found"); $this->error="Contract not found"; return 0; } } else { - dol_syslog(get_class($this)."::Fetch Erreur lecture contrat"); + dol_syslog(get_class($this)."::fetch Error searching contract"); $this->error=$this->db->error(); return -1; } @@ -2303,9 +2307,10 @@ class Contrat extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -2324,7 +2329,7 @@ class Contrat extends CommonObject $modelpath = "core/modules/contract/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 49b35fdf7e1..18e78c7ff0a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -401,7 +401,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index c94be74b0b8..de44410e505 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -336,7 +336,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $morefilter = ''; @@ -531,7 +531,6 @@ print "\n"; $contractstatic=new Contrat($db); $productstatic=new Product($db); -$var=true; $i=0; $totalarray=array(); while ($i < min($num,$limit)) diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index a4b18716039..328be816327 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -39,12 +39,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("contracts"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?>
diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 394680f4d8e..c7cb1dc6f78 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -18,7 +18,7 @@ /** * \file htdocs/core/actions_addupdatedelete.inc.php - * \brief Code for common actions cancel / add / update / delete + * \brief Code for common actions cancel / add / update / delete / clone */ @@ -183,3 +183,36 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete)) else setEventMessages($object->error, null, 'errors'); } } + +// Action clone object +if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)) +{ + if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + { + setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); + } + else + { + if ($object->id > 0) + { + // Because createFromClone modifies the object, we must clone it so that we can restore it later + $orig = clone $object; + + $result=$object->createFromClone($user, $object->id); + if ($result > 0) + { + $newid = 0; + if (is_object($result)) $newid = $result->id; + else $newid = $result; + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object + exit; + } + else + { + setEventMessages($object->error, $object->errors, 'errors'); + $object = $orig; + $action=''; + } + } + } +} diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 59fe3385c61..cfff81749de 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -202,7 +202,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE print ''; + print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').''; // Add link //print ''; @@ -321,10 +321,8 @@ if (empty($conf->use_javascript_ajax) || ! empty($conf->global->MAIN_ECM_DISABLE $nbofentries=0; $oldvallevel=0; - $var=true; foreach($sqltree as $key => $val) { - $var=false; $ecmdirstatic->id=$val['id']; $ecmdirstatic->ref=$val['label']; diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index a293b5166a2..7ab2de66a7b 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -87,7 +87,10 @@ class box_clients extends ModeleBoxes $sql.= ", s.client"; $sql.= ", s.code_fournisseur"; $sql.= ", s.fournisseur"; + $sql.= ", s.code_compta"; + $sql.= ", s.code_compta_fournisseur"; $sql.= ", s.logo"; + $sql.= ", s.email"; $sql.= ", s.datec, s.tms, s.status"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -114,9 +117,12 @@ class box_clients extends ModeleBoxes $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; $thirdpartystatic->code_fournisseur = $objp->code_fournisseur; + $thirdpartystatic->code_compta = $objp->code_compta; + $thirdpartystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; $thirdpartystatic->client = $objp->client; $thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->logo = $objp->logo; + $thirdpartystatic->email = $objp->email; $this->info_box_contents[$line][] = array( 'td' => '', diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index f4bbe992590..58161aef6f5 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -657,6 +657,12 @@ class CMailFile } else if ($this->sendmode == 'smtps') { + if (! is_object($this->smtps)) + { + $this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Constructor of object CMailFile was not initialized without errors."; + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); + return false; + } // Use SMTPS library // ------------------------------------------ @@ -1061,7 +1067,9 @@ class CMailFile $strContentAltText = ''; if ($this->msgishtml) { - $strContentAltText = html_entity_decode(strip_tags($strContent)); + // Similar code to forge a text from html is also in CMailFile.class.php + $strContentAltText = preg_replace("/]*>/"," ", $strContent); + $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); $strContentAltText = rtrim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n")); // Check if html header already in message, if not complete the message diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f3e34486f9e..a165704c058 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1458,11 +1458,11 @@ abstract class CommonObject if ($trigkey) { // call trigger with updated object values - if (empty($this->fields) && method_exists($this, 'fetch')) + if (empty($this->fields) && method_exists($this, 'fetch')) { $result = $this->fetch($id); - } - else + } + else { $result = $this->fetchCommon($id); } @@ -3322,7 +3322,14 @@ abstract class CommonObject $langs->load("errors"); //print 'Found into table '.$table.', type '.$langs->transnoentitiesnoconv($elementname).', haschild='.$haschild; $haschild += $obj->nb; - $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + if (is_numeric($elementname)) // old usage + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $table); + } + else // new usage: $elementname=Translation key + { + $this->errors[]=$langs->trans("ErrorRecordHasAtLeastOneChildOfType", $langs->transnoentitiesnoconv($elementname)); + } break; // We found at least one, we stop here } } @@ -6140,6 +6147,7 @@ abstract class CommonObject $labeltoshow = $langs->trans($label); $out .= ''; // Date - print ''; + print ''; // 140px = width for date with PM format // Preview if (empty($useinecm)) @@ -1271,7 +1271,7 @@ class FormFile print ''; print ''; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b6108ca2f16..54bbbc837a1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -293,7 +293,6 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu if (empty($method) || $method == 3 || $method == 4) { - $relativepathstring = $_SERVER["PHP_SELF"]; // Clean $relativepathstring if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); @@ -303,21 +302,32 @@ function GETPOST($paramname, $check='none', $method=0, $filter=null, $options=nu //var_dump($user->default_values); // Code for search criteria persistence. - // Retrieve values if restore_lastsearch_values is set and there is saved values - if (! empty($_GET['restore_lastsearch_values']) && ! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // Keep $_GET here + // Retrieve values if restore_lastsearch_values + if (! empty($_GET['restore_lastsearch_values'])) // Use $_GET here and not GETPOST { - $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); - if (is_array($tmp)) + if (! empty($_SESSION['lastsearch_values_'.$relativepathstring])) // If there is saved values { - foreach($tmp as $key => $val) + $tmp=json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); + if (is_array($tmp)) { - if ($key == $paramname) + foreach($tmp as $key => $val) { - $out=$val; - break; + if ($key == $paramname) // We are on the requested parameter + { + $out=$val; + break; + } } } } + if (! empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) // If there is saved contextpage + { + if ($paramname == 'contextpage') + { + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; + //var_dump($paramname.' '.$out); + } + } } // Else, retreive default values if we are not doing a sort elseif (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set @@ -1387,17 +1397,20 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) { $objectref = dol_sanitizeFileName($object->ref); - $dir_output = $conf->$modulepart->multidir_output[$entity] . "/"; + $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/"; if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { - $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart).$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it here + $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart); + $subdir.= ((! empty($subdir) && ! preg_match('/\/$/',$subdir))?'/':'').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end } else { $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); } + if (empty($subdir)) $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path $filepath = $dir_output . $subdir . "/"; + $file = $filepath . $objectref . ".pdf"; $relativepath = $subdir.'/'.$objectref.'.pdf'; @@ -4059,10 +4072,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $options=preg_replace('/&+/i','&',$options); if (! preg_match('/^&/',$options)) $options='&'.$options; - //print " "; - //$sortimg.= ''; - //$sortimg.= ''; - if (! $sortorder || $field1 != $sortfield1) { //$out.= ''.img_down("A-Z",0).''; @@ -4081,8 +4090,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m $sortimg.= ''.img_down("A-Z",0).''; } } - - //$sortimg.= ''; } $out.=$sortimg; @@ -5331,7 +5338,9 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) // TODO // We will enhance here a common way of forging path for document storage // Here, object->id, object->ref and modulepart are required. - if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice','shipment','contract','expensereport'))) + //var_dump($modulepart); + if (in_array($modulepart, array('thirdparty','contact','member','propal','proposal','commande','order','facture','invoice', + 'supplier_order','supplier_proposal','shipment','contract','expensereport'))) { $path=($object->ref?$object->ref:$object->id); } @@ -5764,6 +5773,7 @@ function dol_textishtml($msg,$option=0) if (preg_match('//i',$msg)) return true; + elseif (preg_match('//i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i',$msg)) return true; elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i',$msg)) return true; diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index df97b133522..d56a7e2311c 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -87,6 +87,32 @@ function payment_supplier_prepare_head(Paiement $object) { return $head; } +/** + * Return array of valid payment mode + * + * @param string $paymentmethod Filter on this payment method + * @return array Array of valid payment method + */ +function getValidOnlinePaymentMethods($paymentmethod='') +{ + global $conf; + + $validpaymentmethod=array(); + + if ((empty($paymentmethod) || $paymentmethod == 'paypal') && ! empty($conf->paypal->enabled)) + { + $validpaymentmethod['paypal']='valid'; + } + if ((empty($paymentmethod) || $paymentmethod == 'paybox') && ! empty($conf->paybox->enabled)) + { + $validpaymentmethod['paybox']='valid'; + } + if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stripe->enabled)) + { + $validpaymentmethod['stripe']='valid'; + } + return $validpaymentmethod; +} /** * Return string with full Url diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 448d3d4870c..a6f19a68086 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -525,6 +525,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Setup $newmenu->add("/admin/index.php?mainmenu=home&leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', ''); + if ($usemenuhider || empty($leftmenu) || $leftmenu=="setup") { $langs->load("admin"); @@ -636,7 +637,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); + $newmenu->add("/societe/list.php?type=p&leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); /* no more required, there is a filter that can do more if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&sortfield=s.datec&sortorder=desc&begin=&search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); @@ -652,7 +653,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { $langs->load("commercial"); - $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); + $newmenu->add("/societe/list.php?type=c&leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers'); $newmenu->add("/societe/card.php?leftmenu=customers&action=create&type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer); //$newmenu->add("/contact/list.php?leftmenu=customers&type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); @@ -662,7 +663,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled)) { $langs->load("suppliers"); - $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); + $newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); $newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); } @@ -1061,7 +1062,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($objp->nature == 9) $nature="hasnew"; // To enable when page exists - if (! empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature=''; } @@ -1098,11 +1099,28 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/index.php?leftmenu=accountancy_report",$langs->trans("MenuReportInOut"),2,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/clientfourn.php?leftmenu=accountancy_report",$langs->trans("ByPredefinedAccountGroups"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/resultat/result.php?leftmenu=accountancy_report",$langs->trans("ByPersonalizedAccountGroups"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report",$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); - if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report", $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + + $modecompta='CREANCES-DETTES'; + if(! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta='BOOKKEEPING'; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ReportTurnover"),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } + + $modecompta='RECETTES-DEPENSES'; + //if (! empty($conf->accounting->enabled) && ! empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') $modecompta=''; // Not yet implemented. Should be BOOKKEEPINGCOLLECTED + if ($modecompta) + { + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/index.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ReportTurnoverCollected"),2,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); + if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report&modecompta=".$modecompta,$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); + //if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); + //if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/byratecountry.php?leftmenu=accountancy_report&modecompta=".$modecompta, $langs->trans("ByVatRate"),3,$user->rights->accounting->comptarapport->lire); + } } // Accountancy (simple) @@ -1581,7 +1599,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu } - // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after //var_dump($menu_array_before);exit; //var_dump($menu_array_after);exit; diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index f81d7d36c72..11f1de43a1f 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -111,7 +111,8 @@ class MenuManager /** - * Show menu + * Show menu. + * Module defined in sql tables are stored into this->tabMenu BEFORE this is called. * * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 7606f272f5b..14e0f6cc155 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -319,7 +319,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6+$height_incoterms; + $tab_top = $nexY+6; } } @@ -353,7 +353,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); - $tab_top = $nexY+6+$height_note; + $tab_top = $nexY+6; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index e1a7640ec62..9fa86d24a19 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -228,7 +228,7 @@ class pdf_strato extends ModelePDFContract $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); - $tab_top = $nexY+6+$height_note; + $tab_top = $nexY+6; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index f3bc84533ca..6c8fcf2f07e 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -384,7 +384,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1); - $tab_top = $nexY+6+$height_incoterms; + $tab_top = $nexY+6; } } @@ -418,7 +418,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetDrawColor(192,192,192); $pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_note+1); - $tab_top = $nexY+6+$height_note; + $tab_top = $nexY+6; } $iniY = $tab_top + 7; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index e1d3cd5861c..57a69475000 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018-2018 Andre Schild + * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This file is an example to follow to add your own email selector inside @@ -40,7 +41,8 @@ class mailing_thirdparties extends MailingTargets */ function __construct($db) { - global $conf; + global $conf, $langs; + $langs->load("companies"); $this->db=$db; } @@ -88,6 +90,51 @@ class mailing_thirdparties extends MailingTargets $sql.= " AND c.rowid = cs.fk_categorie"; $sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'"; } + + $addDescription= ""; + if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') + { + $sql.= " AND s.client=" . $_POST["filter_client"]; + $addDescription= $langs->trans('ProspectCustomer')."="; + if ($_POST["filter_client"] == 0) + { + $addDescription.= $langs->trans('NorProspectNorCustomer'); + } + else if ($_POST["filter_client"] == 1) + { + $addDescription.= $langs->trans('Customer'); + } + else if ($_POST["filter_client"] == 2) + { + $addDescription.= $langs->trans('Prospect'); + } + else if ($_POST["filter_client"] == 3) + { + $addDescription.= $langs->trans('ProspectCustomer'); + } + else + { + $addDescription.= "Unknown status ".$_POST["filter_client"]; + } + } + if (isset($_POST["filter_status"])) + { + if (strlen($addDescription) > 0) + { + $addDescription.= ";"; + } + $addDescription.= $langs->trans("Status")."="; + if ($_POST["filter_status"] == '1') + { + $sql.= " AND s.status=1"; + $addDescription.= $langs->trans("Enabled"); + } + else + { + $sql.= " AND s.status=0"; + $addDescription.= $langs->trans("Disabled"); + } + } $sql.= " ORDER BY email"; // Stock recipients emails into targets table @@ -106,12 +153,18 @@ class mailing_thirdparties extends MailingTargets $obj = $this->db->fetch_object($result); if ($old <> $obj->email) { + $otherTxt= ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''); + if (strlen($addDescription) > 0 && strlen($otherTxt) > 0) + { + $otherTxt.= ";"; + } + $otherTxt.= $addDescription; $cibles[$j] = array( 'email' => $obj->email, 'fk_contact' => $obj->fk_contact, 'lastname' => $obj->name, // For a thirdparty, we must use name 'firstname' => '', // For a thirdparty, lastname is '' - 'other' => ($obj->label?$langs->transnoentities("Category").'='.$obj->label:''), + 'other' => $otherTxt, 'source_url' => $this->url($obj->id), 'source_id' => $obj->id, 'source_type' => 'thirdparty' @@ -186,7 +239,7 @@ class mailing_thirdparties extends MailingTargets $langs->load("companies"); - $s=''; + $s=$langs->trans("Categories").': '; $s.=' '; + $s.= $langs->trans('ProspectCustomer'); + $s.=': '; + + $s.=$langs->trans("Status"); + $s.=': '; return $s; diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 786cfa1f756..08473f3cb6d 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -213,7 +213,7 @@ class mailing_thirdparties_services_expired extends MailingTargets { global $langs; - $s=''; + $s=$langs->trans("ProductOrService"); $s.='' . "\n"; + print '' . "\n"; + print '
'.$langs->trans("Amount").'
'.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."
'.dol_print_date($db->jdate($obj->dm),'day').'
'.dol_print_date($db->jdate($obj->dm),'day').'
'.dol_print_date($db->jdate($obj->dateep),'day').'
'.img_view($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle"').''.img_edit_add().''; if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$object->table_element]['help'][$key]); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 5d07b7f4619..264d3e9c236 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -311,25 +311,25 @@ class Conf // For user storage $this->user->multidir_output = array($this->entity => $rootfordata."/users"); - $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); + $this->user->multidir_temp = array($this->entity => $rootfordata."/users/temp"); // For backward compatibility $this->user->dir_output=$rootforuser."/users"; $this->user->dir_temp=$rootforuser."/users/temp"; - // UserGroup + // For usergroup storage $this->usergroup->dir_output=$rootforuser."/usergroups"; $this->usergroup->dir_temp=$rootforuser."/usergroups/temp"; - // For propal storage + // For proposal storage $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); - $this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp"); + $this->propal->multidir_temp = array($this->entity => $rootfordata."/propale/temp"); // For backward compatibility $this->propal->dir_output=$rootfordata."/propale"; $this->propal->dir_temp=$rootfordata."/propale/temp"; // For medias storage $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); - $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp"); + $this->medias->multidir_temp = array($this->entity => $rootfordata."/medias/temp"); // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. @@ -399,7 +399,7 @@ class Conf // Set some default values - + //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month $this->global->MAIN_ACTIVATE_HTML5=1; $this->global->MAIN_MAIL_USE_MULTI_PART=1; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 9d164325fd6..839528ddc20 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1717,7 +1717,7 @@ class ExtraFields } elseif ($type == 'password') { - $value=preg_replace('/./i','*',$value); + $value=dol_trunc(preg_replace('/./i','*',$value), 8, 'right', 'UTF-8', 1); } else { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 231b1461cc8..9a9d3279e03 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1052,7 +1052,7 @@ class Form * * @param string $selected Preselected type * @param string $htmlname Name of field in form - * @param string $filter optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') + * @param string $filter Optional filters criteras (example: 's.rowid <> x', 's.client in (1,3)') * @param string $showempty Add an empty field (Can be '1' or text to use on empty line like 'SelectThirdParty') * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use standard HTML select component without beautification @@ -1072,6 +1072,9 @@ class Form $num=0; $outarray=array(); + // Clean $filter that may contains sql conditions so sql code + if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3); + // On recherche les societes $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.client, s.fournisseur, s.code_client, s.code_fournisseur"; $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s"; @@ -1437,12 +1440,12 @@ class Form * @param int $disabled If select list must be disabled * @param array $include Array list of users id to include * @param int $enableonly Array list of users id to be enabled. All other must be disabled - * @param int $force_entity 0 or Id of environment to force + * @param string $force_entity '0' or Ids of environment to force * @return void * @deprecated Use select_dolusers instead * @see select_dolusers() */ - function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity=0) + function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity='0') { print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); } @@ -1457,7 +1460,7 @@ class Form * @param int $disabled If select list must be disabled * @param array|string $include Array list of users id to include or 'hierarchy' to have only supervised users or 'hierarchyme' to have supervised + me * @param array $enableonly Array list of users id to be enabled. If defined, it means that others will be disabled - * @param int $force_entity 0 or Id of environment to force + * @param string $force_entity '0' or Ids of environment to force * @param int $maxlength Maximum length of string into list (0=no limit) * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request (Example: 'employee = 1') @@ -1469,7 +1472,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0) + function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0) { global $conf,$user,$langs; @@ -1606,13 +1609,13 @@ class Form } if (! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) { - if ($obj->admin && ! $obj->entity) + if (! $obj->entity) { $out.=($moreinfo?' - ':' (').$langs->trans("AllEntities"); $moreinfo++; } else - { + { $out.=($moreinfo?' - ':' (').($obj->label?$obj->label:$langs->trans("EntityNameNotDefined")); $moreinfo++; } @@ -1656,7 +1659,7 @@ class Form * @param int $disabled If select list must be disabled * @param array $include Array list of users id to include or 'hierarchy' to have only supervised users * @param array $enableonly Array list of users id to be enabled. All other must be disabled - * @param int $force_entity 0 or Id of environment to force + * @param int $force_entity '0' or Ids of environment to force * @param int $maxlength Maximum length of string into list (0=no limit) * @param int $showstatus 0=show user status only if status is disabled, 1=always show user status into label, -1=never show user status * @param string $morefilter Add more filters into sql request @@ -1667,7 +1670,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity=0, $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) + function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) { global $conf, $user, $langs; @@ -6723,11 +6726,11 @@ class Form * @param int $disabled If select list must be disabled * @param string $include Array list of groups id to include * @param int $enableonly Array list of groups id to be enabled. All other must be disabled - * @param int $force_entity 0 or Id of environment to force + * @param string $force_entity '0' or Ids of environment to force * @return string * @see select_dolusers */ - function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity=0) + function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0') { global $conf,$user,$langs; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7ae9dc29e18..7c457accadf 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1200,7 +1200,7 @@ class FormFile print ''.dol_print_date($file['date'],"dayhour","tzuser").''.dol_print_date($file['date'],"dayhour","tzuser").''; if ($useinecm == 1) { - print ''.img_view('default', 0, 'class="paddingrightonly"').''; + print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } if (! $useinecm || $useinecm == 2) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 4dd07f13313..ffe22b580e7 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -917,7 +917,7 @@ class FormMail extends Form } // Complete substitution array with the url to make online payment - $paymenturl=''; + $paymenturl=''; $validpaymentmethod=array(); if (empty($this->substit['__REF__'])) { $paymenturl=''; @@ -926,16 +926,27 @@ class FormMail extends Form { // Set the online payment url link into __ONLINE_PAYMENT_URL__ key require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; - $langs->load('paypal'); + $langs->loadLangs(array('paypal','other')); $typeforonlinepayment='free'; if ($this->param["models"]=='order' || $this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template if ($this->param["models"]=='invoice' || $this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template if ($this->param["models"]=='member') $typeforonlinepayment='member'; // TODO use detection on something else than template $url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']); $paymenturl=$url; + + $validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); + } + + if (count($validpaymentmethod) > 0 && $paymenturl) + { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=str_replace('\n',"\n",$langs->transnoentities("PredefinedMailContentLink", $paymenturl)); + $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; + } + else + { + $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=''; + $this->substit['__ONLINE_PAYMENT_URL__']=''; } - $this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$langs->trans("PredefinedMailContentLink", $paymenturl):''); - $this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl; //Add lines substitution key from each line $lines = ''; @@ -952,7 +963,7 @@ class FormMail extends Form $defaultmessage=str_replace('\n',"\n",$defaultmessage); // Deal with format differences between message and signature (text / HTML) - if(dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { + if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']); } else if(!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index fcc2ddf049c..098b75a81b6 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -165,7 +165,7 @@ class FormOther { global $langs; - $sql = "SELECT e.rowid, e.code, e.libelle, e.price, e.organization,"; + $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,"; $sql.= " c.label as country"; $sql.= " FROM ".MAIN_DB_PREFIX."c_ecotaxe as e,".MAIN_DB_PREFIX."c_country as c"; $sql.= " WHERE e.active = 1 AND e.fk_pays = c.rowid"; @@ -191,7 +191,7 @@ class FormOther else { print ''; $j=0; $level=0; @@ -569,6 +571,7 @@ class FormOther if ($disabled) print ' disabled'; print '>'; print $langs->trans("Project").' '.$lines[$i]->projectref; + print ' '.$lines[$i]->projectlabel; if (empty($lines[$i]->public)) { print ' ('.$langs->trans("Visibility").': '.$langs->trans("PrivateProject").')'; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 417f175422f..ffa9dafdfbe 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1360,7 +1360,9 @@ class SMTPs $strContentAltText = ''; if ($strType == 'html') { - $strContentAltText = html_entity_decode(strip_tags($strContent)); + // Similar code to forge a text from html is also in CMailFile.class.php + $strContentAltText = preg_replace("/]*>/"," ", $strContent); + $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); $strContentAltText = rtrim(wordwrap($strContentAltText, 75, "\r\n")); } @@ -1828,9 +1830,12 @@ class SMTPs { $_errMsg = array(); - foreach ( $this->_smtpsErrors as $_err => $_info ) + if (is_array($this->_smtpsErrors)) { - $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg']; + foreach ( $this->_smtpsErrors as $_err => $_info ) + { + $_errMsg[] = 'Error [' . $_info['num'] .']: '. $_info['msg']; + } } return implode("\n", $_errMsg); diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 3b49482a217..ef870095325 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -203,7 +203,7 @@ if (! class_exists('MenuManager')) } } $menumanager = new MenuManager($db, empty($user->societe_id)?0:1); -$menumanager->loadMenu('all','all'); +$menumanager->loadMenu('all','all'); // Load this->tabMenu with sql menu entries //var_dump($menumanager);exit; $menumanager->showmenu('jmobile'); diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 20139450a1a..450c294f19e 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -420,7 +420,7 @@ function societe_admin_prepare_head() * @param Translate $outputlangs Langs object for output translation * @param int $entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output * @param int $searchlabel Label of country to search (warning: searching on label is not reliable) - * @return mixed String with country code or translated country name or Array('id','code','label') + * @return mixed Integer with country id or String with country code or translated country name or Array('id','code','label') or 'NotDefined' */ function getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='') { @@ -1752,7 +1752,7 @@ function show_subsidiaries($conf,$langs,$db,$object) $i=-1; - $sql = "SELECT s.rowid, s.nom as name, s.address, s.zip, s.town, s.code_client, s.canvas"; + $sql = "SELECT s.rowid, s.client, s.fournisseur, s.nom as name, s.name_alias, s.email, s.address, s.zip, s.town, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= " WHERE s.parent = ".$object->id; $sql.= " AND s.entity IN (".getEntity('societe').")"; @@ -1780,12 +1780,22 @@ function show_subsidiaries($conf,$langs,$db,$object) { $obj = $db->fetch_object($result); + $socstatic->id = $obj->rowid; + $socstatic->name = $obj->name; + $socstatic->name_alias = $obj->name_alias; + $socstatic->email = $obj->email; + $socstatic->code_client = $obj->code_client; + $socstatic->code_fournisseur = $obj->code_client; + $socstatic->code_compta = $obj->code_compta; + $socstatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + $socstatic->email = $obj->email; + $socstatic->canvas = $obj->canvas; + $socstatic->client = $obj->client; + $socstatic->fournisseur = $obj->fournisseur; + print '
'; - $socstatic->id = $obj->rowid; - $socstatic->name = $obj->name; - $socstatic->canvas = $obj->canvas; print $socstatic->getNomUrl(1); print '
' . "\n"; + + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + + print '' . "\n"; + + print '' . "\n"; + + // Customer name + print '' . "\n"; + + // Code Client + print '' . "\n"; + + // Address Client + print '' . "\n"; + + // Zip Client + print '' . "\n"; + + // City Client + print '' . "\n"; + + // Customer Country + print '' . "\n"; + + // State Customer + print '' . "\n"; + + // Mother Company + print '' . "\n"; + + // Prospect/Customer + $selected = $array_query['cust_typecust']; + print '' . "\n"; + + // Prospection status + print '' . "\n"; + + // Prospection comm status + print '' . "\n"; + + // Customer Type + print '' . "\n"; + + // Staff number + print '' . "\n"; + + // Sales manager + print '' . "\n"; + + // Customer Default Langauge + if (! empty($conf->global->MAIN_MULTILANGS)) { + + print '' . "\n"; + } + + if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . "\n"; + } + + // Standard Extrafield feature + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label('societe'); + foreach ( $extralabels as $key => $val ) { + if ($key != 'ts_nameextra' && $key != 'ts_payeur') { + print '' . "\n"; + } + } + } else { + $std_soc = new Societe($db); + $action_search = 'query'; + + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context + include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + $hookmanager = new HookManager($db); + $hookmanager->initHooks(array ('thirdpartycard')); + + $parameters=array(); + if (! empty($advTarget->id)) { + $parameters = array('array_query' => $advTarget->filtervalue); + } + // Other attributes + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $std_soc, $action_search); + print $hookmanager->resPrint; + } + + // State Contact + print '' . "\n"; + + // Civility + print ''; + + // contact name + print '' . "\n"; + print '' . "\n"; + + // Contact Country + print '' . "\n"; + + // Never send mass mailing + print '' . "\n"; + + // Contact Date Create + print '' . "\n"; + + // Contact update Create + print '' . "\n"; + + if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + // Customer Categories + print '' . "\n"; + } + + // Standard Extrafield feature + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + // fetch optionals attributes and labels + dol_include_once('/core/class/extrafields.class.php'); + $extrafields = new ExtraFields($db); + $extralabels = $extrafields->fetch_name_optionals_label('socpeople'); + foreach($extrafields->attribute_type as $key=>&$value) { + if($value == 'radio')$value = 'select'; + } + + + foreach ( $extralabels as $key => $val ) { + + print '' . "\n"; + } + } + + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '
' . "\n"; + + print '' . "\n"; + + print '
' . $langs->trans('AdvTgtNameTemplate') . ''; + if (! empty($template_id)) { + $default_template = $template_id; + } else { + $default_template = $advTarget->id; + } + print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template); + print ''; + print ''; + print ''; + print $langs->trans('AdvTgtOrCreateNewFilter'); + print ''; + print ''; + print '' . "\n"; + print '
' . $langs->trans('AdvTgtTypeOfIncude') . ''; + print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']); + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help'); + print '
' . $langs->trans('ThirdPartyName'); + if (! empty($array_query['cust_name'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('CustomerCode'); + if (! empty($array_query['cust_code'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Address'); + if (! empty($array_query['cust_adress'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Zip'); + if (! empty($array_query['cust_zip'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Town'); + if (! empty($array_query['cust_city'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans("Country"); + if (count($array_query['cust_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']); + print '' . "\n"; + print '
' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty'); + if (count($array_query['cust_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('cust_status', array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), $array_query['cust_status']); + print '' . "\n"; + print '
' . $langs->trans("Maison mère"); + if (! empty($array_query['cust_mothercompany'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty'); + if (count($array_query['cust_typecust']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + $options_array = array ( + 2 => $langs->trans('Prospect'), + 3 => $langs->trans('ProspectCustomer'), + 1 => $langs->trans('Customer'), + 0 => $langs->trans('NorProspectNorCustomer') + ); + print $formadvtargetemaling->advMultiselectarray('cust_typecust', $options_array, $array_query['cust_typecust']); + print '' . "\n"; + print '
' . $langs->trans('ProspectLevel'); + if (count($array_query['cust_prospect_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1); + print '' . "\n"; + print '
' . $langs->trans('StatusProsp'); + if (count($array_query['cust_comm_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']); + print '' . "\n"; + print '
' . $langs->trans("ThirdPartyType"); + if (count($array_query['cust_typeent']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']); + print '' . "\n"; + print '
' . $langs->trans("Staff"); + if (count($array_query['cust_effectif_id']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']); + print '' . "\n"; + print '
' . $langs->trans("SalesRepresentatives"); + if (count($array_query['cust_saleman']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user); + print '' . "\n"; + print '
' . $langs->trans("DefaultLang"); + if (count($array_query['cust_language']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']); + print '' . "\n"; + print '
' . $langs->trans("CustomersCategoryShort"); + if (count($array_query['cust_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']); + print '' . "\n"; + print '
' . $extrafields->attribute_label[$key]; + if (! empty($array_query['options_' . $key]) || (is_array($array_query['options_' . $key]) && count($array_query['options_' . $key]) > 0)) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { + + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date('', 'options_' . $key . '_st_dt'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date('', 'options_' . $key . '_end_dt'); + print '
'; + + print '
' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'boolean')) { + print $form->selectarray('options_' . $key, array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['options_' . $key]); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]); + print '' . "\n"; + } else { + + print ''; + print '
'; + if (is_array($array_query['options_' . $key])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key])); + } else { + print $extrafields->showInputField($key, $array_query['options_' . $key]); + } + print '
'; + + print '
' . "\n"; + } + print '
' . $langs->trans('Status') . ' ' . $langs->trans('Contact'); + if (count($array_query['contact_status']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->advMultiselectarray('contact_status', array ( + '0' => $langs->trans('ActivityCeased'), + '1' => $langs->trans('InActivity') + ), $array_query['contact_status']); + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help'); + print '
' . $langs->trans("UserTitle"); + if (count($array_query['contact_civility']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname'); + if (! empty($array_query['contact_lastname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname'); + if (! empty($array_query['contact_firstname'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("Country"); + if (count($array_query['contact_country']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']); + print '' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email"); + if (! empty($array_query['contact_no_email'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $form->selectarray('contact_no_email', array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['contact_no_email']); + print '' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation"); + if (! empty($array_query['contact_create_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1); + print '
'; + print '
' . "\n"; + print '
' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification"); + if (! empty($array_query['contact_update_st_dt'])) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1); + print '
'; + print '
' . "\n"; + print '
' . $langs->trans("ContactCategoriesShort"); + if (count($array_query['contact_categ']) > 0) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print '' . "\n"; + print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']); + print '' . "\n"; + print '
' . $extrafields->attribute_label[$key]; + if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) { + print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing'); + } + print ''; + if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) { + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) { + print $langs->trans("AdvTgtMinVal") . ''; + print $langs->trans("AdvTgtMaxVal") . ''; + print '' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { + + print ''; + print '
' . $langs->trans("AdvTgtStartDt") . ''; + print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct'); + print '' . $langs->trans("AdvTgtEndDt") . ''; + print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct'); + print '
'; + + print '
' . "\n"; + print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); + } elseif (($extrafields->attribute_type[$key] == 'boolean')) { + print $form->selectarray('options_' . $key . '_cnct', array ( + '' => '', + '1' => $langs->trans('Yes'), + '0' => $langs->trans('No') + ), $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'select')) { + print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } elseif (($extrafields->attribute_type[$key] == 'sellist')) { + print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']); + print '' . "\n"; + } else { + + print ''; + print '
'; + if (is_array($array_query['options_' . $key . '_cnct'])) { + print $extrafields->showInputField($key, implode(',', $array_query['options_' . $key . '_cnct']), '', '_cnct'); + } else { + print $extrafields->showInputField($key, $array_query['options_' . $key . '_cnct'], '', '_cnct'); + } + print '
'; + + print '
' . "\n"; + } + print '
' . "\n"; + + print '' . "\n"; + + print '
' . "\n"; + print '' . "\n"; + print '
' . "\n"; + + print '
'; + print ''; + print_titre($langs->trans("ToClearAllRecipientsClickHere")); + print ''; + print ''; + print ''; + print ''; + print '
'; + print '
'; + print '
'; \ No newline at end of file diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 0ecf01f9dd1..a6e895d5fed 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -78,7 +78,6 @@ if ($permission) {  
- - -
"> +
trans("User"); ?> trans("ThirdPartyContact"); ?> diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index dca4578e4a8..7253474c36b 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -90,11 +90,11 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] else { print ''; - print ''; + print ''; print ''; print ''; print 'attributes[$object->table_element]['required'][$key])) print ' fieldrequired'; print '">'; @@ -129,7 +129,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] print ''; $html_id = !empty($object->id) ? $object->element.'_extras_'.$key.'_'.$object->id : ''; - print ''; print ''; // Status diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 6c1e3b7efbc..1e7d93302d8 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -160,7 +160,7 @@ if ($resql) if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } print '
'; diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index fe4197dbc15..d1cfaa6f0ad 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -249,7 +249,6 @@ if (GETPOST('action','aZ09') == 'create') print '
'; print "\n"; - $var=true; $total=0; $totalrecu=0; @@ -257,8 +256,6 @@ if (GETPOST('action','aZ09') == 'create') { $objp = $don; - - print ''; print '"; @@ -288,7 +285,7 @@ if (GETPOST('action','aZ09') == 'create') if ($i > 1) { // Print total - print ""; + print ''; print ''; print ""; print ""; diff --git a/htdocs/don/tpl/linkedobjectblock.tpl.php b/htdocs/don/tpl/linkedobjectblock.tpl.php index fdf6ae71c2f..d7ad6587845 100644 --- a/htdocs/don/tpl/linkedobjectblock.tpl.php +++ b/htdocs/don/tpl/linkedobjectblock.tpl.php @@ -33,12 +33,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("donations"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index c9e86e95619..ab860ced2e9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -503,12 +503,16 @@ if (empty($reshook)) } // Action update - else if ($action == 'settracking_number' || $action == 'settracking_url' - || $action == 'settrueWeight' - || $action == 'settrueWidth' - || $action == 'settrueHeight' - || $action == 'settrueDepth' - || $action == 'setshipping_method_id') + else if ( + ($action == 'settracking_number' + || $action == 'settracking_url' + || $action == 'settrueWeight' + || $action == 'settrueWidth' + || $action == 'settrueHeight' + || $action == 'settrueDepth' + || $action == 'setshipping_method_id') + && $user->rights->expedition->creer + ) { $error=0; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index fd49a6b3ac2..4042b202300 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2014-2017 Francis Appels * Copyright (C) 2015 Claudio Aschieri * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2216,9 +2217,10 @@ class Expedition extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs,$hidedetails=0, $hidedesc=0, $hideref=0,$moreparams=null) { global $conf,$langs; @@ -2239,7 +2241,7 @@ class Expedition extends CommonObject $this->fetch_origin(); - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 99b44e72fc1..14f9eb41f44 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -298,7 +298,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/expedition/tpl/linkedobjectblock.tpl.php b/htdocs/expedition/tpl/linkedobjectblock.tpl.php index dacf9417313..72abfe2c4d9 100644 --- a/htdocs/expedition/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expedition/tpl/linkedobjectblock.tpl.php @@ -38,12 +38,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("sendings"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?>
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index f2594f85f82..141260d36f3 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1355,7 +1355,7 @@ if ($action == 'create') if (GETPOST('fk_user_author', 'int') > 0) $defaultselectuser=GETPOST('fk_user_author', 'int'); $include_users = 'hierarchyme'; if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expensereport->writeall_advance)) $include_users=array(); - $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users); + $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); print $s; print ''; print ''; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index d9a79789298..b7c81c4d33a 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2015 Laurent Destailleur * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2146,9 +2147,10 @@ class ExpenseReport extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -2167,7 +2169,7 @@ class ExpenseReport extends CommonObject $modelpath = "core/modules/expensereport/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** @@ -2423,7 +2425,7 @@ class ExpenseReportLine $sql.= ' ctf.code as type_fees_code, ctf.label as type_fees_libelle,'; $sql.= ' pjt.rowid as projet_id, pjt.title as projet_title, pjt.ref as projet_ref'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expensereport_det as fde'; - $sql.= ' INNER JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id'; + $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as ctf ON fde.fk_c_type_fees=ctf.id'; // Sometimes type of expense report has been removed, so we use a left join here. $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as pjt ON fde.fk_projet=pjt.rowid'; $sql.= ' WHERE fde.rowid = '.$rowid; diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 0caf115690d..70a7f8158fc 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -488,7 +488,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; @@ -536,7 +536,7 @@ if ($resql) if (! empty($arrayfields['d.date_debut']['checked'])) { print '
'; } @@ -544,7 +544,7 @@ if ($resql) if (! empty($arrayfields['d.date_fin']['checked'])) { print ''; } @@ -644,7 +644,6 @@ if ($resql) if ($num > 0) { $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 8a662c83dcf..050318944d6 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -80,7 +80,6 @@ class Export dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); - $var=true; $i=0; // Define list of modules directories into modulesdir @@ -595,8 +594,6 @@ class Export // Genere ligne de titre $objmodel->write_title($this->array_export_fields[$indice],$array_selected,$outputlangs,$this->array_export_TypeFields[$indice]); - $var=true; - while ($obj = $this->db->fetch_object($resql)) { // Process special operations diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 0a0d225e750..6d65418be3c 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -585,12 +585,10 @@ if ($step == 2 && $datatoexport) // $this->array_export_entities[0]=$module->export_fields_entities[$r]; // $this->array_export_alias[0]=$module->export_fields_alias[$r]; - $var=true; $i = 0; foreach($fieldsarray as $code=>$label) { - print ''; $i++; @@ -779,7 +777,6 @@ if ($step == 3 && $datatoexport) // Select request if all fields are selected $sqlmaxforexport=$objexport->build_sql(0, array(), array()); - $var=true; $i = 0; // on boucle sur les champs foreach($fieldsarray as $code => $label) @@ -977,7 +974,6 @@ if ($step == 4 && $datatoexport) //print ''; print ''; - $var=true; foreach($array_selected as $code=>$value) { print ''; @@ -1074,7 +1070,7 @@ if ($step == 4 && $datatoexport) print ''; print ''; print ''; - $var=false; + print ''; print '
'; + print ''; // Convert date into timestamp format if (in_array($extrafields->attributes[$object->table_element]['type'][$key], array('date','datetime'))) diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 1603d3ff001..aff342191cb 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -36,7 +36,6 @@ else if( (array) $linked_resources && count($linked_resources) > 0) { - $var=true; foreach ($linked_resources as $linked_resource) { @@ -48,7 +47,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($mode == 'edit' && $linked_resource['rowid'] == GETPOST('lineid')) { - print ''; + print ''; print ''; print ''; print ''; @@ -68,7 +67,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) if ($linked_resource['rowid'] == GETPOST('lineid')) $style='style="background: orange;"'; - print ''; + print ''; print '
'; print $object_resource->getNomUrl(1); @@ -102,7 +101,7 @@ if( (array) $linked_resources && count($linked_resources) > 0) } else { - print ''; + print ''; print '
'.$langs->trans('NoResourceLinked').'
'; print '
'; print '
'; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 9d07ee2aa33..238bd17d5c5 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -519,7 +519,11 @@ if ($num > 0) print '
'; - if(!empty($obj->datenextrun)) {print dol_print_date($db->jdate($obj->datenextrun),'dayhour');} + if(!empty($obj->datenextrun)) { + if (empty($obj->status)) print ''; + print dol_print_date($db->jdate($obj->datenextrun),'dayhour'); + if (empty($obj->status)) print ''; + } print ''.$langs->trans("Amount").'
'.price($objp->amount)."
'.$langs->trans("Total").':".price($total_ttc)."".price($totalrecu)."
'; - print ''; + print ''; $formother->select_year($year_start,'year_start',1, $min_year, $max_year); print ''; - print ''; + print ''; $formother->select_year($year_end,'year_end',1, $min_year, $max_year); print '
'.$langs->trans("FieldsTitle").'
'.$langs->trans("ExportModelName").' 
'; print ''; @@ -1091,10 +1087,8 @@ if ($step == 4 && $datatoexport) { $num = $db->num_rows($resql); $i = 0; - $var=false; while ($i < $num) { - $obj = $db->fetch_object($resql); print '
'; print $obj->label; @@ -1229,8 +1223,7 @@ if ($step == 5 && $datatoexport) print $langs->trans("NowClickToGenerateToBuildExportFile").'
'; - // Liste des formats d'exports disponibles - $var=true; + // List of available export formats print ''; print ''; print ''; @@ -1248,7 +1241,6 @@ if ($step == 5 && $datatoexport) unset($liste[$key]); } - print ''; print ''; print ''; //print ''; print ''; -$var=true; if (count($export->array_export_code)) { foreach ($export->array_export_code as $key => $value) @@ -94,11 +93,11 @@ if (count($export->array_export_code)) { if ($user->rights->export->creer) { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } else { - print ''.$langs->trans("NewExport").''; + print ''.$langs->trans("NewExport").''; } /* print ''; //print '
'; -// List of available export format -$var=true; +// List of available export formats print '
'.$langs->trans("AvailableFormats").'
'.img_picto_common($key,$objmodelexport->getPictoForKey($key)).' '; $text=$objmodelexport->getDriverDescForKey($key); diff --git a/htdocs/exports/index.php b/htdocs/exports/index.php index 01a663dc484..bccf25f1be8 100644 --- a/htdocs/exports/index.php +++ b/htdocs/exports/index.php @@ -60,7 +60,6 @@ print ''.$langs->trans("Module").''.$langs->trans("ExportableDatas").' 
'; print ''; print ''; @@ -125,7 +123,6 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/export/modules_export.php'; $model=new ModeleExports($db); $liste=$model->liste_modeles($db); // This is not a static method for exports because method load non static properties -$var=true; foreach($liste as $key => $val) { if (preg_match('/__\(Disabled\)__/',$liste[$key])) @@ -133,7 +130,6 @@ foreach($liste as $key => $val) $liste[$key]=preg_replace('/__\(Disabled\)__/','('.$langs->transnoentitiesnoconv("Disabled").')',$liste[$key]); } - print ''; print ''; $text=$model->getDriverDescForKey($key); diff --git a/htdocs/externalsite/admin/externalsite.php b/htdocs/externalsite/admin/externalsite.php index d76c23e11b0..6e585921ddb 100644 --- a/htdocs/externalsite/admin/externalsite.php +++ b/htdocs/externalsite/admin/externalsite.php @@ -92,8 +92,6 @@ print ""; print ""; print ""; -$var=true; - print ''; print '"; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index b0d085838a8..15b75495c38 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1403,7 +1403,6 @@ else if ($id > 0 || ! empty($ref)) print ''; print "\n"; } - $var=true; while ($i < $num) { $objp = $db->fetch_object($resql); diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 60369f1acb7..370fed20768 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2011-2013 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Charlie Benke + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -575,9 +576,10 @@ class Fichinter extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$langs; @@ -596,7 +598,7 @@ class Fichinter extends CommonObject $modelpath = "core/modules/fichinter/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref,$moreparams); } /** @@ -697,10 +699,12 @@ class Fichinter extends CommonObject $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip"'; + /* $hookmanager->initHooks(array('fichinterdao')); $parameters=array('id'=>$this->id); $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ } $linkstart = 'ref; $result .= $linkend; + global $action; + $hookmanager->initHooks(array('intervnetiondao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + return $result; } diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 474c6774f26..6b8ce71bfb5 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -143,7 +143,6 @@ if ($resql) print ''; } - $var=true; $bool=false; foreach ($listofstatus as $status) { @@ -198,10 +197,8 @@ if (! empty($conf->ficheinter->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print ''; print ''; @@ -319,10 +314,8 @@ if (! empty($conf->ficheinter->enabled)) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print ''; print ''; print ''; $oldyear=0; -$var=true; foreach ($data as $val) { $year = $val['year']; @@ -293,7 +292,7 @@ foreach ($data as $val) { // If we have empty year $oldyear--; - print ''; + print ''; print ''; print ''; @@ -306,7 +305,7 @@ foreach ($data as $val) } - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php index dca78609c61..8bed3f28fe2 100644 --- a/htdocs/fichinter/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fichinter/tpl/linkedobjectblock.tpl.php @@ -36,12 +36,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("interventions"); $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 3ba0089070c..dece376cc5a 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index b1a82c6c97b..dfceb8d4e73 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -8,6 +8,7 @@ * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -1568,6 +1569,7 @@ class CommandeFournisseur extends CommonOrder } $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx,$pu_ht_devise); + $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -2810,9 +2812,10 @@ class CommandeFournisseur extends CommonOrder * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $langs; @@ -2831,7 +2834,7 @@ class CommandeFournisseur extends CommonOrder $modelpath = "core/modules/supplier_order/pdf/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** @@ -3280,10 +3283,10 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'":"null"); $sql.= ", ".($this->fk_multicurrency ? $this->fk_multicurrency : "null"); $sql.= ", '".$this->db->escape($this->multicurrency_code)."'"; - $sql.= ", ".price2num($this->multicurrency_subprice); - $sql.= ", ".price2num($this->multicurrency_total_ht); - $sql.= ", ".price2num($this->multicurrency_total_tva); - $sql.= ", ".price2num($this->multicurrency_total_ttc); + $sql.= ", ".($this->multicurrency_subprice ? price2num($this->multicurrency_subprice) : '0'); + $sql.= ", ".($this->multicurrency_total_ht ? price2num($this->multicurrency_total_ht) : '0'); + $sql.= ", ".($this->multicurrency_total_tva ? price2num($this->multicurrency_total_tva) : '0'); + $sql.= ", ".($this->multicurrency_total_ttc ? price2num($this->multicurrency_total_ttc) : '0'); $sql.= ")"; dol_syslog(get_class($this)."::insert", LOG_DEBUG); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b10be70dd40..8ce8b796892 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Bahfir Abbes * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2467,9 +2468,10 @@ class FactureFournisseur extends CommonInvoice * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, 0 if nothing done, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $user, $langs; @@ -2496,7 +2498,7 @@ class FactureFournisseur extends CommonInvoice { $modelpath = "core/modules/supplier_invoice/pdf/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index b9a2f72b9bd..050d2867cf4 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -434,8 +434,9 @@ class ProductFournisseur extends Product function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { global $conf; - $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.fk_availability,"; - $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; // , pfp.recuperableonly as fourn_tva_npr"; FIXME this field not exist in llx_product_fournisseur_price + + $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.info_bits as fourn_tva_npr, pfp.fk_availability,"; + $sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,"; $sql.= " pfp.supplier_reputation"; $sql.= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code"; $sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; @@ -462,8 +463,7 @@ class ProductFournisseur extends Product $this->fourn_remise = $obj->remise; $this->fourn_unitprice = $obj->unitprice; $this->fourn_tva_tx = $obj->tva_tx; - // TODO - // $this->fourn_tva_npr = $obj->fourn_tva_npr; // TODO this field not exist in llx_product_fournisseur_price. We should add it ? + $this->fourn_tva_npr = $obj->fourn_tva_npr; // Add also localtaxes $this->fk_availability = $obj->fk_availability; $this->delivery_time_days = $obj->delivery_time_days; diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index fd794758330..49a24acf72b 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2010-2011 Juanjo Menent * Copyright (C) 2014 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -698,9 +699,10 @@ class PaiementFourn extends Paiement * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int <0 if KO, 0 if nothing done, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $user, $langs; @@ -727,7 +729,7 @@ class PaiementFourn extends Paiement { $modelpath = "core/modules/supplier_payment/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 29a9d21cc54..9a527ec1b2b 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -365,20 +365,33 @@ if (empty($reshook)) $productsupplier = new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); // Load product from its ID + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -394,15 +407,18 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $pu = $productsupplier->fourn_pu; + if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu, $qty, $tva_tx, $localtax1_tx, @@ -2444,7 +2460,8 @@ elseif (! empty($object->id)) print '
'.$langs->trans("AvailableFormats").'
'.img_picto_common($model->getDriverLabelForKey($key),$model->getPictoForKey($key)).'".$langs->trans("Value")."".$langs->trans("Examples")."
'.$langs->trans("Label")." 
'; @@ -248,10 +245,8 @@ if ($resql) if ($num) { $i = 0; - $var = true; while ($i < $num) { - $obj = $db->fetch_object($resql); print '
'; diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9b054e66545..96a1199255c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -306,7 +306,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/fichinter/stats/index.php b/htdocs/fichinter/stats/index.php index b00b1391003..7a68bef34ec 100644 --- a/htdocs/fichinter/stats/index.php +++ b/htdocs/fichinter/stats/index.php @@ -285,7 +285,6 @@ print '
%
0?'&userid='.$userid:'').'">'.$oldyear.'0
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).'
'; //print ''; print ''; @@ -2500,7 +2517,8 @@ elseif (! empty($object->id)) print '
'.$langs->trans("ToOrder").'
'.$langs->trans("OrderDate").''; - $date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $date_com = dol_mktime(GETPOST('rehour','int'), GETPOST('remin','int'), GETPOST('resec','int'), GETPOST('remonth','int'), GETPOST('reday','int'), GETPOST('reyear','int')); + if (empty($date_com)) $date_com=dol_now(); print $form->select_date($date_com,'',1,1,'',"commande",1,1,1); print '
'; //print ''; print '\n"; print "'; print ''; - print ''; - print ''; @@ -665,7 +665,7 @@ if ($id > 0 || ! empty($ref)) { // Qty to dispatch print ''; print ''; } // date - print ''; + print ''; print "\n"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index f0e9793f9a1..971f99717f4 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -711,7 +711,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; @@ -935,13 +935,11 @@ if ($resql) $projectstatic=new Project($db); $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $objectstatic->id=$obj->rowid; $objectstatic->ref=$obj->ref; $objectstatic->ref_supplier = $obj->ref_supplier; diff --git a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php index bdcfb3fdca8..4ce44845bf6 100644 --- a/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/commande/tpl/linkedobjectblock.tpl.php @@ -38,12 +38,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("orders"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?>
diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2a0d212788f..d409ba35b86 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1172,21 +1172,34 @@ if (empty($reshook)) $productsupplier=new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; - $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + $res=$productsupplier->fetch($idprod); // Load product from its id + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { $qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. //$qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -1202,15 +1215,18 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx=get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); + $pu = $productsupplier->fourn_pu; + if (empty($pu)) $pu = 0; // If pu is '' or null, we force to have a numeric value + $result=$object->addline( $desc, - $productsupplier->fourn_pu, + $pu, $tva_tx, $localtax1_tx, $localtax2_tx, @@ -2822,7 +2838,7 @@ else print $form->textwithpicto($langs->trans("Discount") . ':', $langs->trans("HelpEscompte"), - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'badsupplier' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'badsupplier') { @@ -2830,7 +2846,7 @@ else print $form->textwithpicto($langs->trans("Abandoned") . ':', $langs->trans("HelpAbandonBadCustomer"), - 1); print ''; // $resteapayeraffiche=0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'product_returned' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'product_returned') { @@ -2838,7 +2854,7 @@ else print $form->textwithpicto($langs->trans("ProductReturned") . ':', $langs->trans("HelpAbandonProductReturned"), - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Paye partiellement ou Abandon 'abandon' if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'abandon') { @@ -2849,7 +2865,7 @@ else print $form->textwithpicto($langs->trans("Abandoned") . ':', $text, - 1); print ''; $resteapayeraffiche = 0; - $cssforamountpaymentcomplete = ''; + $cssforamountpaymentcomplete = 'amountpaymentneutral'; } // Billed @@ -2862,12 +2878,12 @@ else else print $langs->trans('ExcessPaid'); print ' :'; - print ''; + print ''; print ''; } else // Credit note { - $cssforamountpaymentcomplete=''; + $cssforamountpaymentcomplete='amountpaymentneutral'; // Total already paid back print ''; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 8c77feb2187..c5c726eec81 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2006 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García @@ -44,10 +44,8 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (!$user->rights->fournisseur->facture->lire) accessforbidden(); -$langs->load("bills"); -$langs->load("companies"); -$langs->load('products'); -$langs->load('projects'); +// Load translation files required by the page +$langs->loadLangs(array('products', 'bills', 'companies', 'projects')); $action=GETPOST('action','alpha'); $massaction=GETPOST('massaction','alpha'); @@ -547,7 +545,7 @@ if ($resql) if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } // If the user can view prospects other than his' @@ -823,7 +821,6 @@ if ($resql) { $i=0; - $var=true; $totalarray=array(); while ($i < min($num,$limit)) { diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index ee7f5f99769..c20b26b1263 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -146,17 +146,15 @@ if ($year) print '
'; print ''; print ''; - $var=true; if (is_resource($handle)) { while (($file = readdir($handle))!==false) { if (preg_match('/^supplier_payment/i',$file)) { - $tfile = $dir . '/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print "".''; + print ''.''; print ''; print ''; } diff --git a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php index 9f57fc35c8d..8ba0884fa6a 100644 --- a/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/fourn/facture/tpl/linkedobjectblock.tpl.php @@ -40,12 +40,11 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock']; $langs->load("bills"); $total=0; $ilink=0; -$var=true; foreach($linkedObjectBlock as $key => $objectlink) { $ilink++; - $trclass=($var?'pair':'impair'); + $trclass='oddeven'; if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total'; ?> diff --git a/htdocs/fourn/js/lib_dispatch.js b/htdocs/fourn/js/lib_dispatch.js index 2b39c18cbb2..c2c570643f8 100644 --- a/htdocs/fourn/js/lib_dispatch.js +++ b/htdocs/fourn/js/lib_dispatch.js @@ -32,10 +32,10 @@ function addDispatchLine(index, type, mode) { mode = mode || 'qtymissing' - console.log("Split line type="+type+" index="+index+" mode="+mode); - var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object + console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode); + var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch - qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows + qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()), qtyDispatched; @@ -62,8 +62,11 @@ function addDispatchLine(index, type, mode) $row.attr('name',type+'_'+nbrTrs+'_'+index); //insert new row before last row $("tr[name^='"+type+"_'][name$='_"+index+"']:last").after($row); + //remove cloned select2 with duplicate id. - $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); + $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component + $(".csswarehouse_"+nbrTrs+"_"+index+":first-child").parent("span.selection").parent(".select2").detach(); + /* Suffix of lines are: _ trs.length _ index */ $("#qty_"+nbrTrs+"_"+index).focus(); $("#qty_dispatched_0_"+index).val(qtyDispatched); diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index fc5821b96f8..e680c18074e 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -26,8 +26,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->load("companies"); -$langs->load("bills"); +// Load translation files required by the page +$langs->loadLangs(array('bills', 'companies')); // Security check $socid = GETPOST("socid",'int'); @@ -82,7 +82,6 @@ if ($socid > 0) $resql=$db->query($sql); if ($resql) { - $var=true; $num = $db->num_rows($resql); print ''; @@ -116,7 +115,6 @@ if ($socid > 0) } $totalpaye = $fac->getSommePaiement(); - print ''; print "\n"; diff --git a/htdocs/ftp/admin/ftpclient.php b/htdocs/ftp/admin/ftpclient.php index 9a8ada55de5..ee7acc9070d 100644 --- a/htdocs/ftp/admin/ftpclient.php +++ b/htdocs/ftp/admin/ftpclient.php @@ -234,8 +234,6 @@ else $idrss = $reg[0]; //print "x".join(',',$reg)."=".$obj->name."=".$idrss; - $var=true; - print ""; print ''; print ''; diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 9881b89c6f1..943d4fa94e1 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -509,7 +509,6 @@ else } $nboflines=count($contents); - $var=true; $rawlisthasfailed=false; $i=0; while ($i < $nboflines && $i < 1000) @@ -553,7 +552,7 @@ else } - print ''; + print ''; // Name print ''; print ''; print ''; print ''; diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 070b735d09d..5df3fdb314b 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -399,7 +399,7 @@ else if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index 415bcf8fcbd..996ddd58ed3 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -98,8 +98,6 @@ if ($result) print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"e.status","","",'align="right"',$sortfield,$sortorder); print "\n"; - $var=true; - if ($num > 0) { $establishmentstatic=new Establishment($db); diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 2235812bae8..f8754193515 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -71,7 +71,6 @@ class Import dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); - $var=true; $i=0; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 0aa5ee35aa2..10747ed0212 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -436,11 +436,10 @@ if ($step == 2 && $datatoimport) print ''; print ''; - print $langs->trans("ChooseFormatOfFileToImport",img_picto('','filenew')).'
'; + print ''.$langs->trans("ChooseFormatOfFileToImport",img_picto('','filenew')).'

'; print '
'.$langs->trans("Receive").'
'.$langs->trans("DeliveryDate").''; - print $form->select_date('','',1,1,'',"commande",1,1,1); + $datepreselected = dol_now(); + print $form->select_date($datepreselected,'',1,1,'',"commande",1,1,1); print "
".$langs->trans("Delivery")."\n"; diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index c55183921f2..5b4adc39638 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -624,13 +624,13 @@ if ($id > 0 || ! empty($ref)) { print ''; - print ''; + print ''; print ''; + print ''; $dlcdatesuffix = dol_mktime(0, 0, 0, GETPOST('dlc' . $suffix . 'month'), GETPOST('dlc' . $suffix . 'day'), GETPOST('dlc' . $suffix . 'year')); $form->select_date($dlcdatesuffix, 'dlc' . $suffix, '', '', 1, ""); print ''; + print ''; $dluodatesuffix = dol_mktime(0, 0, 0, GETPOST('dluo' . $suffix . 'month'), GETPOST('dluo' . $suffix . 'day'), GETPOST('dluo' . $suffix . 'year')); $form->select_date($dluodatesuffix, 'dluo' . $suffix, '', '', 1, ""); print ''; - print ''; + print ''; print ''; @@ -685,9 +685,9 @@ if ($id > 0 || ! empty($ref)) { // Warehouse print ''; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1, 0, null, 'csswarehouse'.$suffix); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); @@ -852,7 +852,7 @@ if ($id > 0 || ! empty($ref)) { print '' . dol_print_date($objp->datec) . '' . dol_print_date($objp->datec, "dayhour") . '
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye) . ' 
' . price($resteapayeraffiche) . '' . price($resteapayeraffiche) . ' 
'; @@ -2884,7 +2900,7 @@ else else print $langs->trans('ExcessPaydBack'); print ' :' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans("Size").''.$langs->trans("Date").'
'.img_pdf().' '.$file.'
'.img_pdf().' '.$file.''.dol_print_size(dol_filesize($tfile)).''.dol_print_date(dol_filemtime($tfile),"dayhour").'
".dol_print_date($fac->date)."
'; $newsection=$section.(preg_match('@[\\\/]$@',$section)?'':'/').$file; diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 5037e3a8656..494c572eaad 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -868,12 +868,13 @@ if (empty($id) || $action == 'add' || $action == 'request' || $action == 'create print '
'.$langs->trans("User").''; + if (empty($user->rights->holiday->write_all)) { - print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); + print $form->select_dolusers(($fuserid?$fuserid:$user->id), 'fuserid', 0, '', 0, 'hierarchyme', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); //print ''; } - else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', 0, 0, 0, $morefilter, 0, '', 'maxwidth300'); + else print $form->select_dolusers(GETPOST('fuserid','int')?GETPOST('fuserid','int'):$user->id, 'fuserid', 0, '', 0, '', '', '0,'.$conf->entity, 0, 0, $morefilter, 0, '', 'maxwidth300'); print '
'; $filetoimport=''; - $var=true; // Add format informations and link to download example print '
'; @@ -553,17 +552,15 @@ if ($step == 3 && $datatoimport) print ''; print ''; + print ''.$langs->trans("ChooseFileToImport",img_picto('','filenew')).'

'; + print ''; $filetoimport=''; - $var=true; - - print ''; //print ''; // Input file name box - $var=false; print '
'.$langs->trans("ChooseFileToImport",img_picto('','filenew')).'
'.$langs->trans("FileWithDataToImport").'
'; print '     '; $out = (empty($conf->global->MAIN_UPLOAD_DOC)?' disabled':''); @@ -838,8 +835,8 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - print '
'; - print $langs->trans("SelectImportFields",img_picto('','uparrow','')).' '; + print '
'; + print $langs->trans("SelectImportFields",img_picto('','grip_title','')).' '; $htmlother->select_import_model($importmodelid,'importmodelid',$datatoimport,1); print ''; print '
'; @@ -872,7 +869,7 @@ if ($step == 4 && $datatoimport) $lefti=1; foreach ($array_match_file_to_database as $key => $val) { - + $var=!$var; show_elem($fieldssource,$key,$val,$var); // key is field number in source file //print '> '.$lefti.'-'.$key.'-'.$val; $listofkeys[$key]=1; @@ -889,7 +886,7 @@ if ($step == 4 && $datatoimport) $num=count($fieldssource); while ($lefti <= $num) { - + $var=!$var; $newkey=getnewkey($fieldssource,$listofkeys); show_elem($fieldssource,$newkey,'',$var); // key start after field number in source file //print '> '.$lefti.'-'.$newkey; @@ -907,12 +904,12 @@ if ($step == 4 && $datatoimport) // List of targets fields $height=24; $i = 0; - $var=true; $mandatoryfieldshavesource=true; + $var=true; print ''; foreach($fieldstarget as $code=>$label) { - + $var = !$var; print ''; $i++; @@ -1128,7 +1125,7 @@ if ($step == 4 && $datatoimport) print ''; print ''; print ''; - $var=false; + print ''; print ''; + // Keys for update print ''; print ''; print ''; print ''; print ''; print ''; //print ''; print ''; -$val=true; + if (count($import->array_import_code)) { foreach ($import->array_import_code as $key => $value) { - $val=!$val; - print '\n"; + $i++; } - print ''; - } - else - { - dol_print_error($db); + + $db->free($resql); + + print "
'.$langs->trans("ImportModelName").' 
'; print ''; @@ -1144,7 +1141,6 @@ if ($step == 4 && $datatoimport) { $num = $db->num_rows($resql); $i = 0; - $var=false; while ($i < $num) { @@ -1319,6 +1315,7 @@ if ($step == 5 && $datatoimport) if ($action == 'launchsimu') print '   '.$langs->trans("Modify").''; print '
'; print $langs->trans("KeysToUseForUpdates"); print ''; @@ -1336,15 +1333,15 @@ if ($step == 5 && $datatoimport) } print '   '.$langs->trans("Modify").''; } else { - if (count($objimport->array_import_updatekeys[0])) - { - print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); - } + if (count($objimport->array_import_updatekeys[0])) + { + print $form->multiselectarray('updatekeys', $objimport->array_import_updatekeys[0], $updatekeys, 0, 0, '', 1, '80%'); + print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt")); + } else { - print ''.$langs->trans("UpdateNotYetSupportedForThisImport").''; + print ''.$langs->trans("UpdateNotYetSupportedForThisImport").''; } - print $form->textwithpicto("", $langs->trans("SelectPrimaryColumnsForUpdateAttempt")); } /*echo '
';
 	print_r($objimport->array_import_updatekeys);
@@ -1432,7 +1429,8 @@ if ($step == 5 && $datatoimport)
     if ($action != 'launchsimu')
     {
         // Show import id
-        print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'
'; + print '
'; + print $langs->trans("NowClickToTestTheImport",$langs->transnoentitiesnoconv("RunSimulateImportFile")).'
'; print '
'; // Actions @@ -1948,7 +1946,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') { print '
'; - print img_picto(($pos>0?$langs->trans("MoveField",$pos):''),'uparrow','class="boxhandle" style="cursor:move;"'); + print img_picto(($pos>0?$langs->trans("MoveField",$pos):''),'grip_title','class="boxhandle" style="cursor:move;"'); print ''; print $langs->trans("NoFields"); @@ -1971,7 +1969,7 @@ function show_elem($fieldssource,$pos,$key,$var,$nostyle='') print '
'; // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object - print img_picto($langs->trans("MoveField",$pos),'uparrow','class="boxhandle" style="cursor:move;"'); + print img_picto($langs->trans("MoveField",$pos),'grip_title','class="boxhandle" style="cursor:move;"'); print ''; print $langs->trans("Field").' '.$pos; diff --git a/htdocs/imports/index.php b/htdocs/imports/index.php index 207055c6ce8..cd67a90e4dd 100644 --- a/htdocs/imports/index.php +++ b/htdocs/imports/index.php @@ -60,13 +60,12 @@ print ''.$langs->trans("Module").''.$langs->trans("ImportableDatas").' 
'; + print '
'; print img_object($import->array_import_module[$key]->getName(),$import->array_import_module[$key]->picto).' '; print $import->array_import_module[$key]->getName(); print ''; @@ -93,7 +92,7 @@ if (count($import->array_import_code)) { //if ($user->rights->import->run) //{ - print ''.$langs->trans("NewImport").''; + print ''.$langs->trans("NewImport").''; //} //else //{ @@ -108,7 +107,6 @@ print '
'; // List of available import format -$var=true; print ''; print ''; print ''; @@ -122,7 +120,6 @@ $liste=$model->liste_modeles($db); foreach($liste as $key) { - print ''; print ''; $text=$model->getDriverDescForKey($key); diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 7c2895eb835..810e289d7e3 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -172,12 +172,17 @@ if (! empty($dolibarr_main_document_root_alt)) // Security check (old method, when directory is renamed /install.lock) if (preg_match('/install\.lock/i',$_SERVER["SCRIPT_FILENAME"])) { - print 'Install pages have been disabled for security reason (directory renamed with .lock suffix).'; + if (! is_object($langs)) + { + $langs = new Translate('..'); + $langs->setDefaultLang('auto'); + } + $langs->load("install"); + print $langs->trans("YouTryInstallDisabledByDirLock"); if (! empty($dolibarr_main_url_root)) { - print 'Click on following link. '; - print ''; - print 'Click here to go to Dolibarr'; + print 'Click on following link, '; + print $langs->trans("ClickHereToGoToApp"); print ''; } exit; @@ -191,13 +196,18 @@ if (constant('DOL_DATA_ROOT') === null) { } if (@file_exists($lockfile)) { - print 'Install pages have been disabled for security reason (by lock file install.lock into dolibarr documents directory).
'; + if (! is_object($langs)) + { + $langs = new Translate('..'); + $langs->setDefaultLang('auto'); + } + $langs->load("install"); + print $langs->trans("YouTryInstallDisabledByFileLock"); if (! empty($dolibarr_main_url_root)) { - print 'Click on following link. '; - print 'If you always reach this page, you must remove install.lock file manually.
'; + print $langs->trans("ClickOnLinkOrRemoveManualy").'
'; print ''; - print 'Click here to go to Dolibarr'; + print $langs->trans("ClickHereToGoToApp"); print ''; } else @@ -370,6 +380,7 @@ function pHeader($subtitle,$next,$action='set',$param='',$forcejqueryurl='',$css global $langs; $langs->load("main"); $langs->load("admin"); + $langs->load("install"); $jquerytheme='base'; diff --git a/htdocs/install/mysql/data/llx_c_ecotaxe.sql b/htdocs/install/mysql/data/llx_c_ecotaxe.sql index 92046f38d0c..845ffa1e685 100644 --- a/htdocs/install/mysql/data/llx_c_ecotaxe.sql +++ b/htdocs/install/mysql/data/llx_c_ecotaxe.sql @@ -3,7 +3,7 @@ -- Copyright (C) 2004-2009 Laurent Destailleur -- Copyright (C) 2004 Benoit Mortier -- Copyright (C) 2004 Guillaume Delecourt --- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2005-2018 Regis Houssin -- Copyright (C) 2007 Patrick Raguin -- -- This program is free software; you can redistribute it and/or modify @@ -30,46 +30,23 @@ -- Eco-Taxes -- --- France (Organisme ERP) -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 1, 'ER-A-A', 'Materiels electriques < 0,2kg', 0.01000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 2, 'ER-A-B', 'Materiels electriques >= 0,2 kg et < 0,5 kg', 0.03000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 3, 'ER-A-C', 'Materiels electriques >= 0,5 kg et < 1 kg', 0.04000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 4, 'ER-A-D', 'Materiels electriques >= 1 kg et < 2 kg', 0.13000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 5, 'ER-A-E', 'Materiels electriques >= 2 kg et < 4kg', 0.21000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 6, 'ER-A-F', 'Materiels electriques >= 4 kg et < 8 kg', 0.42000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 7, 'ER-A-G', 'Materiels electriques >= 8 kg et < 15 kg', 0.84000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 8, 'ER-A-H', 'Materiels electriques >= 15 kg et < 20 kg', 1.25000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES ( 9, 'ER-A-I', 'Materiels electriques >= 20 kg et < 30 kg', 1.88000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (10, 'ER-A-J', 'Materiels electriques >= 30 kg', 3.34000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (11, 'ER-M-1', 'TV, Moniteurs < 9kg', 0.84000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (12, 'ER-M-2', 'TV, Moniteurs >= 9kg et < 15kg', 1.67000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (13, 'ER-M-3', 'TV, Moniteurs >= 15kg et < 30kg', 3.34000000, 'ERP', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (14, 'ER-M-4', 'TV, Moniteurs >= 30 kg', 6.69000000, 'ERP', 1, 1); - --- France (Organisme Ecologic) -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (15, 'EC-A-A', 'Materiels electriques 0,2 kg max', 0.00840000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (16, 'EC-A-B', 'Materiels electriques 0,21 kg min - 0,50 kg max', 0.02500000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (17, 'EC-A-C', 'Materiels electriques 0,51 kg min - 1 kg max', 0.04000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (18, 'EC-A-D', 'Materiels electriques 1,01 kg min - 2,5 kg max', 0.13000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (19, 'EC-A-E', 'Materiels electriques 2,51 kg min - 4 kg max', 0.21000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (20, 'EC-A-F', 'Materiels electriques 4,01 kg min - 8 kg max', 0.42000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (21, 'EC-A-G', 'Materiels electriques 8,01 kg min - 12 kg max', 0.63000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (22, 'EC-A-H', 'Materiels electriques 12,01 kg min - 20 kg max', 1.05000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (23, 'EC-A-I', 'Materiels electriques 20,01 kg min', 1.88000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (24, 'EC-M-1', 'TV, Moniteurs 9 kg max', 0.84000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (25, 'EC-M-2', 'TV, Moniteurs 9,01 kg min - 18 kg max', 1.67000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (26, 'EC-M-3', 'TV, Moniteurs 18,01 kg min - 36 kg max', 3.34000000, 'Ecologic', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (27, 'EC-M-4', 'TV, Moniteurs 36,01 kg min', 6.69000000, 'Ecologic', 1, 1); - --- France (Organisme Eco-systemes) -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (28, 'ES-M-1', 'TV, Moniteurs <= 20 pouces', 0.84000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (29, 'ES-M-2', 'TV, Moniteurs > 20 pouces et <= 32 pouces', 3.34000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (30, 'ES-M-3', 'TV, Moniteurs > 32 pouces et autres grands ecrans', 6.69000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (31, 'ES-A-A', 'Ordinateur fixe, Audio home systems (HIFI), elements hifi separes', 0.84000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (32, 'ES-A-B', 'Ordinateur portable, CD-RCR, VCR, lecteurs et enregistreurs DVD, instruments de musique et caisses de resonance, haut parleurs...', 0.25000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (33, 'ES-A-C', 'Imprimante, photocopieur, telecopieur', 0.42000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (34, 'ES-A-D', 'Accessoires, clavier, souris, PDA, imprimante photo, appareil photo, gps, telephone, repondeur, telephone sans fil, modem, telecommande, casque, camescope, baladeur mp3, radio portable, radio K7 et CD portable, radio reveil', 0.08400000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (35, 'ES-A-E', 'GSM', 0.00840000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (36, 'ES-A-F', 'Jouets et equipements de loisirs et de sports < 0,5 kg', 0.04200000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (37, 'ES-A-G', 'Jouets et equipements de loisirs et de sports > 0,5 kg', 0.17000000, 'Eco-systemes', 1, 1); -INSERT INTO llx_c_ecotaxe (rowid, code, libelle, price, organization, fk_pays, active) VALUES (38, 'ES-A-H', 'Jouets et equipements de loisirs et de sports > 10 kg', 1.25000000, 'Eco-systemes', 1, 1); +-- France (Organisme Eco-systèmes) +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (1, '25040', 'PETIT APPAREILS MENAGERS', 0.25000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (2, '25050', 'TRES PETIT APPAREILS MENAGERS', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (3, '32070', 'ECRAN POIDS < 5 KG', 2.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (4, '32080', 'ECRAN POIDS > 5 KG', 1.25000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (5, '32051', 'ORDINATEUR PORTABLE', 0.42000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (6, '32061', 'TABLETTE INFORMATIQUE', 0.84000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (7, '36011', 'ORDINATEUR FIXE (UC)', 1.15000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (8, '36021', 'IMPRIMANTES', 0.83000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (9, '36030', 'IT (INFORMATIQUE ET TELECOMS)', 0.83000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (10, '36040', 'PETIT IT (CLAVIERS / SOURIS)', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (11, '36050', 'TELEPHONIE MOBILE', 0.02000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (12, '36060', 'CONNECTIQUE CABLES', 0.02000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (13, '45010', 'GROS MATERIEL GRAND PUBLIC (TELEAGRANDISSEURS)', 1.67000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (14, '45020', 'MOYEN MATERIEL GRAND PUBLIC (LOUPES ELECTRONIQUES)', 0.42000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (15, '45030', 'PETIT MATERIEL GRAND PUBLIC (VIE QUOTIDIENNE)', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (16, '75030', 'JOUETS < 0,5 KG', 0.08000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (17, '75040', 'JOUETS ENTRE 0,5 KG ET 10 KG', 0.17000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (18, '74050', 'JOUETS > 10 KG', 1.67000000, 'Eco-systèmes', 1, 1); +INSERT INTO llx_c_ecotaxe (rowid, code, label, price, organization, fk_pays, active) VALUES (19, '85010', 'EQUIPEMENT MEDICAL < 0,5 KG', 0.08000000, 'Eco-systèmes', 1, 1); diff --git a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql index 18c4cfe2246..5327269fbe5 100644 --- a/htdocs/install/mysql/migration/6.0.0-7.0.0.sql +++ b/htdocs/install/mysql/migration/6.0.0-7.0.0.sql @@ -36,6 +36,11 @@ ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accountingaccount_fk_pcg_ -- Drop foreign key, so next alter will be a success -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version; +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; + -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) CHARACTER SET utf8; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_account MODIFY fk_pcg_version VARCHAR(20) COLLATE utf8_unicode_ci; -- VMYSQLUTF8UNICODECI ALTER TABLE llx_accounting_system MODIFY pcg_version VARCHAR(20) CHARACTER SET utf8; @@ -716,4 +721,3 @@ DROP TABLE llx_c_accountancy_category; UPDATE llx_cronjob set entity = 1 where entity = 0 and label in ('RecurringInvoices', 'SendEmailsReminders'); UPDATE llx_cronjob set entity = 0 where entity = 1 and label in ('PurgeDeleteTemporaryFilesShort', 'MakeLocalDatabaseDumpShort'); - diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index be14a0af0e4..7ca1d16d67e 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -35,6 +35,7 @@ -- Forgot in 7.0 +-- VMYSQL4.1 DROP INDEX nom on llx_societe; -- VMYSQL4.1 ALTER TABLE llx_c_regions drop FOREIGN KEY fk_c_regions_fk_pays; -- VMYSQL4.1 ALTER TABLE llx_product_association ADD COLUMN rowid integer AUTO_INCREMENT PRIMARY KEY; @@ -42,6 +43,8 @@ ALTER TABLE llx_website_page ADD COLUMN fk_user_create integer; ALTER TABLE llx_website_page ADD COLUMN fk_user_modif integer; ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFAULT 'page'; + + -- drop very old table (bad name) DROP TABLE llx_c_accountancy_category; DROP TABLE llx_c_accountingaccount; @@ -94,7 +97,10 @@ delete from llx_usergroup_rights where fk_id not in (select id from llx_rights_d ALTER TABLE llx_inventory ADD COLUMN fk_product integer DEFAULT NULL; ALTER TABLE llx_inventory MODIFY COLUMN fk_warehouse integer DEFAULT NULL; -ALTER TABLE llx_c_type_fees ADD COLUMN llx_c_type_fees integer DEFAULT 0; +ALTER TABLE llx_c_type_fees DROP COLUMN llx_c_type_fees; +ALTER TABLE llx_c_type_fees ADD COLUMN type integer DEFAULT 0; + +ALTER TABLE llx_c_ecotaxe CHANGE COLUMN libelle label varchar(255); ALTER TABLE llx_product_fournisseur_price DROP COLUMN unitcharges; @@ -532,3 +538,9 @@ INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUE INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 5, 'SKR04', 'Standardkontenrahmen SKR 04', 1); +-- advtargetmailing +ALTER TABLE llx_advtargetemailing ADD COLUMN fk_element integer NOT NULL; +ALTER TABLE llx_advtargetemailing ADD COLUMN type_element varchar(180) NOT NULL; +UPDATE llx_advtargetemailing SET fk_element = fk_mailing, type_element='mailing'; +ALTER TABLE llx_advtargetemailing DROP COLUMN fk_mailing; + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 9493ef6c7c9..22409441eac 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -391,6 +391,11 @@ drop table tmp_bank_url_expense_user; -- where price = 17.5 +-- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; +-- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; +-- VMYSQL4.1 update llx_accounting_account set tms = datec where DATE(STR_TO_DATE(tms, '%Y-%m-%d')) IS NULL; + -- VMYSQL4.1 SET sql_mode = 'ALLOW_INVALID_DATES'; -- VMYSQL4.1 update llx_expensereport set date_debut = date_create where DATE(STR_TO_DATE(date_debut, '%Y-%m-%d')) IS NULL; -- VMYSQL4.1 SET sql_mode = 'NO_ZERO_DATE'; diff --git a/htdocs/install/mysql/tables/llx_advtargetemailing.sql b/htdocs/install/mysql/tables/llx_advtargetemailing.sql index 395558c700f..3698e5e6626 100644 --- a/htdocs/install/mysql/tables/llx_advtargetemailing.sql +++ b/htdocs/install/mysql/tables/llx_advtargetemailing.sql @@ -22,7 +22,8 @@ CREATE TABLE llx_advtargetemailing rowid integer NOT NULL auto_increment PRIMARY KEY, name varchar(180) NOT NULL, entity integer NOT NULL DEFAULT 1, - fk_mailing integer NOT NULL, + fk_element integer NOT NULL, + type_element varchar(180) NOT NULL, filtervalue text, fk_user_author integer NOT NULL, datec datetime NOT NULL, diff --git a/htdocs/install/mysql/tables/llx_c_ecotaxe.sql b/htdocs/install/mysql/tables/llx_c_ecotaxe.sql index 09613787f76..cd67bb34766 100644 --- a/htdocs/install/mysql/tables/llx_c_ecotaxe.sql +++ b/htdocs/install/mysql/tables/llx_c_ecotaxe.sql @@ -1,6 +1,6 @@ -- ======================================================================== --- Copyright (C) 2007 Regis Houssin --- Copyright (C) 2009 Laurent Destailleur +-- Copyright (C) 2007-2018 Regis Houssin +-- Copyright (C) 2009 Laurent Destailleur -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -19,11 +19,11 @@ create table llx_c_ecotaxe ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - code varchar(64) NOT NULL, -- Code servant a la traduction et a la reference interne - libelle varchar(255), -- Description - price double(24,8), -- Montant HT - organization varchar(255), -- Organisme gerant le bareme tarifaire - fk_pays integer NOT NULL, -- Pays correspondant - active tinyint DEFAULT 1 NOT NULL + rowid integer AUTO_INCREMENT PRIMARY KEY, + code varchar(64) NOT NULL, -- Code servant a la traduction et a la reference interne + label varchar(255), -- Description + price double(24,8), -- Montant HT + organization varchar(255), -- Organisme gerant le bareme tarifaire + fk_pays integer NOT NULL, -- Pays correspondant + active tinyint DEFAULT 1 NOT NULL )ENGINE=innodb; \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index d413b60e25f..c795fa254dc 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -21,7 +21,7 @@ CREATE TABLE llx_website_page ( rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY, fk_website integer NOT NULL, - type_container varchar(16) NOT NULL DEFAULT 'page' + type_container varchar(16) NOT NULL DEFAULT 'page', pageurl varchar(255) NOT NULL, aliasalt varchar(255), title varchar(255), diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 134d9761180..266b2fae483 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -55,6 +55,7 @@ AccountancyAreaDescChartModel=STEP %s: Create a model of chart of account from m AccountancyAreaDescChart=STEP %s: Create or check content of your chart of account from menu %s AccountancyAreaDescVat=STEP %s: Define accounting accounts for each VAT Rates. For this, use the menu entry %s. +AccountancyAreaDescDefault=STEP %s: Define default accounting accounts. For this, use the menu entry %s. AccountancyAreaDescExpenseReport=STEP %s: Define default accounting accounts for each type of expense report. For this, use the menu entry %s. AccountancyAreaDescSal=STEP %s: Define default accounting accounts for payment of salaries. For this, use the menu entry %s. AccountancyAreaDescContrib=STEP %s: Define default accounting accounts for special expences (miscellaneous taxes). For this, use the menu entry %s. diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e4ecc5f0888..c40a8541d67 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -497,7 +497,7 @@ Module25Desc=Customer order management Module30Name=Invoices Module30Desc=Invoice and credit note management for customers. Invoice management for suppliers Module40Name=Suppliers -Module40Desc=Supplier management and buying (orders and invoices) +Module40Desc=Suppliers and purchase management (purchase orders and billing) Module42Name=Debug Logs Module42Desc=Logging facilities (file, syslog, ...). Such logs are for technical/debug purposes. Module49Name=Editors diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index fbd381bdde3..f95d0e18bf4 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - banks Bank=Bank -MenuBankCash=Bank/Cash +MenuBankCash=Bank | Cash MenuVariousPayment=Miscellaneous payments MenuNewVariousPayment=New Miscellaneous payment BankName=Bank name @@ -132,7 +132,7 @@ PaymentDateUpdateSucceeded=Payment date updated successfully PaymentDateUpdateFailed=Payment date could not be updated Transactions=Transactions BankTransactionLine=Bank entry -AllAccounts=All bank/cash accounts +AllAccounts=All bank and cash accounts BackToAccount=Back to account ShowAllAccounts=Show for all accounts FutureTransaction=Transaction in futur. No way to conciliate. diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index e158f7a691d..d06b1512cc6 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -110,8 +110,8 @@ SendRemindByMail=Send reminder by EMail DoPayment=Enter payment DoPaymentBack=Enter refund ConvertToReduc=Mark as credit available -ConvertExcessReceivedToReduc=Convert excess received into future discount -ConvertExcessPaidToReduc=Convert excess paid into future discount +ConvertExcessReceivedToReduc=Convert excess received into available credit +ConvertExcessPaidToReduc=Convert excess paid into available discount EnterPaymentReceivedFromCustomer=Enter payment received from customer EnterPaymentDueToCustomer=Make payment due to customer DisabledBecauseRemainderToPayIsZero=Disabled because remaining unpaid is zero diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index ce70a9748a0..196ab114d6f 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -19,7 +19,8 @@ Income=Income Outcome=Expense MenuReportInOut=Income / Expense ReportInOut=Balance of income and expenses -ReportTurnover=Turnover +ReportTurnover=Turnover invoiced +ReportTurnoverCollected=Turnover collected PaymentsNotLinkedToInvoice=Payments not linked to any invoice, so not linked to any third party PaymentsNotLinkedToUser=Payments not linked to any user Profit=Profit @@ -117,8 +118,9 @@ CustomerAccountancyCodeShort=Cust. account. code SupplierAccountancyCodeShort=Sup. account. code AccountNumber=Account number NewAccountingAccount=New account -SalesTurnover=Sales turnover -SalesTurnoverMinimum=Minimum sales turnover +Turnover=Turnover invoiced +TurnoverCollected=Turnover collected +SalesTurnoverMinimum=Minimum turnover ByExpenseIncome=By expenses & incomes ByThirdParties=By third parties ByUserAuthorOfInvoice=By invoice author @@ -138,8 +140,8 @@ ConfirmDeleteSocialContribution=Are you sure you want to delete this social/fisc ExportDataset_tax_1=Social and fiscal taxes and payments CalcModeVATDebt=Mode %sVAT on commitment accounting%s. CalcModeVATEngagement=Mode %sVAT on incomes-expenses%s. -CalcModeDebt=Mode %sClaims-Debts%s said Commitment accounting. -CalcModeEngagement=Mode %sIncomes-Expenses%s said cash accounting +CalcModeDebt=Analysis of known recorded invoices even if they are not yet accounted in ledger. +CalcModeEngagement=Analysis of known recorded payments, even if they are not yet accounted in Ledger. CalcModeBookkeeping=Analysis of data journalized in Bookkeeping Ledger table CalcModeLT1= Mode %sRE on customer invoices - suppliers invoices%s CalcModeLT1Debt=Mode %sRE on customer invoices%s @@ -152,9 +154,9 @@ AnnualSummaryInputOutputMode=Balance of income and expenses, annual summary AnnualByCompanies=Balance of income and expenses, by predefined groups of account AnnualByCompaniesDueDebtMode=Balance of income and expenses, detail by predefined groups, mode %sClaims-Debts%s said Commitment accounting. AnnualByCompaniesInputOutputMode=Balance of income and expenses, detail by predefined groups, mode %sIncomes-Expenses%s said cash accounting. -SeeReportInInputOutputMode=See report %sIncomes-Expenses%s said cash accounting for a calculation on actual payments made -SeeReportInDueDebtMode=See report %sClaims-Debts%s said commitment accounting for a calculation on issued invoices -SeeReportInBookkeepingMode=See report %sBookeeping%s for a calculation on bookkeeping table analysis +SeeReportInInputOutputMode=See %sanalysis of payments%s for a calculation on actual payments made, if they are not yet accounted in Ledger. +SeeReportInDueDebtMode=See %sanalysis of invoices%s for a calculation based on known recorded invoices even, if they are not yet accounted in Ledger. +SeeReportInBookkeepingMode=See %sBookeeping report%s for a calculation on Bookkeeping Ledger table RulesAmountWithTaxIncluded=- Amounts shown are with all taxes included RulesResultDue=- It includes outstanding invoices, expenses, VAT, donations whether they are paid or not. Is also includes paid salaries.
- It is based on the validation date of invoices and VAT and on the due date for expenses. For salaries defined with Salary module, the value date of payment is used. RulesResultInOut=- It includes the real payments made on invoices, expenses, VAT and salaries.
- It is based on the payment dates of the invoices, expenses, VAT and salaries. The donation date for donation. @@ -219,8 +221,8 @@ Mode1=Method 1 Mode2=Method 2 CalculationRuleDesc=To calculate total VAT, there is two methods:
Method 1 is rounding vat on each line, then summing them.
Method 2 is summing all vat on each line, then rounding result.
Final result may differs from few cents. Default mode is mode %s. CalculationRuleDescSupplier=According to supplier, choose appropriate method to apply same calculation rule and get same result expected by your supplier. -TurnoverPerProductInCommitmentAccountingNotRelevant=The Turnover report per product, when using a cash accounting mode is not relevant. This report is only available when using commitment accounting mode (see setup of accountancy module). -TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The Turnover report per sale tax rate, when using a cash accounting mode is not relevant. This report is only available when using commitment accounting mode (see setup of accountancy module). +TurnoverPerProductInCommitmentAccountingNotRelevant=The report of Turnover collected per product is not available. This report is only available for turnover invoiced. +TurnoverPerSaleTaxRateInCommitmentAccountingNotRelevant=The report of Turnover collected per sale tax rate is not available. This report is only available for turnover invoiced. CalculationMode=Calculation mode AccountancyJournal=Accounting code journal ACCOUNTING_VAT_SOLD_ACCOUNT=Accounting account by default for VAT on sales (used if not defined on VAT dictionary setup) @@ -252,5 +254,6 @@ VATDue=Sale tax claimed ClaimedForThisPeriod=Claimed for the period PaidDuringThisPeriod=Paid during this period ByVatRate=By sale tax rate -TurnoverbyVatrate=Turnover by sale tax rate +TurnoverbyVatrate=Turnover invoiced by sale tax rate +TurnoverCollectedbyVatrate=Turnover collected by sale tax rate PurchasebyVatrate=Purchase by sale tax rate \ No newline at end of file diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index acdddfe3f59..00d4be864ff 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -204,3 +204,7 @@ MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm ShowNotAvailableOptions=Show not available options HideNotAvailableOptions=Hide not available options ErrorFoundDuringMigration=Error were reported during migration process so next step is not available. To ignore errors, you can click here, but application or some features may not work correctly until fixed. +YouTryInstallDisabledByDirLock=The application try to sefl upgrade, but install/upgrade pages have been disabled for security reason (directory renamed with .lock suffix).
+YouTryInstallDisabledByFileLock=The application try to sefl upgrade, but install/upgrade pages pages have been disabled for security reason (by lock file install.lock into dolibarr documents directory).
+ClickHereToGoToApp=Click here to go to your application +ClickOnLinkOrRemoveManualy=Click on following link and if you always reach this page, you must remove the file install.lock into documents directory manually \ No newline at end of file diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 13907ca380e..8ef8cc30090 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -80,8 +80,8 @@ LinkedObject=Linked object NbOfActiveNotifications=Number of notifications (nb of recipient emails) PredefinedMailTest=__(Hello)__\nThis is a test mail sent to __EMAIL__.\nThe two lines are separated by a carriage return.\n\n__USER_SIGNATURE__ PredefinedMailTestHtml=__(Hello)__\nThis is a test mail (the word test must be in bold).
The two lines are separated by a carriage return.

__USER_SIGNATURE__ -PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\nThis is the link to make your online payment if this invoice is not already payed:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ -PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\nThis is the link to make your online payment:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendInvoice=__(Hello)__\n\nYou will find here the invoice __REF__\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nWe would like to warn you that the invoice __REF__ seems to not be payed. So this is the invoice in attachment again, as a reminder.\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendProposal=__(Hello)__\n\nYou will find here the commercial proposal __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nYou will find here the price request __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendOrder=__(Hello)__\n\nYou will find here the order __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ @@ -91,6 +91,7 @@ PredefinedMailContentSendShipping=__(Hello)__\n\nYou will find here the shipping PredefinedMailContentSendFichInter=__(Hello)__\n\nYou will find here the intervention __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentThirdparty=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentUser=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.\n\n%s\n\n DemoDesc=Dolibarr is a compact ERP/CRM supporting several business modules. A demo showcasing all modules makes no sense as this scenario never occurs (several hundred available). So, several demo profiles are available. ChooseYourDemoProfil=Choose the demo profile that best suits your needs... ChooseYourDemoProfilMore=...or build your own profile
(manual module selection) @@ -218,7 +219,7 @@ FileIsTooBig=Files is too big PleaseBePatient=Please be patient... NewPassword=New password ResetPassword=Reset password -RequestToResetPasswordReceived=A request to change your password has been received +RequestToResetPasswordReceived=A request to change your password has been received. NewKeyIs=This is your new keys to login NewKeyWillBe=Your new key to login to software will be ClickHereToGoTo=Click here to go to %s diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 2cbe4289654..547b188b4a5 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -14,7 +14,6 @@ PaypalModeOnlyPaypal=PayPal only ONLINE_PAYMENT_CSS_URL=Optionnal URL of CSS style sheet on online payment page ThisIsTransactionId=This is id of transaction: %s PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail -PredefinedMailContentLink=You can click on the link below to make your payment if it is not already done.

%s

YouAreCurrentlyInSandboxMode=You are currently in the %s "sandbox" mode NewOnlinePaymentReceived=New online payment received NewOnlinePaymentFailed=New online payment tried but failed diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index abf262ec9ba..21c2e1dc62c 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -251,8 +251,8 @@ PriceNumeric=Number DefaultPrice=Default price ComposedProductIncDecStock=Increase/Decrease stock on parent change ComposedProduct=Sub-product -MinSupplierPrice=Minimum supplier price -MinCustomerPrice=Minimum customer price +MinSupplierPrice=Minimum buying price +MinCustomerPrice=Minimum selling price DynamicPriceConfiguration=Dynamic price configuration DynamicPriceDesc=On product card, with this module enabled, you should be able to set mathematic functions to calculate Customer or Supplier prices. Such function can use all mathematic operators, some constants and variables. You can set here the variables you want to be able to use and if the variable need an automatic update, the external URL to use to ask Dolibarr to update automaticaly the value. AddVariable=Add Variable diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 7745dde08da..5a7169ac925 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -75,6 +75,7 @@ AvailabilityTypeAV_1M=1 month TypeContact_propal_internal_SALESREPFOLL=Representative following-up proposal TypeContact_propal_external_BILLING=Customer invoice contact TypeContact_propal_external_CUSTOMER=Customer contact following-up proposal +TypeContact_propal_external_SHIPPING=Customer contact for delivery # Document models DocModelAzurDescription=A complete proposal model (logo...) DefaultModelPropalCreate=Default model creation diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index d1b1f85224f..98aae045517 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -203,4 +203,4 @@ RegulateStock=Regulate Stock ListInventory=List StockSupportServices=Stock management support services StockSupportServicesDesc=By default, you can stock only product with type "product". If on, and if module service is on, you can also stock a product with type "service" -ReceiveProducts=Receive products \ No newline at end of file +ReceiveProducts=Receive items \ No newline at end of file diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index a2b10dfb556..6cc31a25bfd 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -140,7 +140,7 @@ TicketStatByStatus=Tickets by status # Ticket=Incident ticket TicketCard=Ticket card -CreateTicket=Create new ticket +CreateTicket=Create ticket EditTicket=Edit ticket TicketsManagement=Tickets Management CreatedBy=Created by diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 57df8cc540d..9f840556f75 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -48,7 +48,7 @@ PasswordChangeRequest=Request to change password for %s PasswordChangeRequestSent=Request to change password for %s sent to %s. ConfirmPasswordReset=Confirm password reset MenuUsersAndGroups=Users & Groups -LastGroupsCreated=Latest %s created groups +LastGroupsCreated=Latest %s groups created LastUsersCreated=Latest %s users created ShowGroup=Show group ShowUser=Show user diff --git a/htdocs/langs/fr_FR/mails.lang b/htdocs/langs/fr_FR/mails.lang index d9e0e2b8cde..25a82ab2487 100644 --- a/htdocs/langs/fr_FR/mails.lang +++ b/htdocs/langs/fr_FR/mails.lang @@ -109,7 +109,7 @@ MailingNeedCommand2=Vous pouvez toutefois quand même les envoyer par l'interfac ConfirmSendingEmailing=Si vous souhaitez envoyer l'e-mailing depuis cet écran, veuillez confirmer son envoi maintenant, depuis votre navigateur. LimitSendingEmailing=Remarque: L'envoi d'Emailings à partir de l'interface web se fait en plusieurs fois pour des raisons de sécurité et de timeout, %s bénéficiaires à la fois pour chaque session d'envoi. TargetsReset=Vider liste -ToClearAllRecipientsClickHere=Pour vider la liste des destinataires de cet emailing, cliquez sur le bouton +ToClearAllRecipientsClickHere=Pour vider la liste des destinataires, cliquez sur le bouton ToAddRecipientsChooseHere=Pour ajouter des destinataires, choisir dans les listes ci-dessous NbOfEMailingsReceived=Emailings de masse reçus NbOfEMailingsSend=Emailings de masse envoyés diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 01d768261f9..f6543c89a80 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -82,7 +82,7 @@ PredefinedMailTest=__(Hello)__,\nCeci est un mail de test envoyé à __EMAIL__.\ PredefinedMailTestHtml=__(Hello)__\nCeci est un message de test (le mot test doit être en gras).
Les 2 lignes sont séparées par un retour à la ligne.

__SIGNATURE__ PredefinedMailContentSendInvoice=__(Hello)__\n\nVous trouverez ci-joint la facture __REF__\n\nVoici le lien pour effectuer votre paiement en ligne si elle n'est pas déjà été payée:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendInvoiceReminder=__(Hello)__\n\nNous souhaitons vous prévenir que la facture __REF__ ne semble pas avoir été payée. Voici donc la facture en pièce jointe, à titre de rappel.\n\nVoici le lien pour effectuer votre paiement en ligne:\n__ONLINE_PAYMENT_URL__\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ -PredefinedMailContentSendProposal=__(Hello)__\n\nYou will find here the commercial proposal __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ +PredefinedMailContentSendProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, la proposition commerciale __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierProposal=__(Hello)__\n\nVeuillez trouver, ci-joint, une demande de prix avec la référence __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, la commande __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nVeuillez trouver, ci-joint, notre commande __REF__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__ diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 5139c49674a..0d724e1ce5c 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -72,24 +72,30 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* deprecated in PHP * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). * * @param string $val Value - * @param string $type 1=GET, 0=POST, 2=PHP_SELF + * @param string $type 1=GET, 0=POST, 2=PHP_SELF, 3=GET without sql reserved keywords (the less tolerant test) * @return int >0 if there is an injection, 0 if none */ function test_sql_and_script_inject($val, $type) { $inj = 0; // For SQL Injection (only GET are used to be included into bad escaped SQL requests) - if ($type == 1) + if ($type == 1 || $type == 3) { - $inj += preg_match('/updatexml\(/i', $val); $inj += preg_match('/delete\s+from/i', $val); $inj += preg_match('/create\s+table/i', $val); $inj += preg_match('/insert\s+into/i', $val); $inj += preg_match('/select\s+from/i', $val); $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); + $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login + $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database } - if ($type != 2) // Not common, we can check on POST + if ($type == 3) { + $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); + } + if ($type != 2) // Not common key strings, so we can check them both on GET and POST + { + $inj += preg_match('/updatexml\(/i', $val); $inj += preg_match('/update.+set.+=/i', $val); $inj += preg_match('/union.+select/i', $val); $inj += preg_match('/(\.\.%2f)+/i', $val); @@ -707,7 +713,7 @@ if (! defined('NOLOGIN')) $hookmanager->initHooks(array('main')); // Code for search criteria persistence. - if (! empty($_GET['save_lastsearch_values'])) // Keep $_GET here + if (! empty($_GET['save_lastsearch_values'])) // We must use $_GET here { $relativepathstring = preg_replace('/\?.*$/','',$_SERVER["HTTP_REFERER"]); $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/','',$relativepathstring); // Get full path except host server @@ -720,9 +726,15 @@ if (! defined('NOLOGIN')) // We click on a link that leave a page we have to save search criteria. We save them from tmp to no tmp if (! empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { - $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; + $_SESSION['lastsearch_values_'.$relativepathstring]=$_SESSION['lastsearch_values_tmp_'.$relativepathstring]; unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); } + // We also save contextpage + if (! empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) + { + $_SESSION['lastsearch_contextpage_'.$relativepathstring]=$_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); + } } $action = ''; @@ -1614,8 +1626,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a print ''; - //unset($form); - print '
'; print "\n\n"; } @@ -1904,7 +1914,10 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu $ret.=($accesskey?' accesskey="'.$accesskey.'"':''); $ret.=' placeholder="'.strip_tags($title).'"'; $ret.=' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />'; - $ret.=''; + //$ret.=''; + $ret.=''; $ret.="\n"; return $ret; } @@ -1925,7 +1938,7 @@ if (! function_exists("llxFooter")) function llxFooter($comment='',$zone='private', $disabledoutputofmessages=0) { global $conf, $langs, $user, $object; - global $delayedhtmlcontent; + global $delayedhtmlcontent, $contextpage; $ext='layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); @@ -1933,24 +1946,37 @@ if (! function_exists("llxFooter")) dol_htmloutput_events($disabledoutputofmessages); // Code for search criteria persistence. - // Save $user->lastsearch_values if defined (define on list pages when a form field search_xxx exists) + // $user->lastsearch_values was set by the GETPOST when form field search_xxx exists if (is_object($user) && ! empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) { - // Clean data + // Clean and save data foreach($user->lastsearch_values_tmp as $key => $val) { - unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean arry to rebuild it just after + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after if (count($val) && empty($_POST['button_removefilter'])) // If there is search criteria to save and we did not click on 'Clear filter' button { if (empty($val['sortfield'])) unset($val['sortfield']); if (empty($val['sortorder'])) unset($val['sortorder']); - dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criteria)"); + dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)"); $_SESSION['lastsearch_values_tmp_'.$key]=json_encode($val); unset($_SESSION['lastsearch_values_'.$key]); } } } + + $relativepathstring = $_SERVER["PHP_SELF"]; + // Clean $relativepathstring + if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring); + $relativepathstring = preg_replace('/^\//', '', $relativepathstring); + $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); + if (preg_match('/list\.php$/', $relativepathstring)) + { + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); + if (! empty($contextpage)) $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]=$contextpage; + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); + } + // Core error message if (! empty($conf->global->MAIN_CORE_ERROR)) { diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9e2e48ce6cf..7b62c96ded5 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -69,6 +69,7 @@ $langs->loadLangs(array("mymodule@mymodule","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -123,9 +124,9 @@ if (empty($reshook)) $permissiontodelete = $user->rights->mymodule->delete; if (empty($backtopage)) $backtopage = dol_buildpath('/mymodule/myobject_card.php',1).'?id=__ID__'; $backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1); - $triggermodname = 'MYMODULE_MODIFY'; + $triggermodname = 'MYMODULE_MYOBJECT_MODIFY'; // Name of trigger action code to execute when we modify record - // Actions cancel, add, update or delete + // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; // Actions when printing a doc from card @@ -249,6 +250,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMyObject'), $langs->trans('ConfirmDeleteMyObject'), 'confirm_delete', '', 0, 1); } + // Clone confirmation + if ($action == 'clone') { + // Create an array for form + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneMyObject'), $langs->trans('ConfirmCloneMyObject', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } + // Confirmation of action xxxx if ($action == 'xxx') { @@ -258,7 +266,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), - // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1))); + // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)) }*/ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } @@ -358,6 +366,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Send print '' . $langs->trans('SendMail') . ''."\n"; + // Modify if ($user->rights->mymodule->write) { print ''.$langs->trans("Modify").''."\n"; @@ -367,8 +376,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$langs->trans('Modify').''."\n"; } + // Clone + if ($user->rights->mymodule->write) + { + print ''; + } + /* - if ($user->rights->mymodule->create) + if ($user->rights->mymodule->write) { if ($object->status == 1) { diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index b6e2b351494..0e43aedc4e7 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -369,7 +369,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index d7b91abe246..3c0fc4d2b2f 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -101,7 +101,7 @@ class ActionsCardProduct $this->tpl['ref'] = $this->ref; // Label - $this->tpl['label'] = $this->libelle; + $this->tpl['label'] = $this->label; // Description $this->tpl['description'] = nl2br($this->description); diff --git a/htdocs/product/canvas/product/tpl/card_create.tpl.php b/htdocs/product/canvas/product/tpl/card_create.tpl.php index e763605f701..bc4b5409688 100644 --- a/htdocs/product/canvas/product/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_create.tpl.php @@ -55,7 +55,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe
- + diff --git a/htdocs/product/canvas/product/tpl/card_edit.tpl.php b/htdocs/product/canvas/product/tpl/card_edit.tpl.php index c64c5dbe1e4..6c13bddb6a1 100644 --- a/htdocs/product/canvas/product/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/product/tpl/card_edit.tpl.php @@ -55,7 +55,7 @@ dol_htmloutput_errors($object->error,$object->errors); - + diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index ba43898724e..af227e54b0b 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -100,7 +100,7 @@ class ActionsCardService $this->tpl['ref'] = $this->ref; // Label - $this->tpl['label'] = $this->libelle; + $this->tpl['label'] = $this->label; // Description $this->tpl['description'] = nl2br($this->description); diff --git a/htdocs/product/canvas/service/tpl/card_create.tpl.php b/htdocs/product/canvas/service/tpl/card_create.tpl.php index 46db54d63b8..b9dc10fd5dc 100644 --- a/htdocs/product/canvas/service/tpl/card_create.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_create.tpl.php @@ -52,7 +52,7 @@ $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSe - + diff --git a/htdocs/product/canvas/service/tpl/card_edit.tpl.php b/htdocs/product/canvas/service/tpl/card_edit.tpl.php index 06d1b3ff612..6fc3bf3273a 100644 --- a/htdocs/product/canvas/service/tpl/card_edit.tpl.php +++ b/htdocs/product/canvas/service/tpl/card_edit.tpl.php @@ -52,7 +52,7 @@ dol_htmloutput_errors($object->error,$object->errors); - + diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 03cfbc7f841..39a5697ad72 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -289,8 +289,8 @@ if (empty($reshook)) $object->url = GETPOST('url'); $object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none')); $object->note = $object->note_private; // deprecated - $object->customcode = GETPOST('customcode'); - $object->country_id = GETPOST('country_id'); + $object->customcode = GETPOST('customcode','alpha'); + $object->country_id = GETPOST('country_id','int'); $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; $object->fk_default_warehouse = GETPOST('fk_default_warehouse'); @@ -307,13 +307,13 @@ if (empty($reshook)) $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); - $object->finished = GETPOST('finished'); - $object->fk_unit = GETPOST('units'); + $object->finished = GETPOST('finished','alpha'); + $object->fk_unit = GETPOST('units','alpha'); - $accountancy_code_sell = GETPOST('accountancy_code_sell'); - $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra'); - $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export'); - $accountancy_code_buy = GETPOST('accountancy_code_buy'); + $accountancy_code_sell = GETPOST('accountancy_code_sell','alpha'); + $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra','alpha'); + $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export','alpha'); + $accountancy_code_buy = GETPOST('accountancy_code_buy','alpha'); if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; } if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } @@ -386,11 +386,11 @@ if (empty($reshook)) $object->note_private = dol_htmlcleanlastbr(GETPOST('note_private','none')); $object->note = $object->note_private; } - $object->customcode = GETPOST('customcode'); - $object->country_id = GETPOST('country_id'); - $object->status = GETPOST('statut'); - $object->status_buy = GETPOST('statut_buy'); - $object->status_batch = GETPOST('status_batch'); + $object->customcode = GETPOST('customcode','alpha'); + $object->country_id = GETPOST('country_id','int'); + $object->status = GETPOST('statut','int'); + $object->status_buy = GETPOST('statut_buy','int'); + $object->status_batch = GETPOST('status_batch','aZ09'); // removed from update view so GETPOST always empty $object->fk_default_warehouse = GETPOST('fk_default_warehouse'); /* @@ -412,7 +412,7 @@ if (empty($reshook)) $object->surface_units = GETPOST('surface_units'); $object->volume = GETPOST('volume'); $object->volume_units = GETPOST('volume_units'); - $object->finished = GETPOST('finished'); + $object->finished = GETPOST('finished','alpha'); $units = GETPOST('units', 'int'); @@ -439,10 +439,10 @@ if (empty($reshook)) $object->barcode_type_coder = $stdobject->barcode_type_coder; $object->barcode_type_label = $stdobject->barcode_type_label; - $accountancy_code_sell = GETPOST('accountancy_code_sell'); - $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra'); - $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export'); - $accountancy_code_buy = GETPOST('accountancy_code_buy'); + $accountancy_code_sell = GETPOST('accountancy_code_sell','alpha'); + $accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra','alpha'); + $accountancy_code_sell_export = GETPOST('accountancy_code_sell_export','alpha'); + $accountancy_code_buy = GETPOST('accountancy_code_buy','alpha'); if ($accountancy_code_sell <= 0) { $object->accountancy_code_sell = ''; } else { $object->accountancy_code_sell = $accountancy_code_sell; } if ($accountancy_code_sell_intra <= 0) { $object->accountancy_code_sell_intra = ''; } else { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } @@ -1033,7 +1033,8 @@ else if ($type == 1) { print ''; - $totalline=price2num($value['nb'] * ($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise), 'MT'); + // For avoid a non-numeric value + $fourn_unitprice = (!empty($product_fourn->fourn_unitprice)?$product_fourn->fourn_unitprice:0); + $fourn_remise_percent = (!empty($product_fourn->fourn_remise_percent)?$product_fourn->fourn_remise_percent:0); + $fourn_remise = (!empty($product_fourn->fourn_remise)?$product_fourn->fourn_remise:0); + + $totalline=price2num($value['nb'] * ($fourn_unitprice * (1 - $fourn_remise_percent/100) - $fourn_remise), 'MT'); $total+=$totalline; print ''; // Best selling price @@ -382,10 +388,15 @@ if ($id > 0 || ! empty($ref)) { $pricesell='Variable'; } - $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); - $totalsell+=$totallinesell; + else + { + $totallinesell=price2num($value['nb'] * ($pricesell), 'MT'); + $totalsell+=$totallinesell; + } print ''; // Stock diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 9ea0176a553..9f11813fdee 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -302,10 +302,12 @@ if ($result) print '
'; print '
'.$langs->trans("AvailableFormats").'
'.img_picto_common($model->getDriverLabelForKey($key),$model->getPictoForKey($key)).'
trans("Label"); ?>
trans("Label"); ?>
trans("Label"); ?>
trans("Label"); ?>
' . $langs->trans("Duration") . '  '; - print ''.$langs->trans("Hour").' '; + print ''.$langs->trans("Minute").' '; + print ''.$langs->trans("Hour").' '; print ''.$langs->trans("Day").' '; print ''.$langs->trans("Week").' '; print ''.$langs->trans("Month").' '; @@ -1094,7 +1095,7 @@ else } // Other attributes - $parameters=array('cols' => 3); + $parameters=array('colspan' => 3); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) @@ -1401,6 +1402,8 @@ else // Duration print '
'.$langs->trans("Duration").''; print '  '; + print 'duration_unit=='i'?' checked':'').'>'.$langs->trans("Minute"); + print '  '; print 'duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour"); print '  '; print 'duration_unit=='d'?' checked':'').'>'.$langs->trans("Day"); @@ -1807,11 +1810,11 @@ else print '
'.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { - $dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); + $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years")); } else if ($object->duration_value > 0) { - $dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); + $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); } print (! empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ae2d3a4e8b1..7d7cbf7c282 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -275,14 +275,10 @@ class Product extends CommonObject public $fk_price_expression; - /** - * @deprecated - * @see fourn_pu - */ - public $buyprice; + /* To store supplier price found */ public $fourn_pu; - public $fourn_price_base_type; + public $fourn_socid; /** * @deprecated @@ -1544,6 +1540,7 @@ class Product extends CommonObject $this->buyprice = $obj->price; // deprecated $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product of supplier $this->fourn_price_base_type = 'HT'; // Price base type + $this->fourn_socid = $obj->fk_soc; // Company that offer this price $this->ref_fourn = $obj->ref_fourn; // deprecated $this->ref_supplier = $obj->ref_fourn; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed @@ -1599,6 +1596,7 @@ class Product extends CommonObject $this->fourn_qty = $obj->quantity; // min quantity for price for a virtual supplier $this->fourn_pu = $obj->price / $obj->quantity; // Unit price of product for a virtual supplier $this->fourn_price_base_type = 'HT'; // Price base type for a virtual supplier + $this->fourn_socid = $obj->fk_soc; // Company that offer this price $this->ref_fourn = $obj->ref_supplier; // deprecated $this->ref_supplier = $obj->ref_supplier; // Ref supplier $this->remise_percent = $obj->remise_percent; // remise percent if present and not typed diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 2167f15a7e5..a1cd63eea12 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2007 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005 Eric Seigne - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Raphaël Doursenaud @@ -342,6 +342,7 @@ if ($id > 0 || ! empty($ref)) $class='pair'; + $totalsell=0; if (count($prods_arbo)) { foreach($prods_arbo as $value) @@ -369,11 +370,16 @@ if ($id > 0 || ! empty($ref)) } print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($product_fourn->fourn_unitprice,'','',0,0,-1,$conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($fourn_unitprice,'','',0,0,-1,$conf->currency)); print ''; - print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '').price($pricesell,'','',0,0,-1,$conf->currency)); + print ($notdefined?'':($value['nb']> 1 ? $value['nb'].'x' : '')); + if (is_numeric($pricesell)) print price($pricesell,'','',0,0,-1,$conf->currency); + else print $langs->trans($pricesell); print '
'; - $colnb=5; + $colnb=4; if (empty($conf->global->PRODUIT_MULTIPRICES)) $colnb++; - print ''; + print ''; + print ''; while ($i < $num) { diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index ee914971857..8c768c67f0b 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -33,6 +33,7 @@ $langs->loadLangs(array("stocks","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 3a483291a75..74422cc2601 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -333,7 +333,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter = ''; diff --git a/htdocs/product/list.php b/htdocs/product/list.php index de4051a933c..d1ea3d08a4c 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -242,751 +242,743 @@ if (empty($reshook)) $htmlother=new FormOther($db); -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) -{ - $objcanvas->assign_values($action); // This must contains code to load data (must call LoadListDatas($limit, $offset, $sortfield, $sortorder)) - $objcanvas->display_canvas($action); // This is code to show template -} -else -{ - $title=$langs->trans("ProductsAndServices"); +$title=$langs->trans("ProductsAndServices"); - if ($search_type != '' && $search_type != '-1') +if ($search_type != '' && $search_type != '-1') +{ + if ($search_type == 1) { - if ($search_type == 1) - { - $texte = $langs->trans("Services"); - } - else - { - $texte = $langs->trans("Products"); - } + $texte = $langs->trans("Services"); } else { - $texte = $langs->trans("ProductsAndServices"); + $texte = $langs->trans("Products"); } +} +else +{ + $texte = $langs->trans("ProductsAndServices"); +} - $sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; - $sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; - $sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; - $sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; - $sql.= ' MIN(pfp.unitprice) as minsellprice'; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { - $sql .= ', pac.rowid prod_comb_id'; - } - // Add fields from extrafields - if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); - } - // Add fields from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; - 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)"; - if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; - // multilang - if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; - } +$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,'; +$sql.= ' p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; +$sql.= ' p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy,'; +$sql.= ' p.datec as date_creation, p.tms as date_update, p.pmp,'; +$sql.= ' MIN(pfp.unitprice) as minsellprice'; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { + $sql .= ', pac.rowid prod_comb_id'; +} +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); +} +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; +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)"; +if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product"; +// multilang +if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$langs->getDefaultLang() ."'"; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; +} - $sql.= ' WHERE p.entity IN ('.getEntity('product').')'; - if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); - // if the type is not 1, we show all products (type = 0,2,3) - if (dol_strlen($search_type) && $search_type != '-1') +$sql.= ' WHERE p.entity IN ('.getEntity('product').')'; +if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); +// if the type is not 1, we show all products (type = 0,2,3) +if (dol_strlen($search_type) && $search_type != '-1') +{ + if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; + else $sql.= " AND p.fk_product_type <> 1"; +} +if ($search_ref) $sql .= natural_search('p.ref', $search_ref); +if ($search_label) $sql .= natural_search('p.label', $search_label); +if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); +if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell); +if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy); +if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; +if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; +if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; +if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ); +if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; +if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; +if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch); +if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell); +if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= " AND pac.rowid IS NULL"; +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; +$sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; +$sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp'; +if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= ', pac.rowid'; +// Add fields from extrafields +if (! empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); +} +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +//if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet +$sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 { - if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; - else $sql.= " AND p.fk_product_type <> 1"; + $page = 0; + $offset = 0; } - if ($search_ref) $sql .= natural_search('p.ref', $search_ref); - if ($search_label) $sql .= natural_search('p.label', $search_label); - if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode); - if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND p.tosell = ".$db->escape($search_tosell); - if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND p.tobuy = ".$db->escape($search_tobuy); - if (dol_strlen($canvas) > 0) $sql.= " AND p.canvas = '".$db->escape($canvas)."'"; - if ($catid > 0) $sql.= " AND cp.fk_categorie = ".$catid; - if ($catid == -2) $sql.= " AND cp.fk_categorie IS NULL"; - if ($search_categ > 0) $sql.= " AND cp.fk_categorie = ".$db->escape($search_categ); - if ($search_categ == -2) $sql.= " AND cp.fk_categorie IS NULL"; - if ($fourn_id > 0) $sql.= " AND pfp.fk_soc = ".$fourn_id; - if ($search_tobatch != '' && $search_tobatch >= 0) $sql.= " AND p.tobatch = ".$db->escape($search_tobatch); - if ($search_accountancy_code_sell) $sql.= natural_search('p.accountancy_code_sell', $search_accountancy_code_sell); - if ($search_accountancy_code_buy) $sql.= natural_search('p.accountancy_code_buy', $search_accountancy_code_buy); - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= " AND pac.rowid IS NULL"; - // Add where from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; - // Add where from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - $sql.= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,"; - $sql.= " p.fk_product_type, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,"; - $sql.= ' p.datec, p.tms, p.entity, p.tobatch, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export, p.accountancy_code_buy, p.pmp'; - if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_type === 0)) $sql .= ', pac.rowid'; - // Add fields from extrafields - if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); - } - // Add fields from hooks - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldSelect',$parameters); // Note that $action and $object may have been modified by hook - $sql.=$hookmanager->resPrint; - //if (GETPOST("toolowstock")) $sql.= " HAVING SUM(s.reel) < p.seuil_stock_alerte"; // Not used yet - $sql.= $db->order($sortfield,$sortorder); +} - $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +$sql.= $db->plimit($limit + 1, $offset); + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + + $arrayofselected=is_array($toselect)?$toselect:array(); + + if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id); + exit; + } + + $helpurl=''; + if ($search_type != '') + { + if ($search_type == 0) { - $page = 0; - $offset = 0; + $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; + } + else if ($search_type == 1) + { + $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } } - $sql.= $db->plimit($limit + 1, $offset); + llxHeader('',$title,$helpurl,''); - $resql = $db->query($sql); - if ($resql) + // Displays product removal confirmation + if (GETPOST('delprod')) { + setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); + } + + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.="&sall=".urlencode($sall); + if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); + if ($search_ref) $param="&search_ref=".urlencode($search_ref); + if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):""); + if ($search_label) $param.="&search_label=".urlencode($search_label); + if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell); + if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy); + if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); + if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); + if ($type != '') $param.='&type='.urlencode($type); + if ($search_type != '') $param.='&search_type='.urlencode($search_type); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier); + if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); + if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + + // List of mass actions available + $arrayofmassactions = array( + //'presend'=>$langs->trans("SendByMail"), + //'builddoc'=>$langs->trans("PDFMerge"), + ); + if ($user->rights->produit->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); + if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); + $massactionbutton=$form->selectMassAction('', $arrayofmassactions); + + $newcardbutton=''; + $rightskey='produit'; + if($type == Product::TYPE_SERVICE) $rightskey='service'; + if($user->rights->{$rightskey}->creer) { - $num = $db->num_rows($resql); + $label='NewProduct'; + if($type == Product::TYPE_SERVICE) $label='NewService'; + $newcardbutton=''.$langs->trans($label).''; + $newcardbutton.= ''; + $newcardbutton.= ''; + } - $arrayofselected=is_array($toselect)?$toselect:array(); + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit); + + $topicmail="Information"; + $modelmail="product"; + $objecttmp=new Product($db); + $trackid='prod'.$object->id; + include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + + if (! empty($catid)) + { + print "
"; + $c = new Categorie($db); + $ways = $c->print_all_ways(' > ','product/list.php'); + print " > ".$ways[0]."
\n"; + print "

"; + } + + if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php')) + { + $fieldlist = $object->field_list; + $datas = $object->list_datas; + $picto='title.png'; + $title_picto = img_picto('',$picto); + $title_text = $title; + + // Default templates directory + $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/'; + // Check if a custom template is present + if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php')) + { + $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/'; + } + + include $template_dir.'list.tpl.php'; // Include native PHP templates + } + else + { + if ($sall) + { + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; + } + + // Filter on categories + $moreforfilter=''; + if (! empty($conf->categorie->enabled)) + { + $moreforfilter.='
'; + $moreforfilter.=$langs->trans('Categories'). ': '; + $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1); + $moreforfilter.='
'; + } + + //Show/hide child products. Hidden by default + if (!empty($conf->variants->enabled) && $search_type === 0) { + $moreforfilter.='
'; + $moreforfilter.= ''; + $moreforfilter.= ' '; + $moreforfilter.='
'; + } + + $parameters=array(); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint; + else $moreforfilter=$hookmanager->resPrint; + + if ($moreforfilter) + { + print '
'; + print $moreforfilter; + print '
'; + } + + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + + print '
'; + print '
'.$transRecordedType.'
'.$transRecordedType.''.$langs->trans("FullList").''; + print '
'."\n"; + + // Lines with input filters + print ''; + if (! empty($arrayfields['p.ref']['checked'])) + { + print ''; + } + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.label']['checked'])) + { + print ''; + } + // Type + if (! empty($arrayfields['p.fk_product_type']['checked'])) + { + print ''; + } + // Barcode + if (! empty($arrayfields['p.barcode']['checked'])) + { + print ''; + } + // Duration + if (! empty($arrayfields['p.duration']['checked'])) + { + print ''; + } + // Sell price + if (! empty($arrayfields['p.sellprice']['checked'])) + { + print ''; + } + // Minimum buying Price + if (! empty($arrayfields['p.minbuyprice']['checked'])) + { + print ''; + } + // Number buying Price + if (! empty($arrayfields['p.numbuyprice']['checked'])) + { + print ''; + } + // WAP + if (! empty($arrayfields['p.pmp']['checked'])) + { + print ''; + } + // Limit for alert + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) + { + print ''; + } + // Desired stock + if (! empty($arrayfields['p.desiredstock']['checked'])) + { + print ''; + } + // Stock + if (! empty($arrayfields['p.stock']['checked'])) print ''; + // Stock + if (! empty($arrayfields['stock_virtual']['checked'])) print ''; + // To batch + if (! empty($arrayfields['p.tobatch']['checked'])) print ''; + // Accountancy code sell + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; + // Accountancy code sell + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['p.datec']['checked'])) + { + print ''; + } + // Date modification + if (! empty($arrayfields['p.tms']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tosell']['checked'])) + { + print ''; + } + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + } + print ''; + + print ''; + + print ''; + if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); + if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); + $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); + if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + + $product_static=new Product($db); + $product_fourn =new ProductFournisseur($db); + + $i = 0; + $totalarray=array(); + while ($i < min($num,$limit)) { $obj = $db->fetch_object($resql); - $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id); - exit; - } - $helpurl=''; - if ($search_type != '') - { - if ($search_type == 0) + // Multilangs + if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active { - $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - } - else if ($search_type == 1) - { - $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; - } - } + $sql = "SELECT label"; + $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; + $sql.= " WHERE fk_product=".$obj->rowid; + $sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'"; + $sql.= " LIMIT 1"; - llxHeader('',$title,$helpurl,''); - - // Displays product removal confirmation - if (GETPOST('delprod')) { - setEventMessages($langs->trans("ProductDeleted", GETPOST('delprod')), null, 'mesgs'); - } - - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.="&sall=".urlencode($sall); - if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ); - if ($search_ref) $param="&search_ref=".urlencode($search_ref); - if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier); - if ($search_barcode) $param.=($search_barcode?"&search_barcode=".urlencode($search_barcode):""); - if ($search_label) $param.="&search_label=".urlencode($search_label); - if ($search_tosell != '') $param.="&search_tosell=".urlencode($search_tosell); - if ($search_tobuy != '') $param.="&search_tobuy=".urlencode($search_tobuy); - if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:""); - if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):""); - if ($type != '') $param.='&type='.urlencode($type); - if ($search_type != '') $param.='&search_type='.urlencode($search_type); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier); - if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell); - if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy); - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - - // List of mass actions available - $arrayofmassactions = array( - //'presend'=>$langs->trans("SendByMail"), - //'builddoc'=>$langs->trans("PDFMerge"), - ); - if ($user->rights->produit->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); - if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); - $massactionbutton=$form->selectMassAction('', $arrayofmassactions); - - $newcardbutton=''; - $rightskey='produit'; - if($type == Product::TYPE_SERVICE) $rightskey='service'; - if($user->rights->{$rightskey}->creer) - { - $label='NewProduct'; - if($type == Product::TYPE_SERVICE) $label='NewService'; - $newcardbutton=''.$langs->trans($label).''; - $newcardbutton.= ''; - $newcardbutton.= ''; - } - - print ''; - if ($optioncss != '') print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - if (empty($arrayfields['p.fk_product_type']['checked'])) print ''; - - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_products.png', 0, $newcardbutton, '', $limit); - - $topicmail="Information"; - $modelmail="product"; - $objecttmp=new Product($db); - $trackid='prod'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - if (! empty($catid)) - { - print "
"; - $c = new Categorie($db); - $ways = $c->print_all_ways(' > ','product/list.php'); - print " > ".$ways[0]."
\n"; - print "

"; - } - - if (! empty($canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$canvas.'/actions_card_'.$canvas.'.class.php')) - { - $fieldlist = $object->field_list; - $datas = $object->list_datas; - $picto='title.png'; - $title_picto = img_picto('',$picto); - $title_text = $title; - - // Default templates directory - $template_dir = DOL_DOCUMENT_ROOT . '/product/canvas/'.$canvas.'/tpl/'; - // Check if a custom template is present - if (file_exists(DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/list.tpl.php')) - { - $template_dir = DOL_DOCUMENT_ROOT . '/theme/'.$conf->theme.'/tpl/product/'.$canvas.'/'; + $result = $db->query($sql); + if ($result) + { + $objtp = $db->fetch_object($result); + if (! empty($objtp->label)) $obj->label = $objtp->label; + } } - include $template_dir.'list.tpl.php'; // Include native PHP templates - } - else - { - if ($sall) + $product_static->id = $obj->rowid; + $product_static->ref = $obj->ref; + $product_static->ref_fourn = $obj->ref_supplier; + $product_static->label = $obj->label; + $product_static->type = $obj->fk_product_type; + $product_static->status_buy = $obj->tobuy; + $product_static->status = $obj->tosell; + $product_static->status_batch = $obj->tobatch; + $product_static->entity = $obj->entity; + $product_static->pmp = $obj->pmp; + $product_static->accountancy_code_sell = $obj->accountancy_code_sell; + $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export; + $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; + $product_static->accountancy_code_buy = $obj->accountancy_code_buy; + + if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service + { + $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() + } } - // Filter on categories - $moreforfilter=''; - if (! empty($conf->categorie->enabled)) - { - $moreforfilter.='
'; - $moreforfilter.=$langs->trans('Categories'). ': '; - $moreforfilter.=$htmlother->select_categories(Categorie::TYPE_PRODUCT,$search_categ,'search_categ',1); - $moreforfilter.='
'; - } - //Show/hide child products. Hidden by default - if (!empty($conf->variants->enabled) && $search_type === 0) { - $moreforfilter.='
'; - $moreforfilter.= ''; - $moreforfilter.= ' '; - $moreforfilter.='
'; - } + print ''; - $parameters=array(); - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $moreforfilter.=$hookmanager->resPrint; - else $moreforfilter=$hookmanager->resPrint; - - if ($moreforfilter) - { - print '
'; - print $moreforfilter; - print '
'; - } - - $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - - print '
'; - print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); + print $form->selectarray('search_type', $array, $search_type); + print ''; + print ''; + print ''; + print ' '; + print ''; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print ''; + print ' '; + print '  '.$form->selectyesno($search_tobatch, '', '', '', 1).''; + print ''; + print ''; + print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1); + print ''; + print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1); + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'."\n"; - - // Lines with input filters - print ''; + // Ref if (! empty($arrayfields['p.ref']['checked'])) { - print ''; + print '\n"; + if (! $i) $totalarray['nbfield']++; } + // Ref supplier if (! empty($arrayfields['pfp.ref_fourn']['checked'])) { - print ''; + print '\n"; + if (! $i) $totalarray['nbfield']++; } + // Label if (! empty($arrayfields['p.label']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Type if (! empty($arrayfields['p.fk_product_type']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Barcode if (! empty($arrayfields['p.barcode']['checked'])) { - print ''; + print ''; + if (! $i) $totalarray['nbfield']++; } + // Duration if (! empty($arrayfields['p.duration']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } + // Sell price if (! empty($arrayfields['p.sellprice']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } - // Minimum buying Price + + // Better buy price if (! empty($arrayfields['p.minbuyprice']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } - // Number buying Price + + // Number of buy prices if (! empty($arrayfields['p.numbuyprice']['checked'])) { - print ''; } + // WAP if (! empty($arrayfields['p.pmp']['checked'])) { - print ''; } - // Limit for alert + + // Limit alert if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Desired stock if (! empty($arrayfields['p.desiredstock']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; + } + // Stock real + if (! empty($arrayfields['p.stock']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Stock virtual + if (! empty($arrayfields['stock_virtual']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Lot/Serial + if (! empty($arrayfields['p.tobatch']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; } - // Stock - if (! empty($arrayfields['p.stock']['checked'])) print ''; - // Stock - if (! empty($arrayfields['stock_virtual']['checked'])) print ''; - // To batch - if (! empty($arrayfields['p.tobatch']['checked'])) print ''; // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print ''; + if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters=array('arrayfields'=>$arrayfields); - $reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (! empty($arrayfields['p.datec']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } // Date modification if (! empty($arrayfields['p.tms']['checked'])) { - print ''; + if (! $i) $totalarray['nbfield']++; } + + // Status (to sell) if (! empty($arrayfields['p.tosell']['checked'])) { - print ''; - } - if (! empty($arrayfields['p.tobuy']['checked'])) - { - print ''; - } - print ''; - - print ''; - - print ''; - if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"],"p.ref","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) print_liste_field_titre($arrayfields['pfp.ref_fourn']['label'], $_SERVER["PHP_SELF"],"pfp.ref_fourn","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"],"p.label","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.fk_product_type']['checked'])) print_liste_field_titre($arrayfields['p.fk_product_type']['label'], $_SERVER["PHP_SELF"],"p.fk_product_type","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.barcode']['checked'])) print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"],"p.barcode","",$param,"",$sortfield,$sortorder); - if (! empty($arrayfields['p.duration']['checked'])) print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"],"p.duration","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.sellprice']['checked'])) print_liste_field_titre($arrayfields['p.sellprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.minbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.minbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.numbuyprice']['checked'])) print_liste_field_titre($arrayfields['p.numbuyprice']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.pmp']['checked'])) print_liste_field_titre($arrayfields['p.pmp']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) print_liste_field_titre($arrayfields['p.seuil_stock_alerte']['label'], $_SERVER["PHP_SELF"],"p.seuil_stock_alerte","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.desiredstock']['checked'])) print_liste_field_titre($arrayfields['p.desiredstock']['label'], $_SERVER["PHP_SELF"],"p.desiredstock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.stock']['checked'])) print_liste_field_titre($arrayfields['p.stock']['label'], $_SERVER["PHP_SELF"],"p.stock","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['stock_virtual']['checked'])) print_liste_field_titre($arrayfields['stock_virtual']['label'], $_SERVER["PHP_SELF"],"","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobatch']['checked'])) print_liste_field_titre($arrayfields['p.tobatch']['label'], $_SERVER["PHP_SELF"],"p.tobatch","",$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_sell']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_sell","",$param,'',$sortfield,$sortorder); - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) print_liste_field_titre($arrayfields['p.accountancy_code_buy']['label'], $_SERVER["PHP_SELF"],"p.accountancy_code_buy","",$param,'',$sortfield,$sortorder); - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - // Hook fields - $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); - $reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'],$_SERVER["PHP_SELF"],"p.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tosell']['checked'])) print_liste_field_titre($arrayfields['p.tosell']['label'],$_SERVER["PHP_SELF"],"p.tosell","",$param,'align="right"',$sortfield,$sortorder); - if (! empty($arrayfields['p.tobuy']['checked'])) print_liste_field_titre($arrayfields['p.tobuy']['label'],$_SERVER["PHP_SELF"],"p.tobuy","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - - - $product_static=new Product($db); - $product_fourn =new ProductFournisseur($db); - - $i = 0; - $totalarray=array(); - while ($i < min($num,$limit)) - { - $obj = $db->fetch_object($resql); - - // Multilangs - if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active - { - $sql = "SELECT label"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_lang"; - $sql.= " WHERE fk_product=".$obj->rowid; - $sql.= " AND lang='". $db->escape($langs->getDefaultLang()) ."'"; - $sql.= " LIMIT 1"; - - $result = $db->query($sql); - if ($result) - { - $objtp = $db->fetch_object($result); - if (! empty($objtp->label)) $obj->label = $objtp->label; - } - } - - $product_static->id = $obj->rowid; - $product_static->ref = $obj->ref; - $product_static->ref_fourn = $obj->ref_supplier; - $product_static->label = $obj->label; - $product_static->type = $obj->fk_product_type; - $product_static->status_buy = $obj->tobuy; - $product_static->status = $obj->tosell; - $product_static->status_batch = $obj->tobatch; - $product_static->entity = $obj->entity; - $product_static->pmp = $obj->pmp; - $product_static->accountancy_code_sell = $obj->accountancy_code_sell; - $product_static->accountancy_code_sell_export = $obj->accountancy_code_sell_export; - $product_static->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; - $product_static->accountancy_code_buy = $obj->accountancy_code_buy; - - if ((! empty($conf->stock->enabled) && $user->rights->stock->lire && $search_type != 1) || ! empty($conf->global->STOCK_DISABLE_OPTIM_LOAD)) // To optimize call of load_stock - { - if ($obj->fk_product_type != 1 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) // Not a service - { - $product_static->load_stock('nobatch'); // Load stock_reel + stock_warehouse. This also call load_virtual_stock() - } - } - - - print ''; - - // Ref - if (! empty($arrayfields['p.ref']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - // Ref supplier - if (! empty($arrayfields['pfp.ref_fourn']['checked'])) - { - print '\n"; - if (! $i) $totalarray['nbfield']++; - } - // Label - if (! empty($arrayfields['p.label']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Type - if (! empty($arrayfields['p.fk_product_type']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Barcode - if (! empty($arrayfields['p.barcode']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Duration - if (! empty($arrayfields['p.duration']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Sell price - if (! empty($arrayfields['p.sellprice']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Better buy price - if (! empty($arrayfields['p.minbuyprice']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Number of buy prices - if (! empty($arrayfields['p.numbuyprice']['checked'])) - { - print ''; - } - - // WAP - if (! empty($arrayfields['p.pmp']['checked'])) - { - print ''; - } - - // Limit alert - if (! empty($arrayfields['p.seuil_stock_alerte']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Desired stock - if (! empty($arrayfields['p.desiredstock']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Stock real - if (! empty($arrayfields['p.stock']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Stock virtual - if (! empty($arrayfields['stock_virtual']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Lot/Serial - if (! empty($arrayfields['p.tobatch']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_sell']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Accountancy code sell - if (! empty($arrayfields['p.accountancy_code_buy']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); - $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Date creation - if (! empty($arrayfields['p.datec']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Date modification - if (! empty($arrayfields['p.tms']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - - // Status (to sell) - if (! empty($arrayfields['p.tosell']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Status (to buy) - if (! empty($arrayfields['p.tobuy']['checked'])) - { - print ''; - if (! $i) $totalarray['nbfield']++; - } - // Action - print ''; if (! $i) $totalarray['nbfield']++; - - print "\n"; - $i++; } + // Status (to buy) + if (! empty($arrayfields['p.tobuy']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Action + print ''; + if (! $i) $totalarray['nbfield']++; - $db->free($resql); - - print "
'; - print ''; - print ''; + print $product_static->getNomUrl(1); + print "'; - print ''; - print ''; + print $product_static->getNomUrl(1); + print "'; - print ''; - print ''.dol_trunc($obj->label,40).''; - $array=array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); - print $form->selectarray('search_type', $array, $search_type); - print ''.$obj->fk_product_type.''; - print ''; - print ''.$obj->barcode.''; - print ' '; + print ''; + if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration)) + { + if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); + elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); + elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); + elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); + //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); + else print $obj->duration; + } print ''; + print ''; + if ($obj->tosell) + { + if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC"); + else print price($obj->price).' '.$langs->trans("HT"); + } print ''; - print ' '; + print ''; + if ($obj->tobuy && $obj->minsellprice != '') + { + //print price($obj->minsellprice).' '.$langs->trans("HT"); + if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) + { + if ($product_fourn->product_fourn_price_id > 0) + { + if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); + print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); + } + else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } + } + } print ''; - print ' '; + print ''; + if ($obj->tobuy) + { + if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) + { + $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); + print $form->textwithpicto(count($productFournList),$htmltext); + } + } print ''; - print ' '; + print ''; + print price($product_static->pmp, 1, $langs); print ''; - print ' '; + print ''; + if ($obj->fk_product_type != 1) + { + print $obj->seuil_stock_alerte; + } print ''; - print ' '; + print ''; + if ($obj->fk_product_type != 1) + { + print $obj->desiredstock; + } print ''; + if ($obj->fk_product_type != 1) + { + if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; + print $product_static->stock_reel; + } + print ''; + if ($obj->fk_product_type != 1) + { + if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; + print $product_static->stock_theorique; + } + print ''; + print yn($obj->tobatch); + print '  '.$form->selectyesno($search_tobatch, '', '', '', 1).''.$obj->accountancy_code_sell.''.$obj->accountancy_code_buy.''; + print ''; + print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); print ''; + print ''; + print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); print ''; - print $form->selectarray('search_tosell', array('0'=>$langs->trans('ProductStatusNotOnSellShort'),'1'=>$langs->trans('ProductStatusOnSellShort')),$search_tosell,1); - print ''; - print $form->selectarray('search_tobuy', array('0'=>$langs->trans('ProductStatusNotOnBuyShort'),'1'=>$langs->trans('ProductStatusOnBuyShort')),$search_tobuy,1); - print ''; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'; - print $product_static->getNomUrl(1); - print "'; - print $product_static->getNomUrl(1); - print "'.dol_trunc($obj->label,40).''.$obj->fk_product_type.''.$obj->barcode.''; - if (preg_match('/([^a-z]+)[a-z]/i',$obj->duration)) - { - if (preg_match('/([^a-z]+)y/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); - elseif (preg_match('/([^a-z]+)m/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); - elseif (preg_match('/([^a-z]+)w/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek"); - elseif (preg_match('/([^a-z]+)d/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); - //elseif (preg_match('/([^a-z]+)h/i',$obj->duration,$regs)) print $regs[1].' '.$langs->trans("DurationHour"); - else print $obj->duration; - } - print ''; - if ($obj->tosell) - { - if ($obj->price_base_type == 'TTC') print price($obj->price_ttc).' '.$langs->trans("TTC"); - else print price($obj->price).' '.$langs->trans("HT"); - } - print ''; - if ($obj->tobuy && $obj->minsellprice != '') - { - //print price($obj->minsellprice).' '.$langs->trans("HT"); - if ($product_fourn->find_min_price_product_fournisseur($obj->rowid) > 0) - { - if ($product_fourn->product_fourn_price_id > 0) - { - if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire) - { - $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1); - print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent/100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"),$htmltext); - } - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); - } - } - } - print ''; - if ($obj->tobuy) - { - if (count($productFournList = $product_fourn->list_product_fournisseur_price($obj->rowid)) > 0) - { - $htmltext=$product_fourn->display_price_product_fournisseur(1, 1, 0, 1, $productFournList); - print $form->textwithpicto(count($productFournList),$htmltext); - } - } - print ''; - print price($product_static->pmp, 1, $langs); - print ''; - if ($obj->fk_product_type != 1) - { - print $obj->seuil_stock_alerte; - } - print ''; - if ($obj->fk_product_type != 1) - { - print $obj->desiredstock; - } - print ''; - if ($obj->fk_product_type != 1) - { - if ($obj->seuil_stock_alerte != '' && $product_static->stock_reel < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; - print $product_static->stock_reel; - } - print ''; - if ($obj->fk_product_type != 1) - { - if ($obj->seuil_stock_alerte != '' && $product_static->stock_theorique < (float) $obj->seuil_stock_alerte) print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; - print $product_static->stock_theorique; - } - print ''; - print yn($obj->tobatch); - print ''.$obj->accountancy_code_sell.''.$obj->accountancy_code_buy.''; - print dol_print_date($obj->date_creation, 'dayhour', 'tzuser'); - print ''; - print dol_print_date($obj->date_update, 'dayhour', 'tzuser'); - print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); - } else { - print $product_static->LibStatut($obj->tosell,5,0); - } - print ''; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); - } else { - print $product_static->LibStatut($obj->tobuy,5,1); - } - print ''; - if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - { - $selected=0; - if (in_array($obj->rowid, $arrayofselected)) $selected=1; - print ''; + print ''; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); + } else { + print $product_static->LibStatut($obj->tosell,5,0); } print '
'; + if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + print ajax_object_onoff($product_static, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); + } else { + print $product_static->LibStatut($obj->tobuy,5,1); + } + print ''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
"; - print ""; + print "
"; + print ""; } + print ''; +} +else +{ + dol_print_error($db); } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 4bade1db2cf..959f2377d9d 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Raphaël Doursenaud * @@ -57,6 +57,7 @@ $page = GETPOST("page",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page ; // Load sale and categ filters diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 7b82408cfc0..b4d14ef1231 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Ferran Marcet @@ -61,6 +61,7 @@ $page = GETPOST("page",'int'); if (! $sortfield) $sortfield="p.ref"; if (! $sortorder) $sortorder="ASC"; $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 $offset = $limit * $page ; // Load sale and categ filters diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 6ec624bb281..aba8655fae1 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -151,7 +151,7 @@ if ($result) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 02498dbe8ff..410396a152b 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -735,7 +735,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index d867848345d..7c18dc11281 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -82,6 +82,9 @@ if ($id > 0 || ! empty($ref)) $result = $object->fetch($id, $ref); } + +if(empty($id) && !empty($object->id)) $id = $object->id; + $modulepart='product'; // Get object canvas (By default, this is not defined, so standard usage of dolibarr) @@ -127,7 +130,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) if($maj_ok) { $pse = new ProductStockEntrepot($db); - if($pse->fetch('', GETPOST('id'), GETPOST('fk_entrepot')) > 0) { + if($pse->fetch('', $id, GETPOST('fk_entrepot')) > 0) { // Update $pse->seuil_stock_alerte = $seuil_stock_alerte; @@ -138,7 +141,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) // Create $pse->fk_entrepot = GETPOST('fk_entrepot'); - $pse->fk_product = GETPOST('id'); + $pse->fk_product = $id; $pse->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $pse->desiredstock = GETPOST('desiredstock'); if($pse->create($user) > 0) setEventMessage($langs->trans('ProductStockWarehouseCreated')); @@ -147,7 +150,7 @@ if ($action == 'addlimitstockwarehouse' && !empty($user->rights->produit->creer) } - header("Location: ".$_SERVER["PHP_SELF"]."?id=".GETPOST('id')); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -948,7 +951,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) if (!empty($user->rights->produit->creer)){ print '
'; print ''; - print ''; + print ''; } print ''; if (!empty($user->rights->produit->creer)){ @@ -965,7 +968,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) } $pse = new ProductStockEntrepot($db); - $lines = $pse->fetchAll(GETPOST('id')); + $lines = $pse->fetchAll($id); if (!empty($lines)) { @@ -978,7 +981,7 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE)) print ''; print ''; if (!empty($user->rights->produit->creer)){ - print ''; + print ''; } print ''; } diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 5ea3df84839..7c15b3fa7c5 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -302,7 +302,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } /*$moreforfilter = ''; diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index e8900d51bb4..c96e1c0f025 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2007 Rodolphe Quiedeville * Copyright (C) 2010-2012 Destailleur Laurent * Copyright (C) 2014 Henry Florian @@ -205,7 +205,7 @@ $linkback = 'rights->societe->client->voir && ! $user->socid) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->socid) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= ", ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= $this->buildWhere(); + // For external user, no check is done on company permission because readability is managed by public status of project and assignement. + //if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; $sql .= " AND t.fk_opp_status = cls.rowid"; $sql .= " AND t.fk_statut <> 0"; // We want historic also, so all projects not draft $sql .= " GROUP BY t.fk_opp_status, cls.code, cls.label"; @@ -78,22 +83,22 @@ class ProjectStats extends Stats $row = $this->db->fetch_row($resql); if ($i < $limit || $num == $limit) { - $label = (($langs->trans("OppStatus".$row[2]) != "OppStatus".$row[2]) ? $langs->trans("OppStatus".$row[2]) : $row[2]); + $label = (($langs->trans("OppStatus".$row[2]) != "OppStatus".$row[2]) ? $langs->trans("OppStatus".$row[2]) : $row[2]); $result[$i] = array( - $label. ' (' . price(price2num($row[0], 'MT'), 1, $langs, 1, -1, -1, $conf->currency) . ')', - $row[0] + $label. ' (' . price(price2num($row[0], 'MT'), 1, $langs, 1, -1, -1, $conf->currency) . ')', + $row[0] ); } else $other += $row[1]; - $i++; + $i++; } if ($num > $limit) $result[$i] = array ( - $langs->transnoentitiesnoconv("Other"), - $other + $langs->transnoentitiesnoconv("Other"), + $other ); - $this->db->free($resql); + $this->db->free($resql); } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(get_class($this) . '::' . __METHOD__ . ' ' . $this->error, LOG_ERR); @@ -119,9 +124,14 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb, SUM(t.opp_amount) as total, AVG(t.opp_amount) as avg,"; $sql.= " SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100) as weighted"; $sql.= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON cls.rowid = t.fk_opp_status"; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql.= $this->buildWhere(); + // For external user, no check is done on company permission because readability is managed by public status of project and assignement. + //if ($socid > 0) $sql.= " AND t.fk_soc = ".$socid; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; $sql.= " GROUP BY year"; $sql.= $this->db->order('year', 'DESC'); @@ -136,13 +146,21 @@ class ProjectStats extends Stats */ public function buildWhere() { + global $user; + $sqlwhere_str = ''; $sqlwhere = array(); + // Get list of project id allowed to user (in a string list separated by coma) + $object = new Project($this->db); + $projectsListId=''; + if (! $user->rights->projet->all->lire) $projectsListId = $object->getProjectsAuthorizedForUser($user,0,1,$user->socid); + $sqlwhere[] = ' t.entity IN (' . getEntity('project') . ')'; if (! empty($this->userid)) $sqlwhere[] = ' t.fk_user_resp=' . $this->userid; + // Forced filter on socid is similar to forced filter on project. TODO Use project assignement to allow to not use filter on project if (! empty($this->socid)) $sqlwhere[] = ' t.fk_soc=' . $this->socid; @@ -154,6 +172,8 @@ class ProjectStats extends Stats if (! empty($this->status)) $sqlwhere[] = " t.fk_opp_status IN (" . $this->status . ")"; + if (! $user->rights->projet->all->lire) $sqlwhere[] = " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users + if (count($sqlwhere) > 0) { $sqlwhere_str = ' WHERE ' . implode(' AND ', $sqlwhere); } @@ -165,7 +185,7 @@ class ProjectStats extends Stats * Return Project number by month for a year * * @param int $year Year to scan - * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month + * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ function getNbByMonth($year, $format=0) @@ -176,8 +196,9 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, COUNT(*) as nb"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -193,7 +214,7 @@ class ProjectStats extends Stats * Return the Project amount by month for a year * * @param int $year Year to scan - * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month + * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with amount by month */ function getAmountByMonth($year, $format=0) @@ -204,8 +225,9 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount)"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -230,45 +252,45 @@ class ProjectStats extends Stats { global $conf,$user,$langs; - if ($startyear > $endyear) return -1; + if ($startyear > $endyear) return -1; - $datay=array(); + $datay=array(); - // Search into cache - if (! empty($cachedelay)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; - } + // Search into cache + if (! empty($cachedelay)) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php'; + } - $newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache'; - $newmask='0644'; + $newpathofdestfile=$conf->user->dir_temp.'/'.get_class($this).'_'.__FUNCTION__.'_'.(empty($this->cachefilesuffix)?'':$this->cachefilesuffix.'_').$langs->defaultlang.'_user'.$user->id.'.cache'; + $newmask='0644'; - $nowgmt = dol_now(); + $nowgmt = dol_now(); - $foundintocache=0; - if ($cachedelay > 0) - { - $filedate=dol_filemtime($newpathofdestfile); - if ($filedate >= ($nowgmt - $cachedelay)) - { - $foundintocache=1; + $foundintocache=0; + if ($cachedelay > 0) + { + $filedate=dol_filemtime($newpathofdestfile); + if ($filedate >= ($nowgmt - $cachedelay)) + { + $foundintocache=1; - $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate; - } - else - { - dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); - } - } + $this->_lastfetchdate[get_class($this).'_'.__FUNCTION__]=$filedate; + } + else + { + dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); + } + } - // Load file into $data - if ($foundintocache) // Cache file found and is not too old - { - dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); - $data = json_decode(file_get_contents($newpathofdestfile), true); - } - else + // Load file into $data + if ($foundintocache) // Cache file found and is not too old + { + dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); + $data = json_decode(file_get_contents($newpathofdestfile), true); + } + else { $year=$startyear; while($year <= $endyear) @@ -327,8 +349,9 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, SUM(t.opp_amount * ".$this->db->ifsql("t.opp_percent IS NULL".($wonlostfilter?" OR cls.code IN ('WON','LOST')":""), '0', 't.opp_percent')." / 100)"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t LEFT JOIN ".MAIN_DB_PREFIX.'c_lead_status as cls ON t.fk_opp_status = cls.rowid'; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -425,7 +448,7 @@ class ProjectStats extends Stats * Return the Project transformation rate by month for a year * * @param int $year Year to scan - * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month + * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with amount by month */ function getTransformRateByMonth($year, $format=0) @@ -436,8 +459,9 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -448,8 +472,9 @@ class ProjectStats extends Stats $sql = "SELECT date_format(t.datec,'%m') as dm, count(t.opp_amount)"; $sql .= " FROM " . MAIN_DB_PREFIX . "projet as t"; - if (! $user->rights->societe->client->voir && ! $user->soc_id) - $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; + // No check is done on company permission because readability is managed by public status of project and assignement. + //if (! $user->rights->societe->client->voir && ! $user->soc_id) + // $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=" . $user->id; $sql .= $this->buildWhere(); $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 4177895bc7c..46f04b08932 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -687,13 +687,13 @@ class Task extends CommonObject * @param int $socid Third party id * @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists * @param string $filteronproj Filter on project ref or label - * @param string $filteronprojstatus Filter on project status + * @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated only) * @param string $morewherefilter Add more filter into where SQL request (must start with ' AND ...') * @param string $filteronprojuser Filter on user that is a contact of project * @param string $filterontaskuser Filter on user assigned to task * @return array Array of tasks */ - function getTasksArray($usert=null, $userp=null, $projectid=0, $socid=0, $mode=0, $filteronproj='', $filteronprojstatus=-1, $morewherefilter='',$filteronprojuser=0,$filterontaskuser=0) + function getTasksArray($usert=null, $userp=null, $projectid=0, $socid=0, $mode=0, $filteronproj='', $filteronprojstatus='-1', $morewherefilter='',$filteronprojuser=0,$filterontaskuser=0) { global $conf; @@ -769,7 +769,7 @@ class Task extends CommonObject if ($socid) $sql.= " AND p.fk_soc = ".$socid; if ($projectid) $sql.= " AND p.rowid in (".$projectid.")"; if ($filteronproj) $sql.= natural_search(array("p.ref", "p.title"), $filteronproj); - if ($filteronprojstatus > -1) $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")"; + if ($filteronprojstatus && $filteronprojstatus != '-1') $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")"; if ($morewherefilter) $sql.=$morewherefilter; $sql.= " ORDER BY p.ref, t.rang, t.dateo"; @@ -1828,10 +1828,10 @@ class Task extends CommonObject // For external user, no check is done on company because readability is managed by public status of project and assignement. //$socid=$user->societe_id; - + $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid); - + // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; @@ -1850,7 +1850,7 @@ class Task extends CommonObject if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser // if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; - + //print $sql; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 990e7bb3dde..779091d069f 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -297,7 +297,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = c // We'll need this table joined to the select in order to filter by categ if (! empty($search_categ)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_project as cs ON p.rowid = cs.fk_project"; // We'll need this table joined to the select in order to filter by categ // We'll need this table joined to the select in order to filter by sale -// For external user, no check is done on company permission because readability is managed by public status of project and assignement. +// No check is done on company permission because readability is managed by public status of project and assignement. //if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_sale > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; if ($search_project_user > 0) @@ -307,7 +307,7 @@ if ($search_project_user > 0) $sql.= " WHERE p.entity IN (".getEntity('project').')'; if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; // public and assigned to, or restricted to company for external users // No need to check if company is external user, as filtering of projects must be done by getProjectsAuthorizedForUser -if ($socid > 0) $sql.= " AND (p.fk_soc = ".$socid.")"; +if ($socid > 0) $sql.= " AND (p.fk_soc = ".$socid.")"; // This filter if when we use a hard coded filter on company on url (not related to filter for external users) if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ); if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_ref) $sql .= natural_search('p.ref', $search_ref); @@ -355,8 +355,10 @@ if ($search_opp_status) if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL"; } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); -if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; // For external user, no check is done on company permission because readability is managed by public status of project and assignement. +//if ($socid > 0) $sql.= " AND s.rowid = ".$socid; +if ($search_sale > 0) $sql.= " AND sc.fk_user = " .$search_sale; +// No check is done on company permission because readability is managed by public status of project and assignement. //if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; if ($search_project_user > 0) $sql.= " AND ecp.fk_c_type_contact IN (".join(',',array_keys($listofprojectcontacttype)).") AND ecp.element_id = p.rowid AND ecp.fk_socpeople = ".$search_project_user; if ($search_opp_amount != '') $sql .= natural_search('p.opp_amount', $search_opp_amount, 1); @@ -485,7 +487,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 4adcb95d207..5af0d6da9e5 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -462,7 +462,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // List of projects print '
'; print ''; print ''; - print ''; + print ''; print ''."\n"; while ($i < $num) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ec31cefdd52..ac08d1251e2 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -91,9 +91,9 @@ $search_level_to = GETPOST("search_level_to","alpha"); $search_stcomm=GETPOST('search_stcomm','int'); $search_import_key = GETPOST("search_import_key","alpha"); -$type=GETPOST('type'); +$type=GETPOST('type','alpha'); $optioncss=GETPOST('optioncss','alpha'); -$mode=GETPOST("mode"); +$mode=GETPOST("mode",''); $diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; @@ -108,9 +108,9 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } -if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } -if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } +if ($type == 'c') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } +if ($type == 'p') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } +if ($type == 'f') { if (empty($contextpage) || $contextpage == 'thirdpartylist') $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new Societe($db); @@ -533,20 +533,20 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$langs->trans("ThirdParty"),$help_url); $param=''; -if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; -if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_all != '') $param = "&sall=".urlencode($search_all); if ($sall != '') $param.= "&sall=".urlencode($sall); -if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); -if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); -if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); +if ($search_categ_cus > 0) $param.= '&search_categ_cus='.urlencode($search_categ_cus); +if ($search_categ_sup > 0) $param.= '&search_categ_sup='.urlencode($search_categ_sup); +if ($search_sale > 0) $param.= '&search_sale='.urlencode($search_sale); if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); if ($search_town != '') $param.= "&search_town=".urlencode($search_town); if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); -if ($search_fax != '') $param.= "&search_fax=".urlencode($search_fax); +if ($search_fax != '') $param.= "&search_fax=".urlencode($search_fax); if ($search_email != '') $param.= "&search_email=".urlencode($search_email); if ($search_url != '') $param.= "&search_url=".urlencode($search_url); if ($search_state != '') $param.= "&search_state=".urlencode($search_state); @@ -642,7 +642,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } // Filter on categories diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 2ff40f83764..3ce1477a9c3 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -343,7 +343,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } /*$moreforfilter = ''; diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 1e9eb7a5181..c61de994874 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -46,11 +46,11 @@ $stripearrayofkeysbyenv = array( $stripearrayofkeys = array(); if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox','alpha')) { - $stripearrayofkeys = $stripearrayofkeysbyenv[0]; + $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test } else { - $stripearrayofkeys = $stripearrayofkeysbyenv[1]; + $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } \Stripe\Stripe::setApiKey($stripearrayofkeys['secret_key']); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 113ef3db88c..e3e91b6c38f 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -589,21 +589,34 @@ if (empty($reshook)) $productsupplier = new ProductFournisseur($db); $idprod=0; - if (GETPOST('idprodfournprice') == -1 || GETPOST('idprodfournprice') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) + if (GETPOST('idprodfournprice','alpha') == -1 || GETPOST('idprodfournprice','alpha') == '') $idprod=-99; // Same behaviour than with combolist. When not select idprodfournprice is now -99 (to avoid conflict with next action that may return -1, -2, ...) - if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice'), $reg)) + if (preg_match('/^idprod_([0-9]+)$/', GETPOST('idprodfournprice','alpha'), $reg)) { $idprod=$reg[1]; $res=$productsupplier->fetch($idprod); - // Call to init properties of $productsupplier + // Call to init some price properties of $productsupplier // So if a supplier price already exists for another thirdparty (first one found), we use it as reference price - $productsupplier->get_buyprice(0, -1, $idprod, 'none'); // We force qty to -1 to be sure to find if a supplier price exist + if (! empty($conf->global->SUPPLIER_TAKE_FIRST_PRICE_IF_NO_PRICE_FOR_CURRENT_SUPPLIER)) + { + $fksoctosearch = 0; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + if ($productsupplier->fourn_socid != $socid) // The price we found is for another supplier, so we clear supplier price + { + $productsupplier->ref_supplier = ''; + } + } + else + { + $fksoctosearch = $object->thirdparty->id; + $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist + } } - elseif (GETPOST('idprodfournprice') > 0) + elseif (GETPOST('idprodfournprice','alpha') > 0) { //$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. $qtytosearch=-1; // We force qty to -1 to be sure to find if a supplier price exist - $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice'), $qtytosearch); + $idprod=$productsupplier->get_buyprice(GETPOST('idprodfournprice','alpha'), $qtytosearch); $res=$productsupplier->fetch($idprod); } @@ -621,8 +634,8 @@ if (empty($reshook)) $ref_supplier = $productsupplier->ref_supplier; - $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); - $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice')); + $tva_tx = get_default_tva($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); + $tva_npr = get_default_npr($object->thirdparty, $mysoc, $productsupplier->id, GETPOST('idprodfournprice','alpha')); if (empty($tva_tx)) $tva_npr=0; $localtax1_tx= get_localtax($tva_tx, 1, $mysoc, $object->thirdparty, $tva_npr); $localtax2_tx= get_localtax($tva_tx, 2, $mysoc, $object->thirdparty, $tva_npr); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 4b012e31c2d..54672da2b75 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -12,6 +12,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2582,9 +2583,10 @@ class SupplierProposal extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $langs; @@ -2603,7 +2605,7 @@ class SupplierProposal extends CommonObject $modelpath = "core/modules/supplier_proposal/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 7ab88474bac..3dcf9601944 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -415,7 +415,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $i = 0; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 3d2fa9ca7d7..79aed1eaf68 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -36,7 +36,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Colors -$colorbackhmenu1='80,90,120'; // topmenu +$colorbackhmenu1='60,70,100'; // topmenu $colorbackvmenu1='248,248,248'; // vmenu $colortopbordertitle1='200,200,200'; // top border of title $colorbacktitle1='220,220,223'; // title of tables,list @@ -201,8 +201,8 @@ $nbtopmenuentries=$menumanager->showmenu('topnb'); $minwidthtmenu=66; /* minimum width for one top menu entry */ -$heightmenu=46; /* height of top menu, part with image */ -$heightmenu2=48; /* height of top menu, part with login */ +$heightmenu=48; /* height of top menu, part with image */ +$heightmenu2=49; /* height of top menu, part with login */ $disableimages = 0; $maxwidthloginblock = 130; if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) { $disableimages = 1; $maxwidthloginblock = 180; $minwidthtmenu=0; } @@ -285,8 +285,13 @@ input.select2-input { .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], -.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], +.liste_titre input[name=day_date_when], .liste_titre input[name=dayvalid], .liste_titre input[name=search_orderday], .liste_titre input[name=search_deliveryday], +.liste_titre input[name=search_sday], .liste_titre input[name=search_day], .liste_titre input[name=search_eday], .liste_titre input[name=sday], .liste_titre input[name=day], .liste_titre select[name=day], +.liste_titre input[name=day_lim], .liste_titre input[name=day_start], .liste_titre input[name=day_end], .liste_titre input[name=day_create], +.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], +.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], +.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] { margin-right: 4px; @@ -586,6 +591,9 @@ th .button { .soixantepercent { width: 60%; } +.quatrevingtquinzepercent { + width: 95%; +} textarea.centpercent { width: 96%; } @@ -689,6 +697,13 @@ div.divsearchfield { margin-bottom: 4px; padding-left: 2px; } +.divsearchfieldfilter { + text-overflow: clip; + overflow: auto; + white-space: nowrap; + padding-bottom: 5px; + opacity: 0.6; +} div.confirmmessage { padding-top: 6px; } @@ -801,6 +816,10 @@ select.flat.selectlimit { font-weight: bold; font-size: 1.4em; } +.amountpaymentneutral { + font-weight: bold; + font-size: 1.4em; +} .savingdocmask { margin-top: 6px; margin-bottom: 12px; @@ -1425,9 +1444,9 @@ div.statusrefbis { vertical-align: text-bottom; } img.photoref, div.photoref { - border: 1px solid #CCC; - -webkit-box-shadow: 2px 2px 4px #ccc; - box-shadow: 2px 2px 4px #ccc; + border: 1px solid #DDD; + -webkit-box-shadow: 0px 0px 6px #DDD; + box-shadow: 0px 0px 6px #DDD; padding: 4px; height: 80px; width: 80px; @@ -2049,6 +2068,8 @@ input.vmenusearchselectcombo[type=text] { #menu_contenu_logo { /* padding-top: 0; */ } .companylogo { } .searchform { padding-top: 10px; } +.searchform input { font-size: 16px; } + a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active, span.vmenu { white-space: nowrap; font-family: ; text-align: ; font-weight: bold; } font.vmenudisabled { font-family: ; text-align: ; font-weight: bold; color: #aaa; margin-left: 4px; } @@ -2385,22 +2406,26 @@ span.butAction, span.butActionDelete { cursor: pointer; } +.butAction { + background: rgb(230, 236, 230) + /* background: rgb(230, 232, 239); */ +} .butActionRefused, .butAction, .butAction:link, .butAction:visited, .butAction:hover, .butAction:active, .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active { text-decoration: none; text-transform: uppercase; font-weight: bold; - margin: 0em em !important; - padding: 0.6em em; + margin: 0em em !important; + padding: 0.6em em; font-family: ; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); display: inline-block; text-align: center; cursor: pointer; /* color: #fff; */ /* background: rgb(); */ - color: #000; - border: 1px solid #aaa; + color: #444; + /* border: 1px solid #aaa; */ + /* border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); */ border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; @@ -2415,13 +2440,13 @@ span.butAction, span.butActionDelete { margin: 0em 0.3em 0 0.3em !important; padding: 0.2em em 0.3em; font-family: ; - border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); display: inline-block; - text-align: center; + /* text-align: center; New button are on right of screen */ cursor: pointer; /*color: #fff !important; background: rgb(); border: 1px solid rgb();*/ + border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25); border-top-right-radius: 0 !important; border-bottom-right-radius: 0 !important; @@ -2437,8 +2462,8 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci } .butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete { - /* background: #633; */ - border: 1px solid #633; + background: rgb(239, 232, 230); + /* border: 1px solid #633; */ color: #633; } @@ -2454,14 +2479,17 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci white-space: nowrap !important; cursor: not-allowed !important; - margin: 0em em; - padding: 0.6em em; + margin: 0em em; + padding: 0.6em em; font-family: !important; display: inline-block; text-align: center; cursor: pointer; color: #999 !important; - border: 1px solid #bbb; + border: 1px solid #ccc; + box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; } .butActionNewRefused, .butActionNewRefused:link, .butActionNewRefused:visited, .butActionNewRefused:hover, .butActionNewRefused:active { text-decoration: none !important; @@ -2474,7 +2502,7 @@ a.butActionNewRefused>span.fa-plus-circle, a.butActionNewRefused>span.fa-plus-ci padding: 0.2em em; font-family: !important; display: inline-block; - text-align: center; + /* text-align: center; New button are on right of screen */ cursor: pointer; color: #999 !important; padding-top: 0.2em; @@ -2732,7 +2760,7 @@ div.refidpadding { } div.refid { font-weight: bold; - color: #625; + color: rgb(); font-size: 1.2em; } div.refidno { @@ -3162,7 +3190,7 @@ ul.noborder li:nth-child(even):not(.liste_titre) { background: #f8f8f8; border: 1px solid #eee; - box-shadow: 1px 1px 6px #bbb; + box-shadow: 1px 1px 8px #ddd; border-radius: 0px; } .boxstats, .boxstats130, .boxstatscontent { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3d24df3d6ee..a7c102d16eb 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -289,8 +289,13 @@ textarea.cke_source:focus .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create], .liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create], +.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], +.liste_titre input[name=day_date_when], .liste_titre input[name=dayvalid], .liste_titre input[name=search_orderday], .liste_titre input[name=search_deliveryday], +.liste_titre input[name=search_sday], .liste_titre input[name=search_day], .liste_titre input[name=search_eday], .liste_titre input[name=sday], .liste_titre input[name=day], .liste_titre select[name=day], +.liste_titre input[name=day_lim], .liste_titre input[name=day_start], .liste_titre input[name=day_end], .liste_titre input[name=day_create], +.liste_titre input[name=search_day_lim], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_create], +.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end], .liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when], -.liste_titre input[name=search_month_create], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end] .liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth] { margin-right: 4px; @@ -578,6 +583,9 @@ th .button { .soixantepercent { width: 60%; } +.quatrevingtquinzepercent { + width: 95%; +} textarea.centpercent { width: 96%; } @@ -682,6 +690,13 @@ div.divsearchfield { margin-bottom: 4px; padding-left: 2px; } +.divsearchfieldfilter { + text-overflow: clip; + overflow: auto; + white-space: nowrap; + padding-bottom: 5px; + opacity: 0.6; +} div.confirmmessage { padding-top: 6px; } @@ -792,6 +807,10 @@ select.flat.selectlimit { .amountremaintopayback { font-weight: bold; } +.amountpaymentneutral { + font-weight: bold; + font-size: 1.4em; +} .savingdocmask { margin-top: 6px; margin-bottom: 12px; @@ -853,11 +872,10 @@ div.fiche>form>div.div-table-responsive { flex: 1 1 150px; } .thumbstat, .thumbstat150 { - /* flex-grow: 1; */ - /* flex-shrink: 1; */ + flex-grow: 1; + flex-shrink: 1; /* flex-basis: 140px; */ - display: inline; - width: 100%; + min-width: 150px; justify-content: flex-start; align-self: flex-start; } @@ -2390,7 +2408,7 @@ span.butAction, span.butActionDelete { padding: 0.2em em; margin: 0em em; line-height: 20px; - text-align: center; + /* text-align: center; New button are on right of screen */ vertical-align: middle; cursor: pointer; /* color: #ffffff !important; */ @@ -2716,7 +2734,7 @@ div.refidpadding { } div.refid { font-weight: bold; - color: #766; + color: rgb(); font-size: 160%; } div.refidno { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 1f47ce11247..9207ea02860 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -80,12 +80,15 @@ $result = restrictedArea($user, 'ticket', $object->id); $triggermodname = 'TICKETSUP_MODIFY'; $permissiontoadd = $user->rights->ticket->write; +$actionobject = new ActionsTicket($db); /* * Actions */ +// TODO Replace actions with common includes actions_addupdatedelete.inc.php + if ($cancel) { if (! empty($backtopage)) @@ -96,8 +99,7 @@ if ($cancel) $action=''; } - -$actionobject = new ActionsTicket($db); +// Do action $actionobject->doActions($action, $object); // Action to update one extrafield diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index d654c763f9b..b3df986cde7 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -471,7 +471,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } print '
'; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index e58b7154487..e5c24fbac04 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1648,85 +1648,90 @@ else print '
'; - if (! empty($object->email)) + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { - $langs->load("mails"); - print ''; - } - else - { - $langs->load("mails"); - print ''; - } - - if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) + if (! empty($object->email)) { - print ''; + $langs->load("mails"); + print ''; } else { - print ''; + $langs->load("mails"); + print ''; } - } - elseif ($caneditpassword && ! $object->ldap_sid && - (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Si on a un gestionnaire de generation de mot de passe actif - if ($conf->global->USER_PASSWORD_GENERATED != 'none') - { - if ($object->statut == 0) + if ($caneditfield && (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + if (! empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) + { + print ''; + } + else + { + print ''; + } } - elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + elseif ($caneditpassword && ! $object->ldap_sid && + (empty($conf->multicompany->enabled) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + print ''; + } + + // Si on a un gestionnaire de generation de mot de passe actif + if ($conf->global->USER_PASSWORD_GENERATED != 'none') + { + if ($object->statut == 0) + { + print ''; + } + elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + print ''; + } + + if ($object->statut == 0) + { + print ''; + } + else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) + { + if ($object->email) print ''; + else print ''; + } + } + + // Activer + if ($user->id <> $id && $candisableuser && $object->statut == 0 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; + print ''; } - - if ($object->statut == 0) - { - print ''; - } - else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + // Desactiver + if ($user->id <> $id && $candisableuser && $object->statut == 1 && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - if ($object->email) print ''; - else print ''; + print ''; } - } - - // Activer - if ($user->id <> $id && $candisableuser && $object->statut == 0 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Desactiver - if ($user->id <> $id && $candisableuser && $object->statut == 1 && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - print ''; - } - // Delete - if ($user->id <> $id && $candisableuser && - ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) - { - if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin + // Delete + if ($user->id <> $id && $candisableuser && + ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { - print ''; - } - else - { - print ''; + if ($user->admin || ! $object->admin) // If user edited is admin, delete is possible on for an admin + { + print ''; + } + else + { + print ''; + } } } - + print "
\n"; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 032eb2112d8..5b7416dbaa6 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -10,6 +10,7 @@ * Copyright (C) 2013-2014 Philippe Grand * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -2976,9 +2977,10 @@ class User extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; @@ -2999,7 +3001,7 @@ class User extends CommonObject $modelpath = "core/modules/user/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } /** diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index def96bac0bd..2400c855a6d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2012 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2014 Alexis Algoud + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -952,9 +953,10 @@ class UserGroup extends CommonObject * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) + public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf,$user,$langs; @@ -975,7 +977,7 @@ class UserGroup extends CommonObject $modelpath = "core/modules/usergroup/doc/"; - return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } } diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index b478f99bd59..946ba132af8 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -162,13 +162,7 @@ if ($resql) if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); - } - - if ($sall) - { - foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 5dbec430687..6ace60c2fca 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -124,7 +124,9 @@ if ($resql) { $num = $db->num_rows($resql); print '
'.$line['seuil_stock_alerte'].''.$line['desiredstock'].''.img_delete().''.img_delete().'
'.$langs->trans("ChildOfProjectTask").''; - print $formother->selectProjectTasks(GETPOST('task_parent'),$projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1); + print $formother->selectProjectTasks(GETPOST('task_parent'), $projectid?$projectid:$object->id, 'task_parent', 0, 0, 1, 1, 0, '0,1', 'maxwidth500'); print '
'.$langs->trans("AffectedTo").''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 02549454e8e..14703f6d3eb 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -437,7 +437,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall).'
'; } $morehtmlfilter = ''; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index af30cf2ff57..a189781c8c1 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -208,6 +208,8 @@ if ((empty($paymentmethod) || $paymentmethod == 'stripe') && ! empty($conf->stri $validpaymentmethod['stripe']='valid'; } +// TODO Replace previous set of $validpaymentmethod with this line: +//$validpaymentmethod = getValidOnlinePaymentMethods($paymentmethod); // Check security token @@ -444,10 +446,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); + // Create Stripe customer include_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; $stripe = new Stripe($db); $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); + // Create Stripe card from Token $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); if (empty($card)) @@ -1559,7 +1563,7 @@ if (preg_match('/^dopayment/',$action)) ?> - // Create a Stripe client + // Create a Stripe client. var stripe = Stripe(''); // Create an instance of Elements @@ -1605,43 +1609,40 @@ if (preg_match('/^dopayment/',$action)) console.log(form); form.addEventListener('submit', function(event) { event.preventDefault(); - - global->STRIPE_USE_3DSECURE)) // Ask credit card directly, no 3DS test { ?> - /* Use token */ - stripe.createToken(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the token to your server - stripeTokenHandler(result.token); - } - }); + /* Use token */ + stripe.createToken(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the token to your server + stripeTokenHandler(result.token); + } + }); - /* Use 3DS source */ - stripe.createSource(card).then(function(result) { - if (result.error) { - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { - // Send the source to your server - stripeSourceHandler(result.source); - } - }); + /* Use 3DS source */ + stripe.createSource(card).then(function(result) { + if (result.error) { + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { + // Send the source to your server + stripeSourceHandler(result.source); + } + }); - }); diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index 349e19b0c26..d62c8a445d6 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -87,7 +87,7 @@ else if (! $searchkey) return; - $form = new Form($db); + if (! is_object($form)) $form = new Form($db); $arrayresult=$form->select_thirdparty_list(0, $htmlname, $filter, 1, $showtype, 0, null, $searchkey, $outjson); $db->close(); diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 508fe892ebe..b99257da275 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -122,6 +122,7 @@ class Contacts extends DolibarrApi $sql = "SELECT t.rowid"; $sql.= " FROM " . MAIN_DB_PREFIX . "socpeople as t"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX . "socpeople_extrafields as te ON te.fk_object = t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { // We need this table joined to the select in order to filter by sale $sql.= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 73c782ddf7c..2b355b56eb7 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -129,6 +129,7 @@ class Thirdparties extends DolibarrApi $sql = "SELECT t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql.= " FROM ".MAIN_DB_PREFIX."societe as t"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX . "societe_extrafields as te ON te.fk_object = t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 56cd37dc7d8..03bdedd3d4f 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -909,6 +909,8 @@ class Societe extends CommonObject $sql .= ",skype = ".(! empty($this->skype)?"'".$this->db->escape($this->skype)."'":"null"); $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null"); + $sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null"); + $sql .= ",note_private = ".(! empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); $sql .= ",note_public = ".(! empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index ea1925afc08..1bed6e635a0 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -296,7 +296,7 @@ if ($result) print '
'.$transRecordedType.' '.$langs->trans('Status').''.$langs->trans("FullList").'
'; - print ''; + print ''; + print ''; + print ''; $i = 0; while ($i < $num && $i < $max) @@ -233,11 +235,13 @@ if ($canreadperms) $resql=$db->query($sql); if ($resql) { - $colspan=2; + $colspan=1; if (! empty($conf->multicompany->enabled)) $colspan++; $num = $db->num_rows($resql); print '
'.$langs->trans("LastUsersCreated",min($num,$max)).'
'.$langs->trans("LastUsersCreated",min($num,$max)).''.$langs->trans("FullList").'
'; - print ''; + print ''; + print ''; + print ''; $i = 0; $grouptemp = new UserGroup($db); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 29a3d0fc647..a1f0cdd5471 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -298,7 +298,7 @@ print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sorto if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); - print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); + print '
'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'
'; } $moreforfilter=''; diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index d62adfb063b..25ff7215e5d 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -48,6 +48,7 @@ $langs->loadLangs(array("website","other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -106,8 +107,8 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to send emails - $trigger_name='MYOBJECT_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_MYOBJECT_TO'; + $trigger_name='WEBSITEACCOUNT_SENTBYMAIL'; + $autocopy='MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO'; $trackid='websiteaccount'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 74822e34d3c..c690d7b63ef 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -73,7 +73,7 @@ $error=0; $now=dol_now(); @set_time_limit(0); -print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . dol_print_date($now, 'dayrfc') . " *****\n"; +print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." ***** userlogin=" . $userlogin . " ***** " . dol_print_date($now, 'dayhourrfc') . " *****\n"; // Check module cron is activated if (empty($conf->cron->enabled)) diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 45b960878ab..cb745d9aff3 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -186,8 +186,13 @@ if ($result >= 0) foreach($ldapgroup[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] as $key => $userdn) { if($key === 'count') continue; if(empty($userList[$userdn])) { // Récupération de l'utilisateur - $userFilter = explode(',', $userdn); - $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS); + // Schéma rfc2307: les membres sont listés dans l'attribut memberUid sous form de login uniquement + if ($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS === 'memberUid'){ + $userKey = array($userdn); + } else { // Pour les autres schémas, les membres sont listés sous forme de DN complets + $userFilter = explode(',', $userdn); + $userKey = $ldap->getAttributeValues('('.$userFilter[0].')', $conf->global->LDAP_KEY_USERS); + } if(!is_array($userKey)) continue; $fuser = new User($db);
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).'
'.$langs->trans("LastGroupsCreated",($num ? $num : $max)).''.$langs->trans("FullList").'