Merge remote-tracking branch 'Dolibarr/develop' into develop

This commit is contained in:
Inovea Conseil 2018-06-28 11:36:23 +02:00
commit 6fd5c46dad
224 changed files with 2840 additions and 2217 deletions

View File

@ -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 *****

View File

@ -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';

View File

@ -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 '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
$button = '<input type="submit" name="exportcsv" class="butActionNew" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, '', $result, $result, 'title_accountancy', 0, $button);
$button = '<input type="submit" name="exportcsv" class="butAction" value="' . $langs->trans("Export") . ' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $options, $sortfield, $sortorder, $button, $result, $result, 'title_accountancy', 0);
$moreforfilter = '';

View File

@ -555,8 +555,9 @@ if ($action == 'create')
*/
print "</table>\n";
print '</div></div>';
print '</div>';
print '</div></div><!-ee-->';
dol_fiche_end();
print '<div style="clear:both"></div>';
@ -712,5 +713,6 @@ if ($action == 'create')
}
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -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 = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
// 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 . ')';
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") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';

View File

@ -169,9 +169,9 @@ print '<script type="text/javascript">
* Customer Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.rowid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
$sql.= " fd.situation_percent,";
$sql.= " co.label as country, s.tva_intra";
$parameters=array();
@ -179,7 +179,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
$sql.=$hookmanager->resPrint;
$sql.= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = fd.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
@ -343,8 +343,8 @@ if ($result) {
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
$product_static->type = $objp->line_type;
print '<tr class="oddeven">';

View File

@ -220,9 +220,9 @@ $sql.= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as l ON f.rowid = l.fk_facture";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_sell = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa2 ON p.accountancy_code_sell_intra = aa2.account_number AND aa2.fk_pcg_version = '" . $chartaccountcode."' AND aa2.entity = " . $conf->entity;
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa3 ON p.accountancy_code_sell_export = aa3.account_number AND aa3.fk_pcg_version = '" . $chartaccountcode."' AND aa3.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
// Add search filter like

View File

@ -68,33 +68,48 @@ $action = GETPOST('action','aZ09');
* Actions
*/
if ($action == 'clean' || $action == 'validatehistory')
{
// Clean database
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE erd.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 erd.fk_expensereport IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'expensereport 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 . "expensereport_det as erd";
$sqlclean .= " SET fk_code_ventilation = 0";
$sqlclean .= ' WHERE erd.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
if ($db->type == 'pgsql') {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
$sql1 .= " FROM " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "expensereport_det.fk_c_type_fees = t.id 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 t.accountancy_code = accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd, " . MAIN_DB_PREFIX . "c_type_fees as t, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst";
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
$sql1 .= " WHERE erd.fk_c_type_fees = t.id 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 t.accountancy_code=accnt.account_number";
$sql1 .= " AND erd.fk_code_ventilation = 0";
}
@ -124,26 +139,6 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
// Clean database
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql1 .= " SET fk_code_ventilation = 0";
$sql1 .= ' WHERE erd.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("DescVentilExpenseReport") . '<br>';
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';

View File

@ -102,10 +102,10 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
}
$db->begin();
if (! $error)
{
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
$sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0');
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';

View File

@ -193,7 +193,7 @@ $sql.= " aa.rowid as aarowid";
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "expensereport_det as erd ON er.rowid = erd.fk_expensereport";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON f.accountancy_code = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
// Add search filter like
if (strlen(trim($search_expensereport))) {

View File

@ -76,7 +76,7 @@ if ($conf->accounting->enabled)
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
print "<br>\n";
$step++;

View File

@ -69,33 +69,48 @@ $action = GETPOST('action','aZ09');
* Actions
*/
if ($action == 'clean' || $action == 'validatehistory')
{
// Clean database
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det 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_fourn IN (SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture_fourn 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 . "facture_fourn_det";
$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 . "facture_fourn_det.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS;
$sql1 .= " WHERE " . MAIN_DB_PREFIX . "facture_fourn_det.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_buy=accnt.account_number";
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
} else {
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det 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_buy=accnt.account_number";
$sql1 .= " AND fd.fk_code_ventilation = 0";
}
@ -125,26 +140,6 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
// Clean database
$db->begin();
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det 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("DescVentilSupplier") . '<br>';
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
print '<br>';

View File

@ -170,20 +170,19 @@ print '<script type="text/javascript">
* Supplier Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.ref as ref, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql.= " l.rowid, l.fk_product, l.product_type as line_type, l.description, l.total_ht , l.qty, l.tva_tx, l.vat_src_code,";
$sql.= " aa.label, aa.account_number, ";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
$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 . "facture_fourn_det as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql.= " AND aa.rowid = l.fk_code_ventilation";
if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
@ -349,8 +348,8 @@ if ($result) {
$product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id;
$product_static->type = $objp->type;
$product_static->label = $objp->product_label;
$product_static->type = $objp->line_type;
print '<tr class="oddeven">';

View File

@ -221,7 +221,7 @@ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn_det as l ON f.rowid = l.fk_facture_fourn";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."'";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON p.accountancy_code_buy = aa.account_number AND aa.fk_pcg_version = '" . $chartaccountcode."' AND aa.entity = " . $conf->entity;
$sql.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
$sql.= " AND l.product_type <= 2";
// Add search filter like

View File

@ -592,14 +592,14 @@ class Adherent extends CommonObject
$error++;
}
}
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('MEMBER_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if (! $error && ! $notrigger)
{
// Call trigger
$result=$this->call_trigger('MEMBER_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if (! $error)
@ -2159,9 +2159,10 @@ class Adherent 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;
@ -2180,7 +2181,7 @@ class Adherent extends CommonObject
$modelpath = "core/modules/member/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}

View File

@ -379,7 +379,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) . implode(', ',$fieldstosearchall);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
// Filter on categories

View File

@ -369,7 +369,6 @@ if ($conf->produit->enabled)
}
$modBarCode = new $file();
$var = !$var;
print '<tr class="oddeven">';
print '<td>'.(isset($modBarCode->name)?$modBarCode->name:$modBarCode->nom)."</td><td>\n";

View File

@ -183,7 +183,7 @@ $tabsql[10]= "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.l
$tabsql[11]= "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = " . getEntity($tabname[12]);
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = " . getEntity($tabname[13]);
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
$tabsql[16]= "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel";
$tabsql[17]= "SELECT id as rowid, code, label, accountancy_code, active FROM ".MAIN_DB_PREFIX."c_type_fees";
@ -261,7 +261,7 @@ $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_
$tabfield[11]= "element,source,code,libelle,position";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
$tabfield[13]= "code,libelle,type,entity";
$tabfield[14]= "code,libelle,price,organization,country_id,country";
$tabfield[14]= "code,label,price,organization,country_id,country";
$tabfield[15]= "code,libelle,width,height,unit";
$tabfield[16]= "code,libelle,sortorder";
$tabfield[17]= "code,label,accountancy_code";
@ -300,7 +300,7 @@ $tabfieldvalue[10]= "country,code,taux,localtax1_type,localtax1,localtax2_type,l
$tabfieldvalue[11]= "element,source,code,libelle,position";
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder";
$tabfieldvalue[13]= "code,libelle,type";
$tabfieldvalue[14]= "code,libelle,price,organization,country";
$tabfieldvalue[14]= "code,label,price,organization,country";
$tabfieldvalue[15]= "code,libelle,width,height,unit";
$tabfieldvalue[16]= "code,libelle,sortorder";
$tabfieldvalue[17]= "code,label,accountancy_code";
@ -339,7 +339,7 @@ $tabfieldinsert[10]= "fk_pays,code,taux,localtax1_type,localtax1,localtax2_type,
$tabfieldinsert[11]= "element,source,code,libelle,position";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
$tabfieldinsert[13]= "code,libelle,type,entity";
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
$tabfieldinsert[14]= "code,label,price,organization,fk_pays";
$tabfieldinsert[15]= "code,label,width,height,unit";
$tabfieldinsert[16]= "code,label,sortorder";
$tabfieldinsert[17]= "code,label,accountancy_code";
@ -419,7 +419,7 @@ $tabcond[10]= true;
$tabcond[11]= (! empty($conf->societe->enabled));
$tabcond[12]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
$tabcond[13]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled));
$tabcond[14]= (! empty($conf->product->enabled) && ! empty($conf->ecotax->enabled));
$tabcond[14]= (! empty($conf->product->enabled) && (! empty($conf->ecotax->enabled) || ! empty($conf->global->MAIN_SHOW_ECOTAX_DICTIONNARY)));
$tabcond[15]= true;
$tabcond[16]= (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
$tabcond[17]= (! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled));

View File

@ -75,7 +75,7 @@ print "<br>\n";
$head = order_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("OrderLines"), -1, 'order');
dol_fiche_head($head, 'attributeslines', $langs->trans("Orders"), -1, 'order');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -317,7 +317,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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'</div>';
}
$moreforfilter = '';

