Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/accountancy/customer/lines.php htdocs/fourn/commande/card.php htdocs/societe/class/societe.class.php
This commit is contained in:
commit
ad2df304b4
@ -22,7 +22,8 @@ Following changes may create regressions for some external modules, but were nec
|
|||||||
* The hook contaxt commcard has been renamed thirdpartycomm
|
* The hook contaxt commcard has been renamed thirdpartycomm
|
||||||
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
||||||
* Remove method Categorie:get_nb_categories() that was not used.
|
* 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 *****
|
***** ChangeLog for 7.0.2 compared to 7.0.1 *****
|
||||||
|
|||||||
@ -66,38 +66,53 @@ $year_current = $year_start;
|
|||||||
$action = GETPOST('action','aZ09');
|
$action = GETPOST('action','aZ09');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* 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') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$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
|
// 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') {
|
if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$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 .= " 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 accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0";
|
||||||
} else {
|
} 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 = "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 .= " 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 accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
@ -128,26 +143,6 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
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("DescVentilCustomer") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -179,7 +179,7 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
|
|||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
$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 . "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 . "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.= " 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.= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
|
||||||
|
|||||||
@ -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.= " 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.= " 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 . "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 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."'";
|
$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."'";
|
$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.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
|
|||||||
@ -68,33 +68,48 @@ $action = GETPOST('action','aZ09');
|
|||||||
* Actions
|
* 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') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$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
|
// Now make the binding
|
||||||
if ($db->type == 'pgsql') {
|
if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$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 .= " 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 accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "expensereport_det.fk_code_ventilation = 0";
|
||||||
} else {
|
} 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 = "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 .= " 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 accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
||||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
@ -124,26 +139,6 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $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("DescVentilExpenseReport") . '<br>';
|
||||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -193,7 +193,7 @@ $sql.= " aa.rowid as aarowid";
|
|||||||
$sql.= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
$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.= " 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 . "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";
|
$sql.= " WHERE er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
if (strlen(trim($search_expensereport))) {
|
if (strlen(trim($search_expensereport))) {
|
||||||
|
|||||||
@ -69,33 +69,48 @@ $action = GETPOST('action','aZ09');
|
|||||||
* Actions
|
* 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') {
|
if ($action == 'validatehistory') {
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$db->begin();
|
$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
|
// 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') {
|
if ($db->type == 'pgsql') {
|
||||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
|
||||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
$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 .= " 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 accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||||
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
$sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0";
|
||||||
} else {
|
} 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 = "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 .= " 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 accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number";
|
||||||
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
$sql1 .= " AND fd.fk_code_ventilation = 0";
|
||||||
}
|
}
|
||||||
@ -125,26 +140,6 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
|
|||||||
|
|
||||||
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $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("DescVentilSupplier") . '<br>';
|
||||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -178,12 +178,11 @@ $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // N
|
|||||||
$sql.=$hookmanager->resPrint;
|
$sql.=$hookmanager->resPrint;
|
||||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
$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 . "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 . "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 .= " 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 .= " 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.= " 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) {
|
if ($search_lineid) {
|
||||||
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
$sql .= natural_search("l.rowid", $search_lineid, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 .= " 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.= " 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 . "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.= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||||
$sql.= " AND l.product_type <= 2";
|
$sql.= " AND l.product_type <= 2";
|
||||||
// Add search filter like
|
// Add search filter like
|
||||||
|
|||||||
@ -592,6 +592,7 @@ class Adherent extends CommonObject
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
@ -600,7 +601,6 @@ class Adherent extends CommonObject
|
|||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
* Copyright (C) 2013 Jean-Francois FERRY <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* 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>
|
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -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 . '&action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';
|
||||||
}
|
}
|
||||||
// For deposit invoice
|
// 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.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -699,10 +699,12 @@ class Fichinter extends CommonObject
|
|||||||
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
|
||||||
$linkclose.=' class="classfortooltip"';
|
$linkclose.=' class="classfortooltip"';
|
||||||
|
|
||||||
|
/*
|
||||||
$hookmanager->initHooks(array('fichinterdao'));
|
$hookmanager->initHooks(array('fichinterdao'));
|
||||||
$parameters=array('id'=>$this->id);
|
$parameters=array('id'=>$this->id);
|
||||||
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
if ($reshook > 0) $linkclose = $hookmanager->resPrint;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$linkstart = '<a href="'.$url.'"';
|
$linkstart = '<a href="'.$url.'"';
|
||||||
@ -714,6 +716,13 @@ class Fichinter extends CommonObject
|
|||||||
if ($withpicto != 2) $result.= $this->ref;
|
if ($withpicto != 2) $result.= $this->ref;
|
||||||
$result .= $linkend;
|
$result .= $linkend;
|
||||||
|
|
||||||
|
global $action;
|
||||||
|
$hookmanager->initHooks(array('intervnetiondao'));
|
||||||
|
$parameters=array('id'=>$this->id, 'getnomurl'=>$result);
|
||||||
|
$reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook > 0) $result = $hookmanager->resPrint;
|
||||||
|
else $result .= $hookmanager->resPrint;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1648,6 +1648,10 @@ else
|
|||||||
|
|
||||||
print '<div class="tabsAction">';
|
print '<div class="tabsAction">';
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
if (! empty($object->email))
|
if (! empty($object->email))
|
||||||
{
|
{
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
@ -1726,6 +1730,7 @@ else
|
|||||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MustBeAdminToDeleteOtherAdmin")).'">'.$langs->trans("DeleteUser").'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MustBeAdminToDeleteOtherAdmin")).'">'.$langs->trans("DeleteUser").'</a></div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user