View File

@ -679,7 +679,8 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").' <span class="badge">'.$num.'</span></a></td>';
@ -712,7 +713,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num > 0) print "</table>";
if ($num > 0)
{
print "</table>";
print '</div>';
}
}
else
{
@ -759,6 +764,7 @@ if ($object->id > 0)
$orders2invoice = $db->num_rows($resql2);
$db->free($resql2);
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -793,7 +799,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num >0) print "</table>";
if ($num >0)
{
print "</table>";
print '</div>';
}
}
else
{
@ -830,7 +840,8 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0) {
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").' <span class="badge">'.$num.'</span></a></td>';
@ -864,7 +875,10 @@ if ($object->id > 0)
$db->free($resql);
if ($num > 0)
{
print "</table>";
print '</div>';
}
} else {
dol_print_error($db);
}
@ -890,7 +904,8 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num >0)
{
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
@ -909,6 +924,7 @@ if ($object->id > 0)
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
$contrat->ref_customer=$objp->refcus;
$contrat->ref_supplier=$objp->refsup;
$contrat->fetch_lines();
print '<tr class="oddeven">';
print '<td class="nowrap">';
@ -918,8 +934,7 @@ if ($object->id > 0)
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dc),'day')."</td>\n";
print '<td align="right" width="80px">'.dol_print_date($db->jdate($objp->dcon),'day')."</td>\n";
print '<td width="20">&nbsp;</td>';
print '<td align="right" class="nowrap">';
$contrat->fetch_lines();
print '<td align="right" class="nowraponall">';
print $contrat->getLibStatut(4);
print "</td>\n";
print '</tr>';
@ -927,7 +942,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num > 0) print "</table>";
if ($num > 0)
{
print "</table>";
print '</div>';
}
}
else
{
@ -955,7 +974,8 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
@ -983,7 +1003,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num > 0) print "</table>";
if ($num > 0)
{
print "</table>";
print '</div>';
}
}
else
{
@ -1001,7 +1025,7 @@ if ($object->id > 0)
$sql.= ', f.tva as total_tva';
$sql.= ', f.total_ttc';
$sql.= ', f.datec as dc';
$sql.= ', f.date_last_gen';
$sql.= ', f.date_last_gen, f.date_when';
$sql.= ', f.frequency';
$sql.= ', f.unit_frequency';
$sql.= ', f.suspended as suspended';
@ -1023,6 +1047,7 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -1044,6 +1069,8 @@ if ($object->id > 0)
$invoicetemplate->total_ht = $objp->total_ht;
$invoicetemplate->total_tva = $objp->total_tva;
$invoicetemplate->total_ttc = $objp->total_ttc;
$invoicetemplate->date_last_gen = $objp->date_last_gen;
$invoicetemplate->date_when = $objp->date_when;
print '<tr class="oddeven">';
print '<td class="nowrap">';
@ -1084,7 +1111,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num > 0) print "</table>";
if ($num > 0)
{
print "</table>";
print '</div>';
}
}
else
{
@ -1121,7 +1152,8 @@ if ($object->id > 0)
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<table class="noborder" width="100%">';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").' <span class="badge">'.$num.'</span></a></td>';
@ -1171,7 +1203,11 @@ if ($object->id > 0)
}
$db->free($resql);
if ($num > 0) print "</table>";
if ($num > 0)
{
print "</table>";
print '</div>';
}
}
else
{

View File

@ -72,13 +72,13 @@ if (GETPOST('button_removefilter_x','alpha')) {
$search_prenom = '';
$search_email = '';
}
$array_query = array ();
$object = new Mailing($db);
$advTarget = new AdvanceTargetingMailing($db);
if (empty($template_id)) {
$advTarget->fk_mailing = $id;
$advTarget->fk_element = $id;
$advTarget->type_element = 'mailing';
$result = $advTarget->fetch_by_mailing();
} else {
$result = $advTarget->fetch($template_id);
@ -222,7 +222,7 @@ if ($action == 'add') {
} else {
$advTarget->contact_lines = array ();
}
if ((count($advTarget->thirdparty_lines) > 0) || (count($advTarget->contact_lines) > 0)) {
// Add targets into database
$obj = new mailing_advthirdparties($db);
@ -356,6 +356,7 @@ if ($action == 'savefilter' || $action == 'createfilter') {
setEventMessage($advTarget->error, 'errors');
}
} elseif ($action == 'savefilter') {
$result = $advTarget->update($user);
if ($result < 0) {
setEventMessage($advTarget->error, 'errors');
@ -409,36 +410,7 @@ if ($_POST["button_removefilter"]) {
llxHeader('', $langs->trans("MailAdvTargetRecipients"));
print '<script type="text/javascript" language="javascript">
$(document).ready(function() {
// Click Function
$(":button[name=addcontact]").click(function() {
$(":hidden[name=action]").val("add");
$("#find_customer").submit();
});
$(":button[name=loadfilter]").click(function() {
$(":hidden[name=action]").val("loadfilter");
$("#find_customer").submit();
});
$(":button[name=deletefilter]").click(function() {
$(":hidden[name=action]").val("deletefilter");
$("#find_customer").submit();
});
$(":button[name=savefilter]").click(function() {
$(":hidden[name=action]").val("savefilter");
$("#find_customer").submit();
});
$(":button[name=createfilter]").click(function() {
$(":hidden[name=action]").val("createfilter");
$("#find_customer").submit();
});
});
</script>';
$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 '<div class="tabBar">' . "\n";
print '<form name="find_customer" id="find_customer" action="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">' . "\n";
print '<input type="hidden" name="action" value="">' . "\n";
print '<table class="border" width="100%">' . "\n";
print '<tr>' . "\n";
print '<td colspan="3" align="right">' . "\n";
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
print '</td>' . "\n";
print '</tr>' . "\n";
print '<tr><td>' . $langs->trans('AdvTgtNameTemplate') . '</td><td>';
if (! empty($template_id)) {
$default_template = $template_id;
} else {
$default_template = $advTarget->id;
}
print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template);
print '<input type="button" name="loadfilter" id="loadfilter" value="' . $langs->trans('AdvTgtLoadFilter') . '" class="butAction"/>';
print '<input type="button" name="deletefilter" id="deletefilter" value="' . $langs->trans('AdvTgtDeleteFilter') . '" class="butAction"/>';
print '<input type="button" name="savefilter" id="savefilter" value="' . $langs->trans('AdvTgtSaveFilter') . '" class="butAction"/>';
print $langs->trans('AdvTgtOrCreateNewFilter');
print '<input type="text" name="template_name" id="template_name" value=""/>';
print '<input type="button" name="createfilter" id="createfilter" value="' . $langs->trans('AdvTgtCreateFilter') . '" class="butAction"/>';
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
print '<tr><td>' . $langs->trans('AdvTgtTypeOfIncude') . '</td><td>';
print $form->selectarray('type_of_target', $advTarget->select_target_type, $array_query['type_of_target']);
print '</td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtTypeOfIncudeHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Customer name
print '<tr><td>' . $langs->trans('ThirdPartyName');
if (! empty($array_query['cust_name'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="cust_name" value="' . $array_query['cust_name'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Code Client
print '<tr><td>' . $langs->trans('CustomerCode');
if (! empty($array_query['cust_code'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="cust_code" value="' . $array_query['cust_code'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Address Client
print '<tr><td>' . $langs->trans('Address');
if (! empty($array_query['cust_adress'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="cust_adress" value="' . $array_query['cust_adress'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Zip Client
print '<tr><td>' . $langs->trans('Zip');
if (! empty($array_query['cust_zip'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="cust_zip" value="' . $array_query['cust_zip'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// City Client
print '<tr><td>' . $langs->trans('Town');
if (! empty($array_query['cust_city'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="cust_city" value="' . $array_query['cust_city'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Customer Country
print '<tr><td>' . $langs->trans("Country");
if (count($array_query['cust_country']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectCountry('cust_country', $array_query['cust_country']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// State Customer
print '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('ThirdParty');
if (count($array_query['cust_status']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->advMultiselectarray('cust_status', array (
'0' => $langs->trans('ActivityCeased'),
'1' => $langs->trans('InActivity')
), $array_query['cust_status']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Mother Company
print '<tr><td>' . $langs->trans("Maison mère");
if (! empty($array_query['cust_mothercompany'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print '<input type="text" name="cust_mothercompany" value="' . $array_query['cust_mothercompany'] . '"/>';
print '</td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Prospect/Customer
$selected = $array_query['cust_typecust'];
print '<tr><td>' . $langs->trans('ProspectCustomer') . ' ' . $langs->trans('ThirdParty');
if (count($array_query['cust_typecust']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
$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 '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Prospection status
print '<tr><td>' . $langs->trans('ProspectLevel');
if (count($array_query['cust_prospect_status']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->multiselectProspectionStatus($array_query['cust_prospect_status'], 'cust_prospect_status', 1);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Prospection comm status
print '<tr><td>' . $langs->trans('StatusProsp');
if (count($array_query['cust_comm_status']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->advMultiselectarray('cust_comm_status', $advTarget->type_statuscommprospect, $array_query['cust_comm_status']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Customer Type
print '<tr><td>' . $langs->trans("ThirdPartyType");
if (count($array_query['cust_typeent']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->advMultiselectarray('cust_typeent', $formcompany->typent_array(0, " AND id <> 0"), $array_query['cust_typeent']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Staff number
print '<td>' . $langs->trans("Staff");
if (count($array_query['cust_effectif_id']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->advMultiselectarray("cust_effectif_id", $formcompany->effectif_array(0, " AND id <> 0"), $array_query['cust_effectif_id']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Sales manager
print '<tr><td>' . $langs->trans("SalesRepresentatives");
if (count($array_query['cust_saleman']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectselectSalesRepresentatives('cust_saleman', $array_query['cust_saleman'], $user);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Customer Default Langauge
if (! empty($conf->global->MAIN_MULTILANGS)) {
print '<tr><td>' . $langs->trans("DefaultLang");
if (count($array_query['cust_language']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectselectLanguage('cust_language', $array_query['cust_language']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
}
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
// Customer Categories
print '<tr><td>' . $langs->trans("CustomersCategoryShort");
if (count($array_query['cust_categ']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']);
print '</td><td>' . "\n";
print '</td></tr>' . "\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 '<tr><td>' . $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 '</td><td>';
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
print '<input type="text" name="options_' . $key . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options' . $key . '_min"/>';
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options' . $key . '_max"/>';
print '</td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
print '<table class="nobordernopadding"><tr>';
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
print $form->select_date('', 'options_' . $key . '_st_dt');
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
print $form->select_date('', 'options_' . $key . '_end_dt');
print '</td></tr></table>';
print '</td><td>' . "\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 '</td><td>' . "\n";
} elseif (($extrafields->attribute_type[$key] == 'select')) {
print $formadvtargetemaling->advMultiselectarray('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
print '</td><td>' . "\n";
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key, $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key]);
print '</td><td>' . "\n";
} else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
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 '</td></tr></table>';
print '</td><td>' . "\n";
}
print '</td></tr>' . "\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 '<tr><td>' . $langs->trans('Status') . ' ' . $langs->trans('Contact');
if (count($array_query['contact_status']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->advMultiselectarray('contact_status', array (
'0' => $langs->trans('ActivityCeased'),
'1' => $langs->trans('InActivity')
), $array_query['contact_status']);
print '</td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtContactHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Civility
print '<tr><td width="15%">' . $langs->trans("UserTitle");
if (count($array_query['contact_civility']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>';
print $formadvtargetemaling->multiselectCivility('contact_civility', $array_query['contact_civility']);
print '</td></tr>';
// contact name
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Lastname');
if (! empty($array_query['contact_lastname'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="contact_lastname" value="' . $array_query['contact_lastname'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans('Firstname');
if (! empty($array_query['contact_firstname'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td><input type="text" name="contact_firstname" value="' . $array_query['contact_firstname'] . '"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
print '</td></tr>' . "\n";
// Contact Country
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("Country");
if (count($array_query['contact_country']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectCountry('contact_country', $array_query['contact_country']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Never send mass mailing
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("No_Email");
if (! empty($array_query['contact_no_email'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $form->selectarray('contact_no_email', array (
'' => '',
'1' => $langs->trans('Yes'),
'0' => $langs->trans('No')
), $array_query['contact_no_email']);
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Contact Date Create
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateCreation");
if (! empty($array_query['contact_create_st_dt'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print '<table class="nobordernopadding"><tr>';
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
print $form->select_date($array_query['contact_create_st_dt'], 'contact_create_st_dt', 0, 0, 1, 'find_customer', 1, 1);
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
print $form->select_date($array_query['contact_create_end_dt'], 'contact_create_end_dt', 0, 0, 1, 'find_customer', 1, 1);
print '</td></tr></table>';
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
// Contact update Create
print '<tr><td>' . $langs->trans('Contact') . ' ' . $langs->trans("DateLastModification");
if (! empty($array_query['contact_update_st_dt'])) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print '<table class="nobordernopadding"><tr>';
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
print $form->select_date($array_query['contact_update_st_dt'], 'contact_update_st_dt', 0, 0, 1, 'find_customer', 1, 1);
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
print $form->select_date($array_query['contact_update_end_dt'], 'contact_update_end_dt', 0, 0, 1, 'find_customer', 1, 1);
print '</td></tr></table>';
print '</td><td>' . "\n";
print '</td></tr>' . "\n";
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
// Customer Categories
print '<tr><td>' . $langs->trans("ContactCategoriesShort");
if (count($array_query['contact_categ']) > 0) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
print '</td><td>' . "\n";
print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']);
print '</td><td>' . "\n";
print '</td></tr>' . "\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 '<tr><td>' . $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 '</td><td>';
if (($extrafields->attribute_type[$key] == 'varchar') || ($extrafields->attribute_type[$key] == 'text')) {
print '<input type="text" name="options_' . $key . '_cnct"/></td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchTextHelp"), 1, 'help');
} elseif (($extrafields->attribute_type[$key] == 'int') || ($extrafields->attribute_type[$key] == 'double')) {
print $langs->trans("AdvTgtMinVal") . '<input type="text" name="options_' . $key . '_min_cnct"/>';
print $langs->trans("AdvTgtMaxVal") . '<input type="text" name="options_' . $key . '_max_cnct"/>';
print '</td><td>' . "\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchIntHelp"), 1, 'help');
} elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) {
print '<table class="nobordernopadding"><tr>';
print '<td>' . $langs->trans("AdvTgtStartDt") . '</td><td>';
print $form->select_date('', 'options_' . $key . '_st_dt' . '_cnct');
print '</td><td>' . $langs->trans("AdvTgtEndDt") . '</td><td>';
print $form->select_date('', 'options_' . $key . '_end_dt' . '_cnct');
print '</td></tr></table>';
print '</td><td>' . "\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 '</td><td>' . "\n";
} elseif (($extrafields->attribute_type[$key] == 'select')) {
print $formadvtargetemaling->advMultiselectarray('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
print '</td><td>' . "\n";
} elseif (($extrafields->attribute_type[$key] == 'sellist')) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_' . $key . '_cnct', $extrafields->attribute_param[$key]['options'], $array_query['options_' . $key . '_cnct']);
print '</td><td>' . "\n";
} else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
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 '</td></tr></table>';
print '</td><td>' . "\n";
}
print '</td></tr>' . "\n";
}
}
print '<tr>' . "\n";
print '<td colspan="3" align="right">' . "\n";
print '<input type="button" name="addcontact" id="addcontact" value="' . $langs->trans('AdvTgtAddContact') . '" class="butAction"/>' . "\n";
print '</td>' . "\n";
print '</tr>' . "\n";
print '</table>' . "\n";
print '</form>' . "\n";
print '</div>' . "\n";
print '<form action="' . $_SERVER['PHP_SELF'] . '?action=clear&id=' . $object->id . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print_titre($langs->trans("ToClearAllRecipientsClickHere"));
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="right"><input type="submit" class="button" value="' . $langs->trans("TargetsReset") . '"></td>';
print '</tr>';
print '</table>';
print '</form>';
print '<br>';
include DOL_DOCUMENT_ROOT . '/core/tpl/advtarget.tpl.php';
}
}

View File

@ -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 '<form '.$bctag[$var].' name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<form class="oddeven tagtr" name="'.$modulename.'" action="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&module='.$modulename.'" method="POST" enctype="multipart/form-data">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
else
{
print '<div '.$bctag[$var].'>';
print '<div class="oddeven tagtr">';
}
print '<div class="tagtd">';

View File

@ -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;

View File

@ -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) {

View File

@ -12,6 +12,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* 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);
}
/**

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'</div>';
}
$i = 0;

View File

@ -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';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >

View File

@ -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);
}

View File

@ -10,6 +10,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* 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);
}

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'</div>';
}
$moreforfilter='';

View File

@ -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';
?>
<tr class="<?php echo $trclass; ?>" >

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $all) . join(', ',$fieldstosearchall).'</div>';
}
$moreforfilter='';

View File

@ -172,14 +172,10 @@ if ($resql)
print '</td>';
print "</tr>\n";
$var=true;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td>';
$thirdpartystatic->id=$obj->rowid;

View File

@ -12,7 +12,7 @@
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
*
* 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 '</td><td align="right">' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . '</td><td>&nbsp;</td></tr>';
$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 '</td><td align="right">' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . '</td><td>&nbsp;</td></tr>';
// $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 '</td><td align="right">' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . '</td><td>&nbsp;</td></tr>';
$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 '</td><td align="right">' . price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaye, 'MT')) . '</td><td>&nbsp;</td></tr>';
$resteapayeraffiche = 0;
$cssforamountpaymentcomplete = '';
$cssforamountpaymentcomplete = 'amountpaymentneutral';
}
// Billed
@ -4665,7 +4665,7 @@ else if ($id > 0 || ! empty($ref))
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';
}
// 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 '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
}

View File

@ -1118,7 +1118,21 @@ class FactureRec extends CommonInvoice
global $langs;
$result='';
$label=$langs->trans("ShowInvoice").': '.$this->ref;
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
if (! empty($this->ref))
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->date_last_gen))
$label .= '<br><b>'.$langs->trans('DateLastGeneration') . ':</b> ' . dol_print_date($this->date_last_gen, 'dayhour');
if ($this->frequency > 0)
{
if (! empty($this->date_when))
{
$label .= '<br><b>'.$langs->trans('NextDateToExecution') . ':</b> ';
$label .= (empty($this->suspended)?'':'<strike>'). dol_print_date($this->date_when, 'day').(empty($this->suspended)?'':'</strike>'); // 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;

View File

@ -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');

View File

@ -425,7 +425,7 @@ if ($resql)
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.$search_day.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.$search_month.'">';
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
print '</td>';
}
@ -434,7 +434,7 @@ if ($resql)
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_date_when" value="'.$search_day_date_when.'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_date_when" value="'.$search_month_date_when.'">';
$formother->select_year($search_year_date_when?$search_year_date_when:-1,'search_year_date_when',1, 20, 5, 0, 0, '', 'witdhauto valignmiddle');
print '</td>';
}

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
// If the user can view prospects other than his'
@ -730,7 +737,7 @@ if ($resql)
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
$formother->select_year($search_year?$search_year:-1,'search_year',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '</td>';
}
@ -739,7 +746,7 @@ if ($resql)
{
print '<td class="liste_titre nowraponall" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_day_lim" value="'.dol_escape_htmltag($search_day_lim).'">';
print '<input class="flat valignmiddle" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
print '<input class="flat valignmiddle width25" type="text" size="1" maxlength="2" name="search_month_lim" value="'.dol_escape_htmltag($search_month_lim).'">';
$formother->select_year($search_year_lim?$search_year_lim:-1,'search_year_lim',1, 20, 5, 0, 0, '', 'widthauto valignmiddle');
print '<br><input type="checkbox" name="search_option" value="late"'.($option == 'late'?' checked':'').'> '.$langs->trans("Late");
print '</td>';
@ -854,7 +861,7 @@ if ($resql)
if (! empty($arrayfields['f.fk_statut']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="right">';
$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 '</td>';
}

View File

@ -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';
?>
<tr class="<?php echo $trclass; ?>" data-element="<?php echo $objectlink->element; ?>" data-id="<?php echo $objectlink->id; ?>" >

View File

@ -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';
?>
<tr <?php echo $GLOBALS['bc'][$var]; ?> >
<tr class="<?php echo $trclass; ?>" >
<td><?php echo $langs->trans("RepeatableInvoice"); ?></td>
<td><?php echo $objectlink->getNomUrl(1); ?></td>
<td align="center"></td>

View File

@ -313,7 +313,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
// 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 '</tr>';
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 '<table class="noborder" width="100%">';
@ -663,7 +661,6 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
print '<td align="center">'.$chargestatic->getLibStatut(3).'</td>';
print '</tr>';
$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 '<div class="div-table-responsive-no-min">';
@ -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 '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
@ -1056,7 +1049,6 @@ if ($resql)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><thcolspan="2">'.$langs->trans("TasksToDo").'</th>';
print "</tr>\n";
$var = true;
$i = 0;
while ($i < $db->num_rows($resql))
{

View File

@ -589,7 +589,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">&nbsp;</td>';
print "</tr>\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 '<table class="noborder" width="100%">';

View File

@ -6,6 +6,7 @@
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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)
{

View File

@ -272,7 +272,6 @@ if ($action == 'create')
print '<td align="center">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$var=true;
$total=0;
$totalrecu=0;
@ -280,8 +279,6 @@ if ($action == 'create')
{
$objp = $charge;
print '<tr class="oddeven">';
if ($objp->date_ech > 0)
@ -325,7 +322,7 @@ if ($action == 'create')
if ($i > 1)
{
// Print total
print "<tr ".$bc[!$var].">";
print '<tr class="oddeven">';
print '<td colspan="2" align="left">'.$langs->trans("Total").':</td>';
print "<td align=\"right\"><b>".price($total_ttc)."</b></td>";
print "<td align=\"right\"><b>".price($totalrecu)."</b></td>";

View File

@ -129,7 +129,6 @@ if ($id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$num = $db->num_rows($resql);
// Boucle sur chaque facture

View File

@ -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;

View File

@ -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;

View File

@ -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 '<tr class="oddeven">';
// 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 "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\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 "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day').'</td>'."\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 "</tr>\n";
$var=1;
while ($i < $num)
{
$obj = $db->fetch_object($result);
$total = $total + $obj->amount;
print '<tr class="oddeven">';
print '<td align="left">'.dol_print_date($db->jdate($obj->dateep),'day').'</td>'."\n";

View File

@ -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.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';

View File

@ -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.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
else $periodlink = '';

View File

@ -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.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
@ -328,7 +344,6 @@ print_liste_field_titre(
'align="center" width="20%"'
);
print "</tr>\n";
$var=true;
if (count($amount)) {
$arrayforsort=$name;

View File

@ -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.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$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='<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start-1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start+1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
@ -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";

View File

@ -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.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
$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?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
@ -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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPING">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInBookkeepingMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=BOOKKEEPINGCOLLECTED">','</a>').')';
$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?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$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.='<br>('.$langs->trans("SeeReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=CREANCES-DETTES">','</a>').')';
$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
//$calcmode.='<br>('.$langs->trans("SeeReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year_start='.$year_start.'&modecompta=RECETTES-DEPENSES">','</a>').')';
$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?"<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear-2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+$nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>":"");
$description=$langs->trans("RulesCATotalSaleJournal");

View File

@ -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;

View File

@ -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 '<input type="hidden" name="formfilteraction" id="formfilteraction" value=
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="type" value="'.$type.'">';
print '<input type="hidden" name="view" value="'.dol_escape_htmltag($view).'">';
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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
if ($search_firstlast_only)
{
print $langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname");
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_firstlast_only) . $langs->trans("Lastname").", ".$langs->trans("Firstname").'</div>';
}
$moreforfilter='';

View File

@ -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 '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
if ($user->rights->contrat->activer)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=activate">'.$langs->trans("ActivateAllContracts").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("ActivateAllContracts").'</a></div>';
}
}
if ($object->nbofservicesclosed < $nbofservices)
{
if ($user->rights->contrat->desactiver)
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
}
else
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CloseAllContracts").'</a></div>';
}
//if (! $numactive)
//{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=close">'.$langs->trans("CloseAllContracts").'</a></div>';
//}
//else
//{

View File

@ -9,6 +9,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
*
* 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);
}
/**

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
$moreforfilter='';

View File

@ -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 '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall).'</div>';
}
$morefilter = '';
@ -531,7 +531,6 @@ print "</tr>\n";
$contractstatic=new Contrat($db);
$productstatic=new Product($db);
$var=true;
$i=0;
$totalarray=array();
while ($i < min($num,$limit))

View File

@ -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';
?>
<tr class="<?php echo $trclass; ?>">

View File

@ -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='';
}
}
}
}

View File

@ -202,7 +202,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
print '<td align="right" width="18"><a href="';
print DOL_URL_ROOT.'/ecm/dir_card.php?module='.urlencode($modulepart).'&section='.$val['id'].'&relativedir='.urlencode($val['fullrelativename']);
print '&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$website.'&pageid='.$pageid);
print '">'.img_view($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle"').'</a></td>';
print '">'.img_edit($langs->trans("Edit").' - '.$langs->trans("View"), 0, 'class="valignmiddle opacitymedium"').'</a></td>';
// Add link
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/dir_add_card.php?action=create&amp;catParent='.$val['id'].'">'.img_edit_add().'</a></td>';
@ -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'];

View File

@ -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' => '',

View File

@ -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."<br>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("/<br\s*[^>]*>/"," ", $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

View File

@ -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 .= '<td class="titlefield';
if (GETPOST('action','none') == 'create') $out.='create';
if ($mode != 'view' && ! empty($extrafields->attributes[$this->table_element]['required'][$key])) $out .= ' fieldrequired';
$out .= '">';
if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) $out .= $form->textwithpicto($labeltoshow, $extrafields->attributes[$object->table_element]['help'][$key]);

View File

@ -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;

View File

@ -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
{

View File

@ -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;

View File

@ -1200,7 +1200,7 @@ class FormFile
print '</td>';
// Date
print '<td align="center" width="130px">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>';
print '<td align="center" width="140px">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>'; // 140px = width for date with PM format
// Preview
if (empty($useinecm))
@ -1271,7 +1271,7 @@ class FormFile
print '<td class="valignmiddle right actionbuttons"><!-- action on files -->';
if ($useinecm == 1)
{
print '<a href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view('default', 0, 'class="paddingrightonly"').'</a>';
print '<a href="'.DOL_URL_ROOT.'/ecm/file_card.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_edit('default', 0, 'class="paddingrightonly"').'</a>';
}
if (! $useinecm || $useinecm == 2)
{

View File

@ -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);

View File

@ -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 '<option value="'.$obj->rowid.'">';
//print '<option onmouseover="showtip(\''.$obj->libelle.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
//print '<option onmouseover="showtip(\''.$obj->label.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
}
$selectOptionValue = $obj->code.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
print $selectOptionValue;
@ -470,9 +470,11 @@ class FormOther
* @param int $mode 0=Return list of tasks and their projects, 1=Return projects and tasks if exists
* @param int $useempty 0=Allow empty values
* @param int $disablechildoftaskid 1=Disable task that are child of the provided task id
* @param string $filteronprojstatus Filter on project status ('-1'=no filter, '0,1'=Draft+Validated status)
* @param string $morecss More css
* @return void
*/
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0)
function selectProjectTasks($selectedtask='', $projectid=0, $htmlname='task_parent', $modeproject=0, $modetask=0, $mode=0, $useempty=0, $disablechildoftaskid=0, $filteronprojstatus='', $morecss='')
{
global $user, $langs;
@ -480,10 +482,10 @@ class FormOther
//print $modeproject.'-'.$modetask;
$task=new Task($this->db);
$tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode);
$tasksarray=$task->getTasksArray($modetask?$user:0, $modeproject?$user:0, $projectid, 0, $mode, '', $filteronprojstatus);
if ($tasksarray)
{
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
print '<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($useempty) print '<option value="0">&nbsp;</option>';
$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").')';

View File

@ -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("/<br\s*[^>]*>/"," ", $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);

View File

@ -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');

View File

@ -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 '<tr class="oddeven">';
print '<td>';
$socstatic->id = $obj->rowid;
$socstatic->name = $obj->name;
$socstatic->canvas = $obj->canvas;
print $socstatic->getNomUrl(1);
print '</td>';

View File

@ -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 "&nbsp;";
//$sortimg.= '<img width="2" src="'.DOL_URL_ROOT.'/theme/common/transparent.png" alt="">';
//$sortimg.= '<span class="nowrap">';
if (! $sortorder || $field1 != $sortfield1)
{
//$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
@ -4081,8 +4090,6 @@ function getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $m
$sortimg.= '<span class="nowrap">'.img_down("A-Z",0).'</span>';
}
}
//$sortimg.= '</span>';
}
$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('/<html/i',$msg)) return true;
elseif (preg_match('/<body/i',$msg)) return true;
elseif (preg_match('/<(b|em|i|u)>/i',$msg)) return true;
elseif (preg_match('/<br\/>/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;

View File

@ -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

View File

@ -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&amp;leftmenu=setup", $langs->trans("Setup"), 0, $user->admin, '', $mainmenu, 'setup', 0, '', '', '', '<i class="fa fa-wrench fa-fw paddingright"></i>');
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&amp;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&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
if ($usemenuhider || empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/societe/list.php?type=p&amp;sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;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&amp;leftmenu=customers", $langs->trans("ListCustomersShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'customers');
$newmenu->add("/societe/card.php?leftmenu=customers&amp;action=create&amp;type=c", $langs->trans("MenuNewCustomer"), 2, $user->rights->societe->creer);
//$newmenu->add("/contact/list.php?leftmenu=customers&amp;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&amp;leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/card.php?leftmenu=suppliers&amp;action=create&amp;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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2018-2018 Andre Schild <a.schild@aarboard.ch>
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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.='<select name="filter" class="flat">';
// Show categories
@ -227,6 +280,29 @@ class mailing_thirdparties extends MailingTargets
dol_print_error($this->db);
}
$s.='</select> ';
$s.= $langs->trans('ProspectCustomer');
$s.=': <select name="filter_client" class="flat">';
$s.= '<option value="-1">&nbsp;</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS))
{
$s.= '<option value="2">'.$langs->trans('Prospect').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
$s.= '<option value="3">'.$langs->trans('ProspectCustomer').'</option>';
}
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) {
$s.= '<option value="1">'.$langs->trans('Customer').'</option>';
}
$s.= '<option value="0">'.$langs->trans('NorProspectNorCustomer').'</option>';
$s.='</select> ';
$s.=$langs->trans("Status");
$s.=': <select name="filter_status" class="flat">';
$s.='<option value="-1">&nbsp;</option>';
$s.='<option value="1" selected>'.$langs->trans("Enabled").'</option>';
$s.='<option value="0">'.$langs->trans("Disabled").'</option>';
$s.='</select>';
return $s;

View File

@ -213,7 +213,7 @@ class mailing_thirdparties_services_expired extends MailingTargets
{
global $langs;
$s='';
$s=$langs->trans("ProductOrService");
$s.='<select name="filter" class="flat">';
if (count($this->arrayofproducts)) $s.='<option value="0">&nbsp;</option>';
else $s.='<option value="0">'.$langs->trans("ContactsAllShort").'</option>';

View File

@ -113,7 +113,7 @@ class modBarcode extends DolibarrModules
'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=admintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->barcode->enabled && preg_match(\'/^admintools/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->barcode->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -137,7 +137,7 @@ class modCron extends DolibarrModules
'url'=>'/cron/list.php?status=-2&leftmenu=admintools',
'langs'=>'cron', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->cron->enabled && preg_match(\'/^admintools/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'$user->rights->cron->read', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -494,7 +494,7 @@ class modFournisseur extends DolibarrModules
'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.date_approve'=>'DateApprove','f.date_approve2'=>'DateApprove2',
'f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'ua1.login'=>'ApprovedBy','ua2.login'=>'ApprovedBy2','fd.rowid'=>'LineId','fd.description'=>"LineDescription",
'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",
'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId',
'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.ref'=>'RefSupplier','fd.fk_product'=>'ProductId',
'p.ref'=>'ProductRef','p.label'=>'ProductLabel','project.rowid'=>'ProjectId','project.ref'=>'ProjectRef','project.title'=>'ProjectLabel'
);
if (empty($conf->global->SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED))
@ -508,13 +508,13 @@ class modFournisseur extends DolibarrModules
'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.date_livraison'=>"Date",'f.total_ht'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",
'f.fk_statut'=>'Status','f.date_approve'=>'Date','f.date_approve2'=>'Date','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",
'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.remise_percent'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.total_tva'=>"Numeric",
'fd.product_type'=>'Numeric','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'
'fd.product_type'=>'Numeric','fd.ref'=>'Text','fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','project.ref'=>'Text','project.title'=>'Text'
);
$this->export_entities_array[$r]=array(
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company',
's.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','ua1.login'=>'user',
'ua2.login'=>'user','fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",
'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product',
'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.ref'=>'order_line','fd.fk_product'=>'product',
'p.ref'=>'product','p.label'=>'product','project.rowid'=>'project','project.ref'=>'project','project.title'=>'project'
);
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them

View File

@ -94,7 +94,7 @@ class modModuleBuilder extends DolibarrModules
'langs'=>'modulebuilder',
'position'=>100,
'perms'=>'1',
'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^admintools/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
'enabled'=>'$conf->modulebuilder->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu) && ($user->admin || $conf->global->MODULEBUILDER_FOREVERYONE)',
'target'=>'_modulebuilder',
'user'=>0);

View File

@ -111,7 +111,7 @@ class modOauth extends DolibarrModules
// 'url'=>'/oauth/index.php',
// 'langs'=>'oauth', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>300,
// 'enabled'=>'$conf->oauth->enabled && $leftmenu==\'admintools\'',
// 'enabled'=>'$conf->oauth->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)',
// 'perms'=>'$user->rights->oauth->read', // Use 'perms'=>'1' if you want your menu with no permission rules
// 'target'=>'',
// 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -109,7 +109,7 @@ class modPrinting extends DolibarrModules
'url'=>'/printing/index.php?mainmenu=home&leftmenu=admintools',
'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->printing->enabled && preg_match(\'/^admintools/\', $leftmenu)',
'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)',
'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -142,7 +142,7 @@ class modProduct extends DolibarrModules
'url'=>'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->product->enabled && ($leftmenu=="admintools" || $leftmenu=="admintools_info")', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->product->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -111,7 +111,7 @@ class modReceiptPrinter extends DolibarrModules
// 'url'=>'/printing/index.php',
// 'langs'=>'printing', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>300,
// 'enabled'=>'$conf->printing->enabled && $leftmenu==\'admintools\'',
// 'enabled'=>'$conf->printing->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)',
// 'perms'=>'$user->rights->printing->read', // Use 'perms'=>'1' if you want your menu with no permission rules
// 'target'=>'',
// 'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -121,7 +121,7 @@ class modService extends DolibarrModules
'url'=>'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->product->enabled && $leftmenu=="admintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'$conf->product->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

View File

@ -452,11 +452,9 @@ class doc_generic_project_odt extends ModelePDFProjects
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
if ($conf->projet->dir_output)
{
@ -951,7 +949,6 @@ class doc_generic_project_odt extends ModelePDFProjects
$elementarray = $object->get_element_list($keyref, $tablename);
if (count($elementarray)>0 && is_array($elementarray))
{
$var=true;
$total_ht = 0;
$total_ttc = 0;
$num=count($elementarray);

View File

@ -357,7 +357,7 @@ class pdf_azur extends ModelePDFPropales
$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;
}
}
@ -399,7 +399,7 @@ class pdf_azur extends ModelePDFPropales
$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;

View File

@ -197,11 +197,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc
if (! is_object($outputlangs)) $outputlangs=$langs;
$sav_charset_output=$outputlangs->charset_output;
$outputlangs->charset_output='UTF-8';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
// Load translation files required by the page
$outputlangs->loadLangs(array("main", "dict", "companies", "projects"));
if ($conf->societe->multidir_output[$object->entity])
{
@ -282,7 +280,6 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$result = $this->db->query($sql);
$num = $this->db->num_rows($result);
$var=true;
if ($num)
{
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';

View File

@ -285,7 +285,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$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;
}
}
@ -303,7 +303,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$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;

View File

@ -335,7 +335,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$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;
}
}

View File

@ -388,7 +388,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$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;

View File

@ -109,9 +109,16 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
if (empty($conf->global->SYSLOG_FILE)) $tmp=DOL_DATA_ROOT.'/dolibarr.log';
else $tmp=str_replace('DOL_DATA_ROOT', DOL_DATA_ROOT, $conf->global->SYSLOG_FILE);
if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION)) // file depend on session name (Note that session name is same for all users and is not a per user value)
if (! empty($conf->global->SYSLOG_FILE_ONEPERSESSION))
{
$suffixinfilename = '_'.session_name();
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 1) // file depend on session key name (Note that session name is same for all users and is not a per user value)
{
$suffixinfilename .= '_'.session_name();
}
if ($conf->global->SYSLOG_FILE_ONEPERSESSION == 2) // file depend on session value sor per user
{
$suffixinfilename .= '_'.session_name().'_'.$_SERVER["REMOTE_ADDR"];
}
}
return $suffixinfilename?preg_replace('/\.log$/i', $suffixinfilename.'.log', $tmp):$tmp;

Some files were not shown because too many files have changed in this diff Show More