Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_mailtouser
This commit is contained in:
commit
cc0fb830b8
@ -152,12 +152,6 @@ source_file = htdocs/langs/en_US/hrm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.incoterm]
|
||||
file_filter = htdocs/langs/<lang>/incoterm.lang
|
||||
source_file = htdocs/langs/en_US/incoterm.lang
|
||||
source_lang = en_US
|
||||
type = MOZILLAPROPERTIES
|
||||
|
||||
[dolibarr.install]
|
||||
file_filter = htdocs/langs/<lang>/install.lang
|
||||
source_file = htdocs/langs/en_US/install.lang
|
||||
|
||||
@ -18,6 +18,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Remove the old deprecated code of doActions and getInstanceDao in canvas. The doActions of standard hooks are
|
||||
already available and are better.
|
||||
* Removed method fetch_prods() and get_each_prod() not used, keep only get_arbo_each_prod() that is better.
|
||||
* The hook contaxt commcard has been renamed thirdpartycomm
|
||||
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.1 compared to 7.0.0 *****
|
||||
|
||||
@ -176,6 +176,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/custom
|
||||
%_datadir/dolibarr/htdocs/dav
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
|
||||
@ -256,6 +256,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/custom
|
||||
%_datadir/dolibarr/htdocs/dav
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
|
||||
@ -173,6 +173,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/custom
|
||||
%_datadir/dolibarr/htdocs/dav
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
|
||||
@ -184,6 +184,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/core
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/custom
|
||||
%_datadir/dolibarr/htdocs/dav
|
||||
%_datadir/dolibarr/htdocs/don
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
|
||||
@ -40,6 +40,7 @@ $action = GETPOST('action','aZ09');
|
||||
$cancel = GETPOST('cancel','alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist'; // To manage different context of search
|
||||
|
||||
$search_account = GETPOST("search_account");
|
||||
$search_label = GETPOST("search_label");
|
||||
@ -74,8 +75,6 @@ $arrayfields=array(
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'accountingaccountlist';
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -47,15 +47,24 @@ if ($user->societe_id > 0)
|
||||
if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
$year = GETPOST("year",'int');
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
if (GETPOST("year",'int')) $year_start = GETPOST("year",'int');
|
||||
else
|
||||
{
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
// Validate History
|
||||
$action = GETPOST('action','aZ09');
|
||||
@ -108,30 +117,6 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
// Now clean
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql1.= " SET fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -170,30 +155,10 @@ print $langs->trans("DescVentilCustomer") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
$sql .= " WHERE fd.fk_code_ventilation = 0";
|
||||
$sql .= " AND f.rowid = fd.fk_facture";
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
|
||||
}
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/customer/index.php');
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$row = $db->fetch_row($result);
|
||||
$nbfac = $row[0];
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
@ -203,21 +168,26 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
@ -262,32 +232,38 @@ if ($resql) {
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') . " AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = fd.fk_code_ventilation";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -319,7 +295,7 @@ if ($resql) {
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
for($i = 2; $i <= 12; $i++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@ -345,20 +321,25 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, 'fd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(fd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
@ -392,20 +373,25 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $j, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND f.fk_statut > 0";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
|
||||
} else {
|
||||
|
||||
@ -110,27 +110,37 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
if (! (GETPOST('account_parent','int') >= 0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
if (! $error)
|
||||
{
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
|
||||
|
||||
@ -272,7 +282,7 @@ if ($result) {
|
||||
print $langs->trans("DescVentilDoneCustomer") . '<br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 1);
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '"/></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
|
||||
|
||||
// Langs
|
||||
$langs->load("compta");
|
||||
@ -37,27 +38,36 @@ $langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
$year = GETPOST('year', 'int');
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
if (GETPOST("year",'int')) $year_start = GETPOST("year",'int');
|
||||
else
|
||||
{
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
// Validate History
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -104,32 +114,9 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
// Now clean
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1.= " SET fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
$sql1.= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.=")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -141,10 +128,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 $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
@ -165,37 +148,43 @@ if (! $resql1) {
|
||||
}
|
||||
// End clean database
|
||||
|
||||
print $langs->trans("DescVentilExpenseReport") . '<br>';
|
||||
print $langs->trans("DescVentilExpenseReportMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(erd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
@ -203,9 +192,9 @@ $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
@ -238,7 +227,7 @@ print '</div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
@ -246,22 +235,26 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_debut)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " ROUND(SUM(erd.total_ht),2) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = erd.fk_code_ventilation";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
@ -269,9 +262,9 @@ $sql .= " GROUP BY erd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
@ -280,6 +273,7 @@ if ($resql) {
|
||||
}
|
||||
else print length_accountg($row[0]);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="left">';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -303,7 +297,7 @@ print '</div>';
|
||||
|
||||
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report where results depends on next step (so not yet available) ?
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
@ -314,20 +308,24 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("TotalExpenseReport") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $i, 'erd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(er.date_create)=' . $j, 'erd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(erd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "expensereport as er ON er.rowid = erd.fk_expensereport";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND er.fk_statut > 0 ";
|
||||
$sql .= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.")";
|
||||
$sql .= " AND er.entity IN (" . getEntity('expensereport', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
@ -335,7 +333,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
|
||||
@ -43,7 +43,7 @@ $langs->load("accountancy");
|
||||
$langs->load("trips");
|
||||
$langs->load("productbatch");
|
||||
|
||||
$account_parent = GETPOST('account_parent');
|
||||
$account_parent = GETPOST('account_parent','int');
|
||||
$changeaccount = GETPOST('changeaccount');
|
||||
// Search Getpost
|
||||
$search_expensereport = GETPOST('search_expensereport', 'alpha');
|
||||
@ -103,27 +103,36 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
if (! (GETPOST('account_parent','int') >= 0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||
$sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
if (! $error)
|
||||
{
|
||||
$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) . ')';
|
||||
|
||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -164,10 +173,10 @@ $sql .= " FROM " . MAIN_DB_PREFIX . "expensereport as er";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " , " . MAIN_DB_PREFIX . "expensereport_det as erd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_type_fees as f ON f.id = erd.fk_c_type_fees";
|
||||
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut >= 5 AND erd.fk_code_ventilation <> 0 ";
|
||||
$sql .= " WHERE er.rowid = erd.fk_expensereport and er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <> 0 ";
|
||||
$sql .= " AND aa.rowid = erd.fk_code_ventilation";
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= " AND er.ref like '%" . $search_expensereport . "%'";
|
||||
$sql .= natural_search("er.ref", $search_expensereport);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= natural_search("f.label", $search_label);
|
||||
@ -246,7 +255,7 @@ if ($result) {
|
||||
print $langs->trans("DescVentilDoneExpenseReport") . '<br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1);
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -201,7 +201,7 @@ $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.= " WHERE er.fk_statut > 4 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
|
||||
if (strlen(trim($search_expensereport))) {
|
||||
$sql .= natural_search("er.ref",$search_expensereport);
|
||||
|
||||
@ -104,8 +104,8 @@ $idpays = $mysoc->country_id;
|
||||
|
||||
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
|
||||
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
|
||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, bu1.type as typeop_company,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, bu2.type as typeop_user,";
|
||||
$sql .= " soc.code_compta, soc.code_compta_fournisseur, soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
|
||||
$sql .= " u.accountancy_code, u.rowid as userid, u.lastname as lastname, u.firstname as firstname, u.email as useremail, bu2.type as typeop_user,";
|
||||
$sql .= " bu3.type as typeop_payment, bu4.type as typeop_payment_supplier";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "bank as b";
|
||||
$sql .= " JOIN " . MAIN_DB_PREFIX . "bank_account as ba on b.fk_account=ba.rowid";
|
||||
@ -212,6 +212,7 @@ if ($result) {
|
||||
'id' => $obj->socid,
|
||||
'name' => $obj->name,
|
||||
'code_compta' => $compta_soc,
|
||||
'email' => $obj->email
|
||||
);
|
||||
|
||||
// Set accountancy code for user
|
||||
@ -222,7 +223,8 @@ if ($result) {
|
||||
'name' => dolGetFirstLastname($obj->firstname, $obj->lastname),
|
||||
'lastname' => $obj->lastname,
|
||||
'firstname' => $obj->firstname,
|
||||
'accountancy_code' => $compta_user,
|
||||
'email' => $obj->useremail,
|
||||
'accountancy_code' => $compta_user
|
||||
);
|
||||
|
||||
// Variable bookkeeping ($obj->rowid is Bank Id)
|
||||
@ -237,7 +239,7 @@ if ($result) {
|
||||
} else {
|
||||
$tabpay[$obj->rowid]["lib"] = dol_trunc($obj->label, 60);
|
||||
}
|
||||
$links = $object->get_url($obj->rowid);
|
||||
$links = $object->get_url($obj->rowid); // Get an array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> )
|
||||
|
||||
//var_dump($i);
|
||||
//var_dump($tabpay);
|
||||
@ -282,11 +284,15 @@ if ($result) {
|
||||
} else if ($links[$key]['type'] == 'company') {
|
||||
$societestatic->id = $links[$key]['url_id'];
|
||||
$societestatic->name = $links[$key]['label'];
|
||||
$societestatic->email = $tabcompany[$obj->rowid]['email'];
|
||||
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
|
||||
if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount;
|
||||
} else if ($links[$key]['type'] == 'user') {
|
||||
$userstatic->id = $links[$key]['url_id'];
|
||||
$userstatic->name = $links[$key]['label'];
|
||||
$userstatic->email = $tabuser[$obj->rowid]['email'];
|
||||
$userstatic->firstname = $tabuser[$obj->rowid]['firstname'];
|
||||
$userstatic->lastname = $tabuser[$obj->rowid]['lastname'];
|
||||
if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30);
|
||||
else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
|
||||
if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount;
|
||||
@ -341,7 +347,7 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id;
|
||||
} else if ($links[$key]['type'] == 'payment_expensereport') {
|
||||
$paymentexpensereportstatic->id = $links[$key]['url_id'];
|
||||
$tabpay[$obj->rowid]["lib"] .= ' ' . $paymentexpensereportstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["lib"] .= $paymentexpensereportstatic->getNomUrl(2);
|
||||
$tabpay[$obj->rowid]["paymentexpensereport"] = $paymentexpensereportstatic->id;
|
||||
} else if ($links[$key]['type'] == 'payment_various') {
|
||||
$paymentvariousstatic->id = $links[$key]['url_id'];
|
||||
@ -825,7 +831,7 @@ if (empty($action) || $action == 'view') {
|
||||
//$description = $langs->trans("DescFinanceJournal") . '<br>';
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -531,7 +531,7 @@ if (empty($action) || $action == 'view') {
|
||||
$builddate=dol_now();
|
||||
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -723,7 +723,7 @@ if (empty($action) || $action == 'view') {
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -653,7 +653,7 @@ if (empty($action) || $action == 'view') {
|
||||
else
|
||||
$description .= $langs->trans("DepositsAreIncluded");
|
||||
|
||||
$listofchoices=array('already'=>$langs->trans("AlreadyInGeneralLedger"), 'notyet'=>$langs->trans("NotYetInGeneralLedger"));
|
||||
$listofchoices=array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
|
||||
$period = $form->select_date($date_start?$date_start:-1, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end?$date_end:-1, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("JournalizationInLedgerStatus").' '. $form->selectarray('in_bookkeeping', $listofchoices, $in_bookkeeping, 1);
|
||||
|
||||
$varlink = 'id_journal=' . $id_journal;
|
||||
|
||||
@ -38,25 +38,35 @@ $langs->load("accountancy");
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
// Filter
|
||||
$year = GETPOST("year",'int');
|
||||
if ($year == 0) {
|
||||
$year_current = strftime("%Y", time());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
if (GETPOST("year",'int')) $year_start = GETPOST("year",'int');
|
||||
else
|
||||
{
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
// Validate History
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action','aZ09');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -105,31 +115,9 @@ if ($action == 'validatehistory') {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
|
||||
}
|
||||
} elseif ($action == 'cleanaccountancycode') {
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
$sql1.= " SET fk_code_ventilation = 0";
|
||||
$sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
|
||||
$sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'";
|
||||
$sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'";
|
||||
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
|
||||
$sql1.= ")";
|
||||
|
||||
dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG);
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessage($db->lasterror(), 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('Done'), 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -141,10 +129,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 $langs->trans("DescVentilSupplier") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
// Clean database
|
||||
$db->begin();
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd";
|
||||
@ -165,11 +149,13 @@ if (! $resql1) {
|
||||
}
|
||||
// End clean database
|
||||
|
||||
print $langs->trans("DescVentilSupplier") . '<br>';
|
||||
print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>';
|
||||
print '<br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>';
|
||||
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
|
||||
@ -179,22 +165,26 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $j, 'ffd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
@ -238,29 +228,33 @@ print '</div>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, '');
|
||||
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', '');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
|
||||
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number') ." AS codecomptable,";
|
||||
$sql .= " " . $db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label') . " AS intitule,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $j, 'ffd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = ffd.fk_code_ventilation";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
@ -286,7 +280,7 @@ if ($resql) {
|
||||
}
|
||||
else print $row[1];
|
||||
print '</td>';
|
||||
for($i = 2; $i <= 12; $i ++) {
|
||||
for($i = 2; $i <= 12; $i++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
}
|
||||
print '<td align="right">' . price($row[13]) . '</td>';
|
||||
@ -313,20 +307,24 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $j, 'ffd.total_ht', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " SUM(ffd.total_ht) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0 ";
|
||||
$sql .= " WHERE ff.datef >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND ff.datef <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND ff.fk_statut > 0";
|
||||
$sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/supplier/index.php');
|
||||
@ -334,9 +332,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td align="right">' . price($row[$i]) . '</td>';
|
||||
@ -344,7 +340,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
|
||||
@ -111,27 +111,36 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
|
||||
if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
$error = 0;
|
||||
|
||||
if (! (GETPOST('account_parent','int') >= 0))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
|
||||
}
|
||||
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
if (! $error)
|
||||
{
|
||||
$sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')';
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('Save'), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
$account_parent = ''; // Protection to avoid to mass apply it a second time
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -269,7 +278,7 @@ if ($result) {
|
||||
print $langs->trans("DescVentilDoneSupplier") . '<br>';
|
||||
|
||||
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 1);
|
||||
print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle');
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("ChangeBinding") . '" /></div>';
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
@ -1049,13 +1049,15 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* Load member from database
|
||||
*
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref To load member from its ref
|
||||
* @param int $fk_soc To load member from its link to third party
|
||||
* @param string $ref_ext External reference
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
* @param int $rowid Id of object to load
|
||||
* @param string $ref To load member from its ref
|
||||
* @param int $fk_soc To load member from its link to third party
|
||||
* @param string $ref_ext External reference
|
||||
* @param bool $fetch_optionals To load optionals (extrafields)
|
||||
* @param bool $fetch_subscriptions To load member subscriptions
|
||||
* @return int >0 if OK, 0 if not found, <0 if KO
|
||||
*/
|
||||
function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
|
||||
function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetch_subscriptions=true)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -1160,10 +1162,14 @@ class Adherent extends CommonObject
|
||||
|
||||
// Retreive all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
if ($fetch_optionals) {
|
||||
$this->fetch_optionals();
|
||||
}
|
||||
|
||||
// Load other properties
|
||||
$result=$this->fetch_subscriptions();
|
||||
if ($fetch_subscriptions) {
|
||||
$result=$this->fetch_subscriptions();
|
||||
}
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@ -332,7 +332,9 @@ class AdherentType extends CommonObject
|
||||
* Return array of Member objects for member type this->id (or all if this->id not defined)
|
||||
*
|
||||
* @param string $excludefilter Filter to exclude
|
||||
* @param int $mode 0=Return array of member instance, 1=Return array of members id only
|
||||
* @param int $mode 0=Return array of member instance
|
||||
* 1=Return array of member instance without extra data
|
||||
* 2=Return array of members id only
|
||||
* @return mixed Array of members or -1 on error
|
||||
*/
|
||||
function listMembersForMemberType($excludefilter='', $mode=0)
|
||||
@ -355,10 +357,14 @@ class AdherentType extends CommonObject
|
||||
{
|
||||
if (! array_key_exists($obj->rowid, $ret))
|
||||
{
|
||||
if ($mode != 1)
|
||||
if ($mode < 2)
|
||||
{
|
||||
$memberstatic=new Adherent($this->db);
|
||||
$memberstatic->fetch($obj->rowid);
|
||||
if ($mode == 1) {
|
||||
$memberstatic->fetch($obj->rowid,'','','',false, false);
|
||||
} else {
|
||||
$memberstatic->fetch($obj->rowid);
|
||||
}
|
||||
$ret[$obj->rowid]=$memberstatic;
|
||||
}
|
||||
else $ret[$obj->rowid]=$obj->rowid;
|
||||
@ -457,7 +463,7 @@ class AdherentType extends CommonObject
|
||||
foreach($this->members as $key=>$val) // This is array of users for group into dolibarr database.
|
||||
{
|
||||
$member=new Adherent($this->db);
|
||||
$member->fetch($val->id);
|
||||
$member->fetch($val->id,'','','',false,false);
|
||||
$info2 = $member->_load_ldap_info();
|
||||
$valueofldapfield[] = $member->_load_ldap_dn($info2);
|
||||
}
|
||||
|
||||
@ -79,6 +79,7 @@ if (! $sortorder) { $sortorder=($filter=='outofdate'?"DESC":"ASC"); }
|
||||
if (! $sortfield) { $sortfield=($filter=='outofdate'?"d.datefin":"d.lastname"); }
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Adherent($db);
|
||||
$hookmanager->initHooks(array('memberlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@ if (empty($reshook))
|
||||
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->listMembersForMemberType();
|
||||
$object->listMembersForMemberType('', 1);
|
||||
|
||||
$info = $object->_load_ldap_info();
|
||||
$dn = $object->_load_ldap_dn($info);
|
||||
|
||||
@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'adminaccoutant'; // To manage different context of search
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -37,9 +38,6 @@ if (! $user->admin) accessforbidden();
|
||||
|
||||
$error=0;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('adminaccoutant','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'admincompany'; // To manage different context of search
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("companies");
|
||||
@ -47,8 +48,7 @@ if (! $user->admin) accessforbidden();
|
||||
$error=0;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('admincompany','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
$hookmanager->initHooks(array('admincompany','globaladmin'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
@ -46,12 +46,10 @@ $langs->load("agenda");
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','aZ09');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'adminihm'; // To manage different context of search
|
||||
|
||||
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage=array('adminihm','globaladmin');
|
||||
$hookmanager->initHooks($contextpage);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -38,10 +38,6 @@ if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
// Other parameters
|
||||
$list = array (
|
||||
'ACCOUNTING_VAT_PAY_ACCOUNT'
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
@ -76,35 +72,38 @@ if ($action == 'update') {
|
||||
switch ($tax_mode)
|
||||
{
|
||||
case 0:
|
||||
$value = 'payment';
|
||||
$valuesellproduct = 'invoice';
|
||||
$valuebuyproduct = 'invoice';
|
||||
$valuesellservice = 'payment';
|
||||
$valuebuyservice = 'payment';
|
||||
break;
|
||||
case 1:
|
||||
$value = 'invoice';
|
||||
$valuesellproduct = 'invoice';
|
||||
$valuebuyproduct = 'invoice';
|
||||
$valuesellservice = 'invoice';
|
||||
$valuebuyservice = 'invoice';
|
||||
break;
|
||||
case 2:
|
||||
$valuesellproduct = 'payment';
|
||||
$valuebuyproduct = 'payment';
|
||||
$valuesellservice = 'payment';
|
||||
$valuebuyservice = 'payment';
|
||||
break;
|
||||
}
|
||||
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', $valuesellproduct,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', $valuebuyproduct,'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $valuesellservice, 'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $valuebuyservice, 'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_TVAINTRA", GETPOST("tva",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
dolibarr_set_const($db, "MAIN_INFO_VAT_RETURN", GETPOST("MAIN_INFO_VAT_RETURN",'alpha'),'chaine',0,'',$conf->entity);
|
||||
|
||||
// Others options
|
||||
foreach ($list as $constname) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
@ -157,10 +156,11 @@ else
|
||||
else
|
||||
{
|
||||
print '<td width="120">';
|
||||
$listval=array('0'=>$langs->trans(""),
|
||||
'1'=>$langs->trans("Monthly"),
|
||||
'2'=>$langs->trans("Quarterly"),
|
||||
'3'=>$langs->trans("Annual"),
|
||||
$listval=array(
|
||||
'0'=>$langs->trans(""),
|
||||
'1'=>$langs->trans("Monthly"),
|
||||
'2'=>$langs->trans("Quarterly"),
|
||||
'3'=>$langs->trans("Annual"),
|
||||
);
|
||||
print $form->selectarray("MAIN_INFO_VAT_RETURN", $listval, $conf->global->MAIN_INFO_VAT_RETURN);
|
||||
print "</td>";
|
||||
@ -177,54 +177,77 @@ else
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
|
||||
// Standard
|
||||
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="0"'.(empty($tax_mode) ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
|
||||
print '<td>'.nl2br($langs->trans('OptionVatDefaultDesc'));
|
||||
print "</td></tr>\n";
|
||||
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
|
||||
// On debit for services
|
||||
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
|
||||
print '<td>'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
|
||||
|
||||
// On payment for both products and services
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
{
|
||||
print '<tr class="oddeven"><td><input type="radio" name="tax_mode" value="2"'.($tax_mode == 2 ? ' checked' : '').'> '.$langs->trans('OptionPaymentForProductAndServices').'</td>';
|
||||
print '<td>'.nl2br($langs->trans('OptionPaymentForProductAndServicesDesc'))."</td></tr>\n";
|
||||
}
|
||||
print "</table>\n";
|
||||
|
||||
print '<br>';
|
||||
print ' -> '.$langs->trans("SummaryOfVatExigibilityUsedByDefault");
|
||||
print load_fiche_titre('', '', '', 0, 0, '', '-> '.$langs->trans("SummaryOfVatExigibilityUsedByDefault"));
|
||||
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td class="titlefield"> </td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
|
||||
print '<tr class="oddeven"><td class="titlefield"> </td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
|
||||
|
||||
// Products
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("OnDelivery");
|
||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment')
|
||||
{
|
||||
print $langs->trans("OnPayment");
|
||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("OnDelivery");
|
||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("OnDelivery");
|
||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment')
|
||||
{
|
||||
print $langs->trans("OnPayment");
|
||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("OnDelivery");
|
||||
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Services
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
|
||||
print '<td>';
|
||||
if ($tax_mode == 0)
|
||||
if ($conf->global->TAX_MODE_BUY_SERVICE == 'payment')
|
||||
{
|
||||
print $langs->trans("OnPayment");
|
||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||
}
|
||||
if ($tax_mode == 1)
|
||||
else
|
||||
{
|
||||
print $langs->trans("OnInvoice");
|
||||
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if ($tax_mode == 0)
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment')
|
||||
{
|
||||
print $langs->trans("OnPayment");
|
||||
print ' ('.$langs->trans("SupposedToBePaymentDate").')';
|
||||
}
|
||||
if ($tax_mode == 1)
|
||||
else
|
||||
{
|
||||
print $langs->trans("OnInvoice");
|
||||
print ' ('.$langs->trans("InvoiceDateUsed").')';
|
||||
@ -237,51 +260,21 @@ else
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Others params
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="titlefield">' . $langs->trans('Parameters') . '</td>';
|
||||
print '<td><td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($list as $key)
|
||||
{
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td><label for="'.$key.'">'.$label.'</label></td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input type="text" size="20" id="'.$key.'" name="'.$key.'" value="'.$conf->global->$key.'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
//dol_fiche_end();
|
||||
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="' . $langs->trans("Modify") . '" name="button">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
|
||||
|
||||
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
$langs->load("accountancy");
|
||||
print '<br><br><span class="opacitymedium">'.$langs->trans("AccountingAccountForSalesTaxAreDefinedInto", $langs->transnoentitiesnoconv("MenuAccountancy"), $langs->transnoentitiesnoconv("Setup")).'</span>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -183,7 +183,7 @@ $langs->load("cashdesk");
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
@ -191,7 +191,7 @@ $langs->load("cashdesk");
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
|
||||
@ -706,7 +706,6 @@ class Categorie extends CommonObject
|
||||
|
||||
|
||||
// Call trigger
|
||||
$this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger
|
||||
$this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
|
||||
$result=$this->call_trigger('CATEGORY_LINK',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
|
||||
@ -35,13 +35,14 @@ include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
|
||||
$langs->loadLangs(array("users","companies","agenda","commercial"));
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
|
||||
$resourceid=GETPOST("resourceid","int");
|
||||
$year=GETPOST("year",'int');
|
||||
$month=GETPOST("month",'int');
|
||||
$day=GETPOST("day",'int');
|
||||
$pid=GETPOST("projectid",'int',3);
|
||||
$status=GETPOST("status",'alpha');
|
||||
$type=GETPOST('type');
|
||||
$type=GETPOST('type','alphanohtml');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
// Set actioncode (this code must be same for setting actioncode into peruser, listacton and index)
|
||||
if (GETPOST('actioncode','array'))
|
||||
@ -68,8 +69,6 @@ $filtert = GETPOST("filtert","int",3);
|
||||
$usergroup = GETPOST("usergroup","int",3);
|
||||
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
|
||||
|
||||
$contextpage='actioncommlist';
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels = $extrafields->fetch_name_optionals_label('actioncomm');
|
||||
@ -114,6 +113,7 @@ if (! $user->rights->agenda->allactions->read || $filter=='mine') // If no permi
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new ActionComm($db);
|
||||
$hookmanager->initHooks(array('agendalist'));
|
||||
|
||||
$arrayfields=array(
|
||||
@ -355,7 +355,7 @@ if ($resql)
|
||||
//if ($actioncode) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">';
|
||||
//if ($resourceid) $nav.='<input type="hidden" name="resourceid" value="'.$resourceid.'">';
|
||||
if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">';
|
||||
if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
//if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">';
|
||||
//if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">';
|
||||
if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">';
|
||||
//if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">';
|
||||
|
||||
@ -82,7 +82,7 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('commcard','globalcard'));
|
||||
$hookmanager->initHooks(array('thirdpartycomm','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -616,7 +616,7 @@ if (empty($reshook))
|
||||
// Close proposal
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
if (! GETPOST('statut','int')) {
|
||||
if (! (GETPOST('statut','int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||
$action = 'statut';
|
||||
} else {
|
||||
|
||||
@ -53,6 +53,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'):'proposallist';
|
||||
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
@ -95,9 +96,6 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='p.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'proposallist';
|
||||
|
||||
// Security check
|
||||
$module='propal';
|
||||
$dbtable='';
|
||||
@ -114,6 +112,7 @@ $result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||
$diroutputmassaction=$conf->propal->multidir_output[$conf->entity] . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Propal($db);
|
||||
$hookmanager->initHooks(array('propallist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
@ -51,6 +51,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'):'orderlist';
|
||||
|
||||
$search_orderyear=GETPOST("search_orderyear","int");
|
||||
$search_ordermonth=GETPOST("search_ordermonth","int");
|
||||
@ -95,11 +96,9 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='c.ref';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new Commande($db);
|
||||
$hookmanager->initHooks(array('orderlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -54,6 +54,7 @@ $ref = GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','alpha');
|
||||
$cancel=GETPOST('cancel','alpha');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (! empty($id) ? $id : (! empty($ref) ? $ref :''));
|
||||
@ -120,10 +121,6 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
|
||||
//var_dump($contextpage);
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('banktransactionlist', $contextpage));
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -455,7 +452,7 @@ $parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ";
|
||||
if ($search_bid) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
if ($search_bid>0) $sql.= MAIN_DB_PREFIX."bank_class as l,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank_account as ba,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."bank as b";
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)";
|
||||
@ -1032,7 +1029,15 @@ if ($resql)
|
||||
print '<td align="right">';
|
||||
print price(price2num($balance, 'MT'), 1, $langs);
|
||||
print '</td>';
|
||||
print '<td colspan="'.($tmpnbfieldafterbalance+3).'">';
|
||||
print '<td align="center">';
|
||||
print '<input type="checkbox" id="selectAll" />';
|
||||
print ' <script type="text/javascript">
|
||||
$("input#selectAll").change(function() {
|
||||
$("input[type=checkbox][name^=rowid]").prop("checked", $(this).is(":checked"));
|
||||
});
|
||||
</script>';
|
||||
print '</td>';
|
||||
print '<td colspan="'.($tmpnbfieldafterbalance+2).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ class Account extends CommonObject
|
||||
* @param int $fk_bank To search using bank transaction id
|
||||
* @param int $url_id To search using link to
|
||||
* @param string $type To search using type
|
||||
* @return array|-1 Array of links or -1 on error
|
||||
* @return array|-1 Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
|
||||
*/
|
||||
function get_url($fk_bank='', $url_id='', $type='')
|
||||
{
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use Stripe\BankAccount;
|
||||
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@ -42,6 +44,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'):'bankaccountlist'; // To manage different context of search
|
||||
|
||||
$search_ref=GETPOST('search_ref','alpha');
|
||||
$search_label=GETPOST('search_label','alpha');
|
||||
@ -66,11 +69,9 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='b.label';
|
||||
if (! $sortorder) $sortorder='ASC';
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage='bankaccountlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new Account($db);
|
||||
$hookmanager->initHooks(array('bankaccountlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -3052,7 +3052,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"))));
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
|
||||
} else {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', '', 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3163,31 +3163,31 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($action == 'paid' && $resteapayer > 0) {
|
||||
// Code
|
||||
$i = 0;
|
||||
$close [$i] ['code'] = 'discount_vat'; // escompte
|
||||
$close [$i]['code'] = 'discount_vat'; // escompte
|
||||
$i ++;
|
||||
$close [$i] ['code'] = 'badcustomer';
|
||||
$close [$i]['code'] = 'badcustomer';
|
||||
$i ++;
|
||||
// Help
|
||||
$i = 0;
|
||||
$close [$i] ['label'] = $langs->trans("HelpEscompte") . '<br><br>' . $langs->trans("ConfirmClassifyPaidPartiallyReasonDiscountVatDesc");
|
||||
$close [$i]['label'] = $langs->trans("HelpEscompte") . '<br><br>' . $langs->trans("ConfirmClassifyPaidPartiallyReasonDiscountVatDesc");
|
||||
$i ++;
|
||||
$close [$i] ['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
|
||||
$close [$i]['label'] = $langs->trans("ConfirmClassifyPaidPartiallyReasonBadCustomerDesc");
|
||||
$i ++;
|
||||
// Texte
|
||||
$i = 0;
|
||||
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscount", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
|
||||
$close [$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonDiscount", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close[$i]['label'], 1);
|
||||
$i ++;
|
||||
$close [$i] ['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close [$i] ['label'], 1);
|
||||
$close [$i]['reason'] = $form->textwithpicto($langs->transnoentities("ConfirmClassifyPaidPartiallyReasonBadCustomer", $resteapayer, $langs->trans("Currency" . $conf->currency)), $close[$i]['label'], 1);
|
||||
$i ++;
|
||||
// arrayreasons[code]=reason
|
||||
foreach ($close as $key => $val) {
|
||||
$arrayreasons [$close [$key] ['code']] = $close [$key] ['reason'];
|
||||
$arrayreasons[$close [$key]['code']] = $close[$key]['reason'];
|
||||
}
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"),array('type' => 'radio','name' => 'close_code','label' => $langs->trans("Reason"),'values' => $arrayreasons),array('type' => 'text','name' => 'close_note','label' => $langs->trans("Comment"),'value' => '','size' => '100'));
|
||||
$formquestion = array('text' => $langs->trans("ConfirmClassifyPaidPartiallyQuestion"),array('type' => 'radio','name' => 'close_code','label' => $langs->trans("Reason"),'values' => $arrayreasons),array('type' => 'text','name' => 'close_note','label' => $langs->trans("Comment"),'value' => '','morecss' => 'minwidth300'));
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes");
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?facid=' . $object->id, $langs->trans('ClassifyPaid'), $langs->trans('ConfirmClassifyPaidPartially', $object->ref), 'confirm_paid_partially', $formquestion, "yes", 1, 250);
|
||||
}
|
||||
|
||||
// Confirmation du classement abandonne
|
||||
@ -3216,16 +3216,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
$arrayreasons [$close [2] ['code']] = $close [2] ['reason'];
|
||||
|
||||
// Cree un tableau formulaire
|
||||
$formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"),array('type' => 'radio','name' => 'close_code','label' => $langs->trans("Reason"),'values' => $arrayreasons),array('type' => 'text','name' => 'close_note','label' => $langs->trans("Comment"),'value' => '','size' => '100'));
|
||||
$formquestion = array('text' => $langs->trans("ConfirmCancelBillQuestion"),array('type' => 'radio','name' => 'close_code','label' => $langs->trans("Reason"),'values' => $arrayreasons),array('type' => 'text','name' => 'close_note','label' => $langs->trans("Comment"),'value' => '','morecss' => 'minwidth300'));
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('CancelBill'), $langs->trans('ConfirmCancelBill', $object->ref), 'confirm_canceled', $formquestion, "yes");
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('CancelBill'), $langs->trans('ConfirmCancelBill', $object->ref), 'confirm_canceled', $formquestion, "yes", 1, 250);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'deletepaiement')
|
||||
{
|
||||
$payment_id = GETPOST('paiement_id');
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 'no', 1);
|
||||
|
||||
}
|
||||
|
||||
@ -4198,7 +4198,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->unvalidate)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("NotEnoughPermissions") . '">' . $langs->trans('Modify') . '</span></div>';
|
||||
}
|
||||
@ -4227,7 +4227,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=reopen">' . $langs->trans('ReOpen') . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('ReOpen') . '</span></div>';
|
||||
}
|
||||
@ -4238,7 +4238,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->facture->invoice_advance->validate)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=valid">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4310,16 +4310,16 @@ else if ($id > 0 || ! empty($ref))
|
||||
// For standard invoice with excess received
|
||||
if ($object->type == Facture::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) < 0 && $user->rights->facture->creer && empty($discount->id))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').'</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('ConvertExcessReceivedToReduc').'</a></div>';
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" 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
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $user->rights->facture->creer && empty($discount->id))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" 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>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -4328,7 +4328,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
|| ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 0 && $object->total_ttc > 0 && $resteapayer == 0 && $user->rights->facture->paiement && empty($discount->id))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
}
|
||||
|
||||
// Classify 'closed not completely paid' (possible si validee et pas encore classee payee)
|
||||
@ -4338,7 +4338,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($totalpaye > 0 || $totalcreditnotes > 0)
|
||||
{
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=paid">' . $langs->trans('ClassifyPaidPartially') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=paid">' . $langs->trans('ClassifyPaidPartially') . '</a></div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4350,7 +4350,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=canceled">' . $langs->trans('ClassifyCanceled') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=canceled">' . $langs->trans('ClassifyCanceled') . '</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4359,7 +4359,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $user->rights->facture->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=clone&object=invoice">' . $langs->trans("ToClone") . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butAction'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&action=clone&object=invoice">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
@ -4418,7 +4418,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete'.($conf->use_javascript_ajax?' reposition':'').'" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&action=delete">' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="' . $langs->trans("NotAllowed") . '">' . $langs->trans('Delete') . '</a></div>';
|
||||
|
||||
@ -66,6 +66,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'):'invoicelist';
|
||||
|
||||
$lineid=GETPOST('lineid','int');
|
||||
$userid=GETPOST('userid','int');
|
||||
@ -114,9 +115,6 @@ if (! $sortfield) $sortfield='f.datef';
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'invoicelist';
|
||||
|
||||
// Security check
|
||||
$fieldid = (! empty($ref)?'facnumber':'rowid');
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
@ -129,6 +127,7 @@ $object=new Facture($db);
|
||||
$now=dol_now();
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Facture($db);
|
||||
$hookmanager->initHooks(array('invoicelist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -366,7 +365,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " country.code as country_code,";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
@ -979,6 +978,7 @@ if ($resql)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_label;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -52,7 +52,6 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
$modetax = $conf->global->TAX_MODE;
|
||||
if (isset($_GET["modetax"])) $modetax=GETPOST("modetax",'alpha');
|
||||
|
||||
|
||||
/**
|
||||
* print function
|
||||
*
|
||||
@ -174,16 +173,16 @@ $y = $year_current ;
|
||||
$total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
|
||||
$i=0;
|
||||
for ($m = 1 ; $m < 13 ; $m++ ) {
|
||||
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
|
||||
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
|
||||
|
||||
$coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
|
||||
$coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
|
||||
|
||||
$action = "tva";
|
||||
$object = array(&$coll_listsell, &$coll_listbuy);
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["year"] = $y;
|
||||
$parameters["month"] = $m;
|
||||
$parameters["type"] = 'localtax'.$localTaxType;
|
||||
|
||||
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -198,7 +197,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'</td>';
|
||||
if($CalcLT==0) {
|
||||
@ -229,7 +228,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
|
||||
}
|
||||
$subtotalcoll = $subtotalcoll + $x_coll;
|
||||
print "<td class=\"nowrap\" align=\"right\">".price($x_coll)."</td><td></td>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($CalcLT==0) {
|
||||
@ -239,7 +238,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) {
|
||||
} elseif($CalcLT==2) {
|
||||
$diff= $x_coll;
|
||||
}
|
||||
|
||||
|
||||
$total = $total + $diff;
|
||||
$subtotal = $subtotal + $diff;
|
||||
|
||||
|
||||
@ -504,18 +504,18 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<tr><td class="'.(GETPOST('paiementcode')=='CHQ'?'fieldrequired ':'').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
|
||||
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur').'"></td></tr>';
|
||||
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur','alphanohtml').'"></td></tr>';
|
||||
|
||||
// Bank name
|
||||
print '<tr><td>'.$langs->trans('Bank');
|
||||
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
||||
print '</td>';
|
||||
print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank').'"></td></tr>';
|
||||
print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank','alphanohtml').'"></td></tr>';
|
||||
|
||||
// Comments
|
||||
print '<tr><td>'.$langs->trans('Comments').'</td>';
|
||||
print '<td class="tdtop">';
|
||||
print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('comment').'</textarea></td></tr>';
|
||||
print '<textarea name="comment" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.GETPOST('comment','none').'</textarea></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
@ -34,9 +34,7 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/facture/modules_facture.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('banks');
|
||||
$langs->load('companies');
|
||||
$langs->loadLangs(array('bills','banks','companies'));
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref', 'alpha');
|
||||
@ -222,57 +220,64 @@ print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">'."\n";
|
||||
|
||||
// Date payment
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">';
|
||||
print '<tr><td class="titlefield">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td>';
|
||||
print $form->editfieldval("Date",'datep',$object->date,$object,$user->rights->facture->paiement,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Payment type (VIR, LIQ, ...)
|
||||
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
||||
|
||||
// Payment numero
|
||||
print '<tr><td>'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||
print $form->editfieldval("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount,'',$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td class="tdtop">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->facture->paiement).'</td><td colspan="3">';
|
||||
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->facture->paiement,'textarea');
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td>'.$labeltype.'</td></tr>';
|
||||
|
||||
$disable_delete = 0;
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($object->bank_line);
|
||||
if ($bankline->rappro)
|
||||
{
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
||||
}
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
$bankline=new AccountLine($db);
|
||||
$bankline->fetch($object->bank_line);
|
||||
if ($bankline->rappro)
|
||||
{
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $bankline->getNomUrl(1,0,'showconciliated');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankAccount').'</td>';
|
||||
print '<td>';
|
||||
$accountstatic=new Account($db);
|
||||
$accountstatic->fetch($bankline->fk_account);
|
||||
print $accountstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print $accountstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Payment numero
|
||||
/*
|
||||
$titlefield=$langs->trans('Numero').' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print '<tr><td>'.$form->editfieldkey($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
|
||||
print $form->editfieldval($titlefield,'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Check transmitter
|
||||
$titlefield=$langs->trans('CheckTransmitter').' <em>('.$langs->trans("ChequeMaker").')</em>';
|
||||
print '<tr><td>'.$form->editfieldkey($titlefield,'chqemetteur',$object->,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
|
||||
print $form->editfieldval($titlefield,'chqemetteur',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeMakeUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
|
||||
// Bank name
|
||||
$titlefield=$langs->trans('Bank').' <em>('.$langs->trans("ChequeBank").')</em>';
|
||||
print '<tr><td>'.$form->editfieldkey($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td>';
|
||||
print $form->editfieldval($titlefield,'chqbank',$object->aaa,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('ChequeBankUpdateSucceeded'));
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
// Bank account
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
if ($object->fk_account > 0)
|
||||
{
|
||||
if ($object->type_code == 'CHQ' && $bankline->fk_bordereau > 0)
|
||||
{
|
||||
dol_include_once('/compta/paiement/cheque/class/remisecheque.class.php');
|
||||
@ -280,15 +285,30 @@ if (! empty($conf->banque->enabled))
|
||||
$bordereau->fetch($bankline->fk_bordereau);
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('CheckReceipt').'</td>';
|
||||
print '<td colspan="3">';
|
||||
print '<td>'.$langs->trans('CheckReceipt').'</td>';
|
||||
print '<td>';
|
||||
print $bordereau->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||
print '<td>';
|
||||
print $bankline->getNomUrl(1,0,'showconciliated');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Comments
|
||||
print '<tr><td class="tdtop">'.$form->editfieldkey("Comments",'note',$object->note,$object,$user->rights->facture->paiement).'</td><td>';
|
||||
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->facture->paiement,'textarea:'.ROWS_3.':90%');
|
||||
print '</td></tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans('Amount').'</td><td>'.price($object->amount,'',$langs,0,-1,-1,$conf->currency).'</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -59,6 +59,7 @@ class Paiement extends CommonObject
|
||||
// de llx_paiement qui est lie aux types de
|
||||
//paiement de llx_c_paiement
|
||||
var $num_paiement; // Numero du CHQ, VIR, etc...
|
||||
var $num_payment; // Numero du CHQ, VIR, etc...
|
||||
var $bank_account; // Id compte bancaire du paiement
|
||||
var $bank_line; // Id de la ligne d'ecriture bancaire
|
||||
// fk_paiement dans llx_paiement est l'id du type de paiement (7 pour CHQ, ...)
|
||||
@ -88,7 +89,7 @@ class Paiement extends CommonObject
|
||||
{
|
||||
$sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.fk_bank,';
|
||||
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
|
||||
$sql.= ' p.num_paiement, p.note,';
|
||||
$sql.= ' p.num_paiement as num_payment, p.note,';
|
||||
$sql.= ' b.fk_account';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
@ -110,7 +111,9 @@ class Paiement extends CommonObject
|
||||
$this->ref = $obj->ref?$obj->ref:$obj->rowid;
|
||||
$this->date = $this->db->jdate($obj->dp);
|
||||
$this->datepaye = $this->db->jdate($obj->dp);
|
||||
$this->numero = $obj->num_paiement;
|
||||
$this->numero = $obj->num_payment; // deprecated
|
||||
$this->num_paiement = $obj->num_payment; // deprecated
|
||||
$this->num_payment = $obj->num_payment;
|
||||
$this->montant = $obj->amount; // deprecated
|
||||
$this->amount = $obj->amount;
|
||||
$this->note = $obj->note;
|
||||
|
||||
@ -107,13 +107,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
}
|
||||
|
||||
// $date_start and $date_end are defined. We force $start_year and $nbofyear
|
||||
// $date_start and $date_end are defined. We force $year_start and $nbofyear
|
||||
$tmps=dol_getdate($date_start);
|
||||
$start_year = $tmps['year'];
|
||||
$year_start = $tmps['year'];
|
||||
$tmpe=dol_getdate($date_end);
|
||||
$year_end = $tmpe['year'];
|
||||
$nbofyear = ($year_end - $start_year) + 1;
|
||||
//var_dump($start_year." ".$end_year." ".$nbofyear);
|
||||
//var_dump("year_start=".$year_start." year_end=".$year_end." nbofyear=".$nbofyear." date_start=".dol_print_date($date_start, 'dayhour')." date_end=".dol_print_date($date_end, 'dayhour'));
|
||||
|
||||
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING')
|
||||
$modecompta = $conf->global->ACCOUNTING_MODE;
|
||||
@ -253,8 +253,8 @@ if ($modecompta == 'BOOKKEEPING')
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql.= " WHERE f.numero_compte = aa.account_number";
|
||||
//$sql.= " AND fk_statut in (1,2)";
|
||||
$sql.= " AND ".$predefinedgroupwhere;
|
||||
$sql.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
|
||||
@ -295,7 +295,7 @@ if ($modecompta == 'BOOKKEEPING')
|
||||
if ($showaccountdetail != 'no')
|
||||
{
|
||||
$tmppredefinedgroupwhere="pcg_type = '".$db->escape($objp->pcg_type)."' AND pcg_subtype = '".$db->escape($objp->pcg_subtype)."'";
|
||||
$tmppredefinedgroupwhere.= " AND fk_pcg_version = '".$charofaccountstring."'";
|
||||
$tmppredefinedgroupwhere.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
|
||||
//$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'";
|
||||
|
||||
// Get cpts of category/group
|
||||
@ -312,7 +312,7 @@ if ($modecompta == 'BOOKKEEPING')
|
||||
}
|
||||
|
||||
|
||||
if ($showaccountdetail == 'all' || $resultN > 0)
|
||||
if ($showaccountdetail == 'all' || $resultN <> 0)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td></td>';
|
||||
|
||||
@ -85,13 +85,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); }
|
||||
}
|
||||
|
||||
// $date_start and $date_end are defined. We force $start_year and $nbofyear
|
||||
// $date_start and $date_end are defined. We force $year_start and $nbofyear
|
||||
$tmps=dol_getdate($date_start);
|
||||
$start_year = $tmps['year'];
|
||||
$year_start = $tmps['year'];
|
||||
$tmpe=dol_getdate($date_end);
|
||||
$year_end = $tmpe['year'];
|
||||
$nbofyear = ($year_end - $start_year) + 1;
|
||||
//var_dump($start_year." ".$end_year." ".$nbofyear);
|
||||
//var_dump("year_start=".$year_start." year_end=".$year_end." nbofyear=".$nbofyear." date_start=".dol_print_date($date_start, 'dayhour')." date_end=".dol_print_date($date_end, 'dayhour'));
|
||||
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -376,7 +377,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -409,7 +409,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -443,7 +442,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -474,7 +472,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -537,7 +534,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -600,7 +596,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -647,7 +642,6 @@ if (! empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $m
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$var = false;
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ($i < $num) {
|
||||
@ -775,7 +769,6 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
@ -810,32 +803,35 @@ elseif ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
|
||||
{
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
$predefinedgroupwhere = "(";
|
||||
//$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
|
||||
$predefinedgroupwhere.= " (pcg_type = 'EXPENSE')";
|
||||
$predefinedgroupwhere.= " OR ";
|
||||
//$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
|
||||
$predefinedgroupwhere.= " (pcg_type = 'INCOME')";
|
||||
$predefinedgroupwhere.= ")";
|
||||
|
||||
$charofaccountstring = $conf->global->CHARTOFACCOUNTS;
|
||||
$charofaccountstring=dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
$sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql.= " WHERE b.numero_compte = aa.account_number AND b.entity = ".$conf->entity;
|
||||
//$sql.= " AND fk_statut in (1,2)";
|
||||
$sql.= " AND (";
|
||||
//$sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))";
|
||||
$sql.= " (pcg_type = 'EXPENSE')";
|
||||
$sql.= " OR ";
|
||||
//$sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))";
|
||||
$sql.= " (pcg_type = 'INCOME')";
|
||||
$sql.= ")";
|
||||
//$sql.= " AND code_journal in ('VT', 'AC')";
|
||||
$sql.= " AND ".$predefinedgroupwhere;
|
||||
$sql.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
|
||||
if (! empty($date_start) && ! empty($date_end))
|
||||
$sql.= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'";
|
||||
$sql.= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm";
|
||||
//print $sql;
|
||||
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
|
||||
dol_syslog("get bookkeeping record");
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$var=false;
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
@ -845,9 +841,8 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING'))
|
||||
|
||||
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
|
||||
$encaiss[$obj->dm] += $obj->debit;
|
||||
|
||||
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
|
||||
$encaiss_ttc[$obj->dm] += $obj->credit;
|
||||
$encaiss_ttc[$obj->dm] += 0;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -908,7 +903,6 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
}
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
|
||||
// Loop on each month
|
||||
$nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0;
|
||||
@ -926,21 +920,44 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
$case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage));
|
||||
|
||||
print '<td align="right"> ';
|
||||
if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
|
||||
if ($modecompta == 'BOOKKEEPING')
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>';
|
||||
if (! isset($totsorties[$annee])) $totsorties[$annee]=0;
|
||||
$totsorties[$annee]+=$decaiss_ttc[$case];
|
||||
if (isset($decaiss[$case]) && $decaiss[$case] != 0)
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss[$case],'MT')).'</a>';
|
||||
if (! isset($totsorties[$annee])) $totsorties[$annee]=0;
|
||||
$totsorties[$annee]+=$decaiss[$case];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0)
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($decaiss_ttc[$case],'MT')).'</a>';
|
||||
if (! isset($totsorties[$annee])) $totsorties[$annee]=0;
|
||||
$totsorties[$annee]+=$decaiss_ttc[$case];
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
print '<td align="right" class="borderrightlight"> ';
|
||||
//if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0)
|
||||
if (isset($encaiss_ttc[$case]))
|
||||
if ($modecompta == 'BOOKKEEPING')
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($encaiss_ttc[$case],'MT')).'</a>';
|
||||
if (! isset($totentrees[$annee])) $totentrees[$annee]=0;
|
||||
$totentrees[$annee]+=$encaiss_ttc[$case];
|
||||
if (isset($encaiss[$case]))
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($encaiss[$case],'MT')).'</a>';
|
||||
if (! isset($totentrees[$annee])) $totentrees[$annee]=0;
|
||||
$totentrees[$annee]+=$encaiss[$case];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($encaiss_ttc[$case]))
|
||||
{
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta?'&modecompta='.$modecompta:'').'">'.price(price2num($encaiss_ttc[$case],'MT')).'</a>';
|
||||
if (! isset($totentrees[$annee])) $totentrees[$annee]=0;
|
||||
$totentrees[$annee]+=$encaiss_ttc[$case];
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
}
|
||||
@ -951,7 +968,10 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
|
||||
// Total
|
||||
|
||||
$nbcols=0;
|
||||
print '<tr class="liste_total impair"><td>'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<tr class="liste_total impair"><td>';
|
||||
if ($modecompta == 'BOOKKEEPING') print $langs->trans("Total");
|
||||
else print $langs->trans("TotalTTC");
|
||||
print '</td>';
|
||||
for ($annee = $year_start ; $annee <= $year_end ; $annee++)
|
||||
{
|
||||
$nbcols+=2;
|
||||
|
||||
@ -37,6 +37,7 @@ $langs->load("compta");
|
||||
$langs->load("companies");
|
||||
$langs->load("products");
|
||||
$langs->load("other");
|
||||
$langs->load("admin");
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year");
|
||||
@ -132,24 +133,28 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
$fsearch.=' <input type="text" name="min" id="min" value="'.$min.'" size="6">';
|
||||
|
||||
$description='';
|
||||
|
||||
$calcmode='';
|
||||
if ($modetax == 0) $calcmode=$langs->trans('OptionVATDefault');
|
||||
if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
|
||||
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$langs->trans("RulesVATInServices");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modetax==1) { // Calculate on invoice for goods and services
|
||||
$name=$langs->trans("VATReportByCustomersInDueDebtMode");
|
||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
//$name.='<br>('.$langs->trans("SeeVATReportInInputOutputMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=0">','</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-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATDueServices");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATDueProducts");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
$description.=$fsearch;
|
||||
$description.='<br>'
|
||||
. '<input type="radio" name="extra_report" value="0" '.($special_report?'':'checked="checked"').'> '
|
||||
@ -178,20 +183,8 @@ if ($modetax==1) { // Calculate on invoice for goods and services
|
||||
}
|
||||
if ($modetax==0) { // Invoice for goods, payment for services
|
||||
$name=$langs->trans("VATReportByCustomersInInputOutputMode");
|
||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
//$name.='<br>('.$langs->trans("SeeVATReportInDueDebtMode",'<a href="'.$_SERVER["PHP_SELF"].'?year='.$year_start.'&modetax=1">','</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-1)."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start+1)."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATInServices");
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATInProducts");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= ' ' . $langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description .= ' ' . $langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
$langs->loadLangs(array("other","compta","banks","bills","companies"));
|
||||
$langs->loadLangs(array("other","compta","banks","bills","companies","admin"));
|
||||
|
||||
$year=GETPOST("year","int");
|
||||
if ($year == 0)
|
||||
@ -107,9 +107,23 @@ function pt ($db, $sql, $date)
|
||||
$tva = new Tva($db);
|
||||
|
||||
$name = $langs->trans("ReportByMonth");
|
||||
$description = $langs->trans("VATSummary");
|
||||
$calcmode = $langs->trans("VATReportBuildWithOptionDefinedInModule").' ';
|
||||
$calcmode.= '('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
|
||||
$calcmode='';
|
||||
if ($modetax == 0) $calcmode=$langs->trans('OptionVATDefault');
|
||||
if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
|
||||
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
|
||||
$description = $langs->trans("VATSummary").'<br>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$langs->trans("RulesVATInServices");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");
|
||||
|
||||
$builddate=dol_now();
|
||||
|
||||
llxHeader('', $name);
|
||||
@ -146,8 +160,8 @@ $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0;
|
||||
$i=0;
|
||||
for ($m = 1 ; $m < 13 ; $m++ )
|
||||
{
|
||||
$coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m);
|
||||
$coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m);
|
||||
$coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m);
|
||||
$coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m);
|
||||
|
||||
$action = "tva";
|
||||
$object = array(&$coll_listsell, &$coll_listbuy);
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007, 2015 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 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
|
||||
@ -21,10 +20,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/quadri_detail.php
|
||||
* \ingroup tax
|
||||
* \file htdocs/compta/tva/quadri_detail.php
|
||||
* \ingroup tax
|
||||
* \brief Trimestrial page - detailed version
|
||||
* TODO Deal with recurrent invoices as well
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
@ -46,6 +44,7 @@ $langs->load("companies");
|
||||
$langs->load("products");
|
||||
$langs->load("trips");
|
||||
$langs->load("other");
|
||||
$langs->load("admin");
|
||||
|
||||
// Date range
|
||||
$year=GETPOST("year","int");
|
||||
@ -68,11 +67,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
if (GETPOST("month")) { $date_start=dol_get_first_day($year_start,GETPOST("month"),false); $date_end=dol_get_last_day($year_start,GETPOST("month"),false); }
|
||||
else
|
||||
{
|
||||
$month_current = strftime("%m",dol_now());
|
||||
if ($month_current >= 10) $q=4;
|
||||
elseif ($month_current >= 7) $q=3;
|
||||
elseif ($month_current >= 4) $q=2;
|
||||
else $q=1;
|
||||
$month_current = strftime("%m",dol_now());
|
||||
if ($month_current >= 10) $q=4;
|
||||
elseif ($month_current >= 7) $q=3;
|
||||
elseif ($month_current >= 4) $q=2;
|
||||
else $q=1;
|
||||
}
|
||||
}
|
||||
if ($q==1) { $date_start=dol_get_first_day($year_start,1,false); $date_end=dol_get_last_day($year_start,3,false); }
|
||||
@ -103,7 +102,7 @@ $result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
$morequerystring='';
|
||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||
foreach($listofparams as $param)
|
||||
foreach ($listofparams as $param)
|
||||
{
|
||||
if (GETPOST($param)!='') $morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||
}
|
||||
@ -130,86 +129,60 @@ $fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modetax==1) // Calculate on invoice for goods and services
|
||||
{
|
||||
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
|
||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$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);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) $prevquarter--;
|
||||
else { $prevquarter=4; $prevyear--; }
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATDueServices");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATDueProducts");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
// Customers invoices
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
|
||||
// Suppliers invoices
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$langs->trans("ProductOrService");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
|
||||
// Show report header
|
||||
$name=$langs->trans("VATReportByPeriods");
|
||||
$calcmode='';
|
||||
if ($modetax == 0) $calcmode=$langs->trans('OptionVATDefault');
|
||||
if ($modetax == 1) $calcmode=$langs->trans('OptionVATDebitOption');
|
||||
if ($modetax == 2) $calcmode=$langs->trans('OptionPaymentForProductAndServices');
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
// Set period
|
||||
$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);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) {
|
||||
$prevquarter--;
|
||||
} else {
|
||||
$prevquarter=4; $prevyear--;
|
||||
}
|
||||
if ($modetax==0) // Invoice for goods, payment for services
|
||||
{
|
||||
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
|
||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$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);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) $prevquarter--;
|
||||
else { $prevquarter=4; $prevyear--; }
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) $nextquarter++;
|
||||
else { $nextquarter=1; $nextyear++; }
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATInServices");
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATInProducts");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
else $description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
// Customers invoices
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
if ($mysoc->tva_assuj) $vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
|
||||
// Suppliers invoices
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$langs->trans("ProductOrService");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
if ($mysoc->tva_assuj) $vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) {
|
||||
$nextquarter++;
|
||||
} else {
|
||||
$nextquarter=1; $nextyear++;
|
||||
}
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'invoice') $description.=$langs->trans("RulesVATDueProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment') $description.=$langs->trans("RulesVATInProducts");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'invoice') $description.='<br>'.$langs->trans("RulesVATDueServices");
|
||||
if ($conf->global->TAX_MODE_SELL_SERVICE == 'payment') $description.='<br>'.$langs->trans("RulesVATInServices");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
}
|
||||
if (! empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description.='<br>'.$langs->trans("ThisIsAnEstimatedValue");
|
||||
|
||||
// Customers invoices
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$namecust=$langs->trans("Name");
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
}
|
||||
|
||||
// Suppliers invoices
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$productcust;
|
||||
$amountsup=$amountcust;
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
$namesup=$namecust;
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
|
||||
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
@ -222,68 +195,72 @@ print '<table class="noborder" width="100%">';
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
$columns = 5;
|
||||
|
||||
// Load arrays of datas
|
||||
$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
$x_coll = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
|
||||
if (! is_array($x_coll) || ! is_array($x_paye))
|
||||
{
|
||||
$langs->load("errors");
|
||||
if ($x_coll == -1)
|
||||
print '<tr><td colspan="5">'.$langs->trans("ErrorNoAccountancyModuleLoaded").'</td></tr>';
|
||||
else if ($x_coll == -2)
|
||||
print '<tr><td colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
else
|
||||
print '<tr><td colspan="5">'.$langs->trans("Error").'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($x_coll == -1) {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
||||
} else if ($x_coll == -2) {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
||||
} else {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("Error") . '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
$x_both = array();
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate)
|
||||
{
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
|
||||
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
$x_both[$my_coll_rate]['paye']['vat'] = 0;
|
||||
$x_both[$my_coll_rate]['coll']['links'] = '';
|
||||
$x_both[$my_coll_rate]['coll']['detail'] = array();
|
||||
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy)
|
||||
{
|
||||
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) {
|
||||
$invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id];
|
||||
$invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id];
|
||||
$invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id];
|
||||
$company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]);
|
||||
$x_both[$my_coll_rate]['coll']['detail'][] = array(
|
||||
'id' =>$x_coll[$my_coll_rate]['facid'][$id],
|
||||
'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
|
||||
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
||||
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
||||
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
||||
'payment_id' =>$x_coll[$my_coll_rate]['payment_id'][$id],
|
||||
'payment_amount' =>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc' =>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
||||
'dtotal_ttc' =>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
||||
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
||||
'ddate_start' =>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
||||
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
||||
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_customer->getNomUrl(1,'',12));
|
||||
'id' =>$x_coll[$my_coll_rate]['facid'][$id],
|
||||
'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
|
||||
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
||||
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
||||
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
||||
'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
||||
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
||||
'datef' =>$x_coll[$my_coll_rate]['datef'][$id],
|
||||
'datep' =>$x_coll[$my_coll_rate]['datep'][$id],
|
||||
'company_link'=>$company_static->getNomUrl(1,'',20),
|
||||
'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
||||
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
||||
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_customer->getNomUrl(1,'',12)
|
||||
);
|
||||
}
|
||||
}
|
||||
// tva paid
|
||||
foreach(array_keys($x_paye) as $my_paye_rate){
|
||||
foreach (array_keys($x_paye) as $my_paye_rate) {
|
||||
$x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht'];
|
||||
$x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat'];
|
||||
if(!isset($x_both[$my_paye_rate]['coll']['totalht'])){
|
||||
if (!isset($x_both[$my_paye_rate]['coll']['totalht'])) {
|
||||
$x_both[$my_paye_rate]['coll']['totalht'] = 0;
|
||||
$x_both[$my_paye_rate]['coll']['vat'] = 0;
|
||||
}
|
||||
$x_both[$my_paye_rate]['paye']['links'] = '';
|
||||
$x_both[$my_paye_rate]['paye']['detail'] = array();
|
||||
|
||||
foreach($x_paye[$my_paye_rate]['facid'] as $id=>$dummy)
|
||||
foreach ($x_paye[$my_paye_rate]['facid'] as $id=>$dummy)
|
||||
{
|
||||
// ExpenseReport
|
||||
if ($x_paye[$my_paye_rate]['ptype'][$id] == 'ExpenseReportPayment')
|
||||
@ -293,21 +270,21 @@ else
|
||||
$expensereport->type=$x_paye[$my_paye_rate]['type'][$id];
|
||||
|
||||
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$expensereport->getNomUrl(1)
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$expensereport->getNomUrl(1)
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -315,22 +292,26 @@ else
|
||||
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
|
||||
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
||||
$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];
|
||||
$company_static->fetch($x_paye[$my_paye_rate]['company_id'][$id]);
|
||||
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id' =>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount' =>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc' =>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc' =>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'ddate_start' =>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_supplier->getNomUrl(1,'',12)
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'datef' =>$x_paye[$my_paye_rate]['datef'][$id],
|
||||
'datep' =>$x_paye[$my_paye_rate]['datep'][$id],
|
||||
'company_link'=>$company_static->getNomUrl(1,'',20),
|
||||
'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_supplier->getNomUrl(1,'',12)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -345,16 +326,20 @@ else
|
||||
$x_paye_sum = 0;
|
||||
$x_paye_ht = 0;
|
||||
|
||||
$span=3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
$span=$columns;
|
||||
if ($modetax != 1) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$langs->trans("DateInvoice").'</td>';
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="left">'.$namecust.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
if ($modetax == 0)
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td align="right">'.$amountcust.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
@ -374,8 +359,7 @@ else
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach(array_keys($x_coll) as $rate)
|
||||
{
|
||||
foreach (array_keys($x_coll) as $rate) {
|
||||
$subtot_coll_total_ht = 0;
|
||||
$subtot_coll_vat = 0;
|
||||
|
||||
@ -384,17 +368,20 @@ else
|
||||
// VAT Rate
|
||||
$var=true;
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.($span+1).'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach($x_both[$rate]['coll']['detail'] as $index => $fields)
|
||||
{
|
||||
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
if (!empty($fields['ddate_start'])) {
|
||||
$type=1;
|
||||
}
|
||||
if (!empty($fields['ddate_end'])) {
|
||||
$type=1;
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -402,6 +389,16 @@ else
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_SELL_PRODUCT == 'payment' || $conf->global->TAX_MODE_SELL_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid'])
|
||||
@ -410,17 +407,25 @@ else
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
if (dol_string_nohtmltag($fields['descr'])) {
|
||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg))
|
||||
{
|
||||
if ($reg[1]=='DEPOSIT') $fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
elseif ($reg[1]=='CREDIT_NOTE') $fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
else $fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
if ($type) {
|
||||
$text = img_object($langs->trans('Service'),'service');
|
||||
} else {
|
||||
$text = img_object($langs->trans('Product'),'product');
|
||||
}
|
||||
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) {
|
||||
if ($reg[1]=='DEPOSIT') {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
} elseif ($reg[1]=='CREDIT_NOTE') {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
} else {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
@ -430,7 +435,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0)
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
@ -445,9 +450,8 @@ else
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0)
|
||||
if ($modetax != 1)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
@ -455,28 +459,31 @@ else
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
print $payment_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
if (($type == 0 && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|
||||
|| ($type == 1 && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice'))
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
}
|
||||
else {
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
print $langs->trans("NA");
|
||||
} else {
|
||||
if (isset($fields['payment_amount']) && price2num($fields['ftotal_ttc'])) {
|
||||
$ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print price(price2num($fields['payment_amount'],'MT'));
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Total collected
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht,'MT'),1);
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat=$fields['vat'];
|
||||
if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
$temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_vat,'MT'),1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
@ -487,45 +494,45 @@ else
|
||||
$x_coll_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_coll_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_coll_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_coll_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_coll_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_coll) == 0) // Show a total ine if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if (count($x_coll) == 0) // Show a total ine if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Blank line
|
||||
// Blank line
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
|
||||
//print table headers for this quadri - expenses now
|
||||
//imprime les en-tete de tables pour ce quadri - maintenant les d<>penses
|
||||
// Print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre liste_titre_topborder">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$langs->trans("Date").'</td>';
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">'.$langs->trans("DatePayment").'</td>';
|
||||
else print '<td></td>';
|
||||
print '<td align="left">'.$namesup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
if ($modetax != 1) {
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
@ -533,25 +540,29 @@ else
|
||||
print '<td align="right">'.$vatsup.'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach(array_keys($x_paye) as $rate)
|
||||
foreach (array_keys($x_paye) as $rate)
|
||||
{
|
||||
$subtot_paye_total_ht = 0;
|
||||
$subtot_paye_vat = 0;
|
||||
|
||||
if(is_array($x_both[$rate]['paye']['detail']))
|
||||
if (is_array($x_both[$rate]['paye']['detail']))
|
||||
{
|
||||
$var=true;
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.($span+1).'"></td>';
|
||||
print '</tr>'."\n";
|
||||
foreach($x_both[$rate]['paye']['detail'] as $index=>$fields)
|
||||
{
|
||||
|
||||
foreach ($x_both[$rate]['paye']['detail'] as $index=>$fields) {
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (! empty($fields['ddate_start'])) $type=1;
|
||||
if (! empty($fields['ddate_end'])) $type=1;
|
||||
if (!empty($fields['ddate_start'])) {
|
||||
$type=1;
|
||||
}
|
||||
if (!empty($fields['ddate_end'])) {
|
||||
$type=1;
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
@ -559,6 +570,16 @@ else
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . dol_print_date($fields['datef'], 'day') . '</td>';
|
||||
|
||||
// Payment date
|
||||
if ($conf->global->TAX_MODE_BUY_PRODUCT == 'payment' || $conf->global->TAX_MODE_BUY_SERVICE == 'payment') print '<td align="left">' . dol_print_date($fields['datep'], 'day') . '</td>';
|
||||
else print '<td></td>';
|
||||
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid'])
|
||||
@ -567,12 +588,17 @@ else
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
if (dol_string_nohtmltag($fields['descr'])) {
|
||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($type) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
if ($type) {
|
||||
$text = img_object($langs->trans('Service'),'service');
|
||||
} else {
|
||||
$text = img_object($langs->trans('Product'),'product');
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
@ -581,7 +607,7 @@ else
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0)
|
||||
if ($modetax != 1)
|
||||
{
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
@ -596,83 +622,84 @@ else
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0)
|
||||
if ($modetax != 1)
|
||||
{
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) $ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
print '<td class="nowrap" align="right">';
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc'])
|
||||
{
|
||||
$paymentfourn_static->id=$fields['payment_id'];
|
||||
print $paymentfourn_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0)
|
||||
|
||||
if (($type == 0 && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')
|
||||
|| ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice'))
|
||||
{
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
else
|
||||
{
|
||||
print price($fields['payment_amount']);
|
||||
if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
|
||||
$ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print price(price2num($fields['payment_amount'],'MT'));
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// VAT paid
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) $temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_ht,'MT'),1);
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat=$fields['vat'];
|
||||
if ($type == 1) $temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
$temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
print price(price2num($temp_vat,'MT'),1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_paye_total_ht += $temp_ht;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_paye_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_paye_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_paye_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_paye_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_paye) == 0) // Show a total line if nothing shown
|
||||
{
|
||||
print '<tr class="liste_total">';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0)
|
||||
{
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
if (count($x_paye) == 0) { // Show a total line if nothing shown
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="4"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax != 1) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$diff = $x_coll_sum - $x_paye_sum;
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$diff = $x_coll_sum - $x_paye_sum;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="'.$span.'">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
|
||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||
@ -680,7 +707,7 @@ else
|
||||
|
||||
$i++;
|
||||
}
|
||||
echo '</table>';
|
||||
print '</table>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -1,713 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006-2007, 2015 Yannick Warnier <ywarnier@beeznest.org>
|
||||
* Copyright (C) 2014 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/tva/quadri_detail.php
|
||||
* \ingroup tax
|
||||
* \brief Trimestrial page - detailed version
|
||||
* TODO Deal with recurrent invoices as well
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("compta");
|
||||
$langs->load("companies");
|
||||
$langs->load("products");
|
||||
$langs->load("other");
|
||||
|
||||
// Date range
|
||||
$year=GETPOST('year', 'int');
|
||||
if (empty($year)) {
|
||||
$year_current = strftime("%Y",dol_now());
|
||||
$year_start = $year_current;
|
||||
} else {
|
||||
$year_current = $year;
|
||||
$year_start = $year;
|
||||
}
|
||||
$date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]);
|
||||
$date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]);
|
||||
// Quarter
|
||||
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
|
||||
$q=GETPOST('q', 'int');
|
||||
if (empty($q)) {
|
||||
if (isset($_REQUEST["month"])) {
|
||||
$date_start=dol_get_first_day($year_start,$_REQUEST["month"],false);
|
||||
$date_end=dol_get_last_day($year_start,$_REQUEST["month"],false);
|
||||
} else {
|
||||
$month_current = strftime("%m",dol_now());
|
||||
if ($month_current >= 10) $q=4;
|
||||
elseif ($month_current >= 7) $q=3;
|
||||
elseif ($month_current >= 4) $q=2;
|
||||
else $q=1;
|
||||
}
|
||||
}
|
||||
if ($q==1) {
|
||||
$date_start=dol_get_first_day($year_start,1,false);
|
||||
$date_end=dol_get_last_day($year_start,3,false);
|
||||
}
|
||||
if ($q==2) {
|
||||
$date_start=dol_get_first_day($year_start,4,false);
|
||||
$date_end=dol_get_last_day($year_start,6,false);
|
||||
}
|
||||
if ($q==3) {
|
||||
$date_start=dol_get_first_day($year_start,7,false);
|
||||
$date_end=dol_get_last_day($year_start,9,false);
|
||||
}
|
||||
if ($q==4) {
|
||||
$date_start=dol_get_first_day($year_start,10,false);
|
||||
$date_end=dol_get_last_day($year_start,12,false);
|
||||
}
|
||||
}
|
||||
|
||||
$min = GETPOST("min");
|
||||
if (empty($min)) {
|
||||
$min = 0;
|
||||
}
|
||||
|
||||
// Define modetax (0 or 1)
|
||||
// 0=normal, 1=option vat for services is on debit
|
||||
$modetax = $conf->global->TAX_MODE;
|
||||
if (isset($_REQUEST["modetax"])) {
|
||||
$modetax=$_REQUEST["modetax"];
|
||||
}
|
||||
if (empty($modetax)) {
|
||||
$modetax=0;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
if ($user->societe_id) {
|
||||
$socid=$user->societe_id;
|
||||
}
|
||||
$result = restrictedArea($user, 'tax', '', '', 'charges');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$morequerystring='';
|
||||
$listofparams=array('date_startmonth','date_startyear','date_startday','date_endmonth','date_endyear','date_endday');
|
||||
foreach ($listofparams as $param) {
|
||||
if (GETPOST($param)!='') {
|
||||
$morequerystring.=($morequerystring?'&':'').$param.'='.GETPOST($param);
|
||||
}
|
||||
}
|
||||
|
||||
llxHeader('','','','',0,0,'','',$morequerystring);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$company_static=new Societe($db);
|
||||
$invoice_customer=new Facture($db);
|
||||
$invoice_supplier=new FactureFournisseur($db);
|
||||
$product_static=new Product($db);
|
||||
$payment_static=new Paiement($db);
|
||||
$paymentfourn_static=new PaiementFourn($db);
|
||||
|
||||
//print load_fiche_titre($langs->trans("VAT"),"");
|
||||
|
||||
//$fsearch.='<br>';
|
||||
$fsearch.=' <input type="hidden" name="year" value="'.$year.'">';
|
||||
$fsearch.=' <input type="hidden" name="modetax" value="'.$modetax.'">';
|
||||
//$fsearch.=' '.$langs->trans("SalesTurnoverMinimum").': ';
|
||||
//$fsearch.=' <input type="text" name="min" value="'.$min.'">';
|
||||
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modetax==1) { // Calculate on invoice for goods and services
|
||||
$name=$langs->trans("VATReportByQuartersInDueDebtMode");
|
||||
$calcmode=$langs->trans("CalcModeVATDebt");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$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);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) {
|
||||
$prevquarter--;
|
||||
} else {
|
||||
$prevquarter=4; $prevyear--;
|
||||
}
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) {
|
||||
$nextquarter++;
|
||||
} else {
|
||||
$nextquarter=1; $nextyear++;
|
||||
}
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATDueServices");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATDueProducts");
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.='<br>'.$langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description.='<br>'.$langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$namecust=$langs->trans("Name");
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
}
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$langs->trans("ProductOrService");
|
||||
$amountsup=$langs->trans("AmountHT");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
$namesup=$namecust;
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
}
|
||||
if ($modetax==0) { // Invoice for goods, payment for services
|
||||
$name=$langs->trans("VATReportByQuartersInInputOutputMode");
|
||||
$calcmode=$langs->trans("CalcModeVATEngagement");
|
||||
$calcmode.='<br>('.$langs->trans("TaxModuleSetupToModifyRules",DOL_URL_ROOT.'/admin/taxes.php').')';
|
||||
$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);
|
||||
$prevyear=$year_start; $prevquarter=$q;
|
||||
if ($prevquarter > 1) {
|
||||
$prevquarter--;
|
||||
} else {
|
||||
$prevquarter=4; $prevyear--;
|
||||
}
|
||||
$nextyear=$year_start; $nextquarter=$q;
|
||||
if ($nextquarter < 4) {
|
||||
$nextquarter++;
|
||||
} else {
|
||||
$nextquarter=1; $nextyear++;
|
||||
}
|
||||
//$periodlink=($prevyear?"<a href='".$_SERVER["PHP_SELF"]."?year=".$prevyear."&q=".$prevquarter."&modetax=".$modetax."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".$nextyear."&q=".$nextquarter."&modetax=".$modetax."'>".img_next()."</a>":"");
|
||||
$description=$langs->trans("RulesVATInServices");
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
$description.='<br>';
|
||||
$description.=$langs->trans("RulesVATInProducts");
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description.=' '.$langs->trans("DepositsAreNotIncluded");
|
||||
} else {
|
||||
$description.=' '.$langs->trans("DepositsAreIncluded");
|
||||
}
|
||||
//if ($conf->global->MAIN_MODULE_COMPTABILITE || $conf->global->MAIN_MODULE_ACCOUNTING) $description.='<br>'.img_warning().' '.$langs->trans('OptionVatInfoModuleComptabilite');
|
||||
//if (! empty($conf->global->MAIN_MODULE_COMPTABILITE)) $description.='<br>'.$langs->trans("WarningDepositsNotIncluded");
|
||||
$description.=$fsearch;
|
||||
$builddate=dol_now();
|
||||
//$exportlink=$langs->trans("NotYetAvailable");
|
||||
|
||||
$elementcust=$langs->trans("CustomersInvoices");
|
||||
$productcust=$langs->trans("ProductOrService");
|
||||
$amountcust=$langs->trans("AmountHT");
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$namecust=$langs->trans("Name");
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatcust.=' ('.$langs->trans("ToPay").')';
|
||||
}
|
||||
$elementsup=$langs->trans("SuppliersInvoices");
|
||||
$productsup=$productcust;
|
||||
$amountsup=$amountcust;
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
$namesup=$namecust;
|
||||
if ($mysoc->tva_assuj) {
|
||||
$vatsup.=' ('.$langs->trans("ToGetBack").')';
|
||||
}
|
||||
}
|
||||
report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink,array(),$calcmode);
|
||||
|
||||
$vatcust=$langs->trans("VATReceived");
|
||||
$vatsup=$langs->trans("VATPaid");
|
||||
|
||||
|
||||
// VAT Received and paid
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$y = $year_current;
|
||||
$total = 0;
|
||||
$i=0;
|
||||
$columns = 6;
|
||||
|
||||
// Load arrays of datas
|
||||
$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell');
|
||||
$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy');
|
||||
|
||||
if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
$langs->load("errors");
|
||||
if ($x_coll == -1) {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
|
||||
} else if ($x_coll == -2) {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
|
||||
} else {
|
||||
print '<tr><td colspan="' . $columns . '">' . $langs->trans("Error") . '</td></tr>';
|
||||
}
|
||||
} else {
|
||||
$x_both = array();
|
||||
//now, from these two arrays, get another array with one rate per line
|
||||
foreach(array_keys($x_coll) as $my_coll_rate) {
|
||||
$x_both[$my_coll_rate]['coll']['totalht'] = $x_coll[$my_coll_rate]['totalht'];
|
||||
$x_both[$my_coll_rate]['coll']['vat'] = $x_coll[$my_coll_rate]['vat'];
|
||||
$x_both[$my_coll_rate]['paye']['totalht'] = 0;
|
||||
$x_both[$my_coll_rate]['paye']['vat'] = 0;
|
||||
$x_both[$my_coll_rate]['coll']['links'] = '';
|
||||
$x_both[$my_coll_rate]['coll']['detail'] = array();
|
||||
foreach($x_coll[$my_coll_rate]['facid'] as $id=>$dummy) {
|
||||
$invoice_customer->id=$x_coll[$my_coll_rate]['facid'][$id];
|
||||
$invoice_customer->ref=$x_coll[$my_coll_rate]['facnum'][$id];
|
||||
$invoice_customer->type=$x_coll[$my_coll_rate]['type'][$id];
|
||||
$company_static->fetch($x_coll[$my_coll_rate]['company_id'][$id]);
|
||||
$x_both[$my_coll_rate]['coll']['detail'][] = array(
|
||||
'id' =>$x_coll[$my_coll_rate]['facid'][$id],
|
||||
'descr' =>$x_coll[$my_coll_rate]['descr'][$id],
|
||||
'pid' =>$x_coll[$my_coll_rate]['pid'][$id],
|
||||
'pref' =>$x_coll[$my_coll_rate]['pref'][$id],
|
||||
'ptype' =>$x_coll[$my_coll_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_coll[$my_coll_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_coll[$my_coll_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>$x_coll[$my_coll_rate]['ftotal_ttc'][$id],
|
||||
'dtotal_ttc'=>$x_coll[$my_coll_rate]['dtotal_ttc'][$id],
|
||||
'dtype' =>$x_coll[$my_coll_rate]['dtype'][$id],
|
||||
'datef' =>$x_coll[$my_coll_rate]['datef'][$id],
|
||||
'company_link'=>$company_static->getNomUrl(1,'',20),
|
||||
'ddate_start'=>$x_coll[$my_coll_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_coll[$my_coll_rate]['ddate_end'][$id],
|
||||
'totalht' =>$x_coll[$my_coll_rate]['totalht_list'][$id],
|
||||
'vat' =>$x_coll[$my_coll_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_customer->getNomUrl(1,'',12)
|
||||
);
|
||||
}
|
||||
}
|
||||
// tva paid
|
||||
foreach (array_keys($x_paye) as $my_paye_rate) {
|
||||
$x_both[$my_paye_rate]['paye']['totalht'] = $x_paye[$my_paye_rate]['totalht'];
|
||||
$x_both[$my_paye_rate]['paye']['vat'] = $x_paye[$my_paye_rate]['vat'];
|
||||
if (!isset($x_both[$my_paye_rate]['coll']['totalht'])) {
|
||||
$x_both[$my_paye_rate]['coll']['totalht'] = 0;
|
||||
$x_both[$my_paye_rate]['coll']['vat'] = 0;
|
||||
}
|
||||
$x_both[$my_paye_rate]['paye']['links'] = '';
|
||||
$x_both[$my_paye_rate]['paye']['detail'] = array();
|
||||
|
||||
foreach ($x_paye[$my_paye_rate]['facid'] as $id=>$dummy) {
|
||||
$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id];
|
||||
$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id];
|
||||
$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id];
|
||||
$company_static->fetch($x_paye[$my_paye_rate]['company_id'][$id]);
|
||||
$x_both[$my_paye_rate]['paye']['detail'][] = array(
|
||||
'id' =>$x_paye[$my_paye_rate]['facid'][$id],
|
||||
'descr' =>$x_paye[$my_paye_rate]['descr'][$id],
|
||||
'pid' =>$x_paye[$my_paye_rate]['pid'][$id],
|
||||
'pref' =>$x_paye[$my_paye_rate]['pref'][$id],
|
||||
'ptype' =>$x_paye[$my_paye_rate]['ptype'][$id],
|
||||
'payment_id'=>$x_paye[$my_paye_rate]['payment_id'][$id],
|
||||
'payment_amount'=>$x_paye[$my_paye_rate]['payment_amount'][$id],
|
||||
'ftotal_ttc'=>price2num($x_paye[$my_paye_rate]['ftotal_ttc'][$id]),
|
||||
'dtotal_ttc'=>price2num($x_paye[$my_paye_rate]['dtotal_ttc'][$id]),
|
||||
'dtype' =>$x_paye[$my_paye_rate]['dtype'][$id],
|
||||
'datef' =>$x_paye[$my_paye_rate]['datef'][$id],
|
||||
'company_link'=>$company_static->getNomUrl(1,'',20),
|
||||
'ddate_start'=>$x_paye[$my_paye_rate]['ddate_start'][$id],
|
||||
'ddate_end' =>$x_paye[$my_paye_rate]['ddate_end'][$id],
|
||||
'totalht' =>price2num($x_paye[$my_paye_rate]['totalht_list'][$id]),
|
||||
'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id],
|
||||
'link' =>$invoice_supplier->getNomUrl(1,'',12)
|
||||
);
|
||||
}
|
||||
}
|
||||
//now we have an array (x_both) indexed by rates for coll and paye
|
||||
|
||||
|
||||
//print table headers for this quadri - incomes first
|
||||
|
||||
$x_coll_sum = 0;
|
||||
$x_coll_ht = 0;
|
||||
$x_paye_sum = 0;
|
||||
$x_paye_ht = 0;
|
||||
|
||||
$span=$columns-3;
|
||||
if ($modetax == 0) $span+=2;
|
||||
|
||||
//print '<tr><td colspan="'.($span+1).'">'..')</td></tr>';
|
||||
|
||||
// Customers invoices
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementcust.'</td>';
|
||||
print '<td align="left">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="left">'.$namecust.'</td>';
|
||||
print '<td align="left">'.$productcust.'</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td align="right">'.$amountcust.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td align="right">'.$langs->trans("AmountHTVATRealReceived").'</td>';
|
||||
print '<td align="right">'.$vatcust.'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$action = "tvadetail";
|
||||
$parameters["mode"] = $modetax;
|
||||
$parameters["start"] = $date_start;
|
||||
$parameters["end"] = $date_end;
|
||||
$parameters["type"] = 'vat';
|
||||
|
||||
$object = array(&$x_coll, &$x_paye, &$x_both);
|
||||
// Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach (array_keys($x_coll) as $rate) {
|
||||
$subtot_coll_total_ht = 0;
|
||||
$subtot_coll_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['coll']['detail'])) {
|
||||
// VAT Rate
|
||||
$var=true;
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach ($x_both[$rate]['coll']['detail'] as $index => $fields) {
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (!empty($fields['ddate_start'])) {
|
||||
$type=1;
|
||||
}
|
||||
if (!empty($fields['ddate_end'])) {
|
||||
$type=1;
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
|
||||
// Invoice date
|
||||
print '<td align="left">' . $fields['datef'] . '</td>';
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid']) {
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) {
|
||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
} else {
|
||||
if ($type) {
|
||||
$text = img_object($langs->trans('Service'),'service');
|
||||
} else {
|
||||
$text = img_object($langs->trans('Product'),'product');
|
||||
}
|
||||
if (preg_match('/^\((.*)\)$/',$fields['descr'],$reg)) {
|
||||
if ($reg[1]=='DEPOSIT') {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv('Deposit');
|
||||
} elseif ($reg[1]=='CREDIT_NOTE') {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv('CreditNote');
|
||||
} else {
|
||||
$fields['descr']=$langs->transnoentitiesnoconv($reg[1]);
|
||||
}
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc'])) {
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0) {
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
|
||||
$ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print '<td class="nowrap" align="right">';
|
||||
//print $fields['totalht']."-".$fields['payment_amount']."-".$fields['ftotal_ttc'];
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
|
||||
$payment_static->id=$fields['payment_id'];
|
||||
print $payment_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0) {
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
} else {
|
||||
print $fields['payment_amount'];
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Total collected
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) {
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
}
|
||||
print price(price2num($temp_ht,'MT'),1);
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat=$fields['vat'];
|
||||
if ($type == 1) {
|
||||
$temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
}
|
||||
print price(price2num($temp_vat,'MT'),1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_coll_total_ht += $temp_ht;
|
||||
$subtot_coll_vat += $temp_vat;
|
||||
$x_coll_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
// Total customers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$span.'"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_coll_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_coll_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_coll) == 0) { // Show a total ine if nothing shown
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$span.'"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Blank line
|
||||
print '<tr><td colspan="'.($span+1).'"> </td></tr>';
|
||||
|
||||
// Print table headers for this quadri - expenses now
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td align="left">'.$elementsup.'</td>';
|
||||
print '<td align="left">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="left">'.$namesup.'</td>';
|
||||
print '<td align="left">'.$productsup.'</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td align="right">'.$amountsup.'</td>';
|
||||
print '<td align="right">'.$langs->trans("Payment").' ('.$langs->trans("PercentOfInvoice").')</td>';
|
||||
}
|
||||
print '<td align="right">'.$langs->trans("AmountHTVATRealPaid").'</td>';
|
||||
print '<td align="right">'.$vatsup.'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach (array_keys($x_paye) as $rate) {
|
||||
$subtot_paye_total_ht = 0;
|
||||
$subtot_paye_vat = 0;
|
||||
|
||||
if (is_array($x_both[$rate]['paye']['detail'])) {
|
||||
$var=true;
|
||||
print "<tr>";
|
||||
print '<td class="tax_rate">'.$langs->trans("Rate").': '.vatrate($rate).'%</td><td colspan="'.$span.'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
foreach ($x_both[$rate]['paye']['detail'] as $index=>$fields) {
|
||||
// Define type
|
||||
$type=($fields['dtype']?$fields['dtype']:$fields['ptype']);
|
||||
// Try to enhance type detection using date_start and date_end for free lines where type
|
||||
// was not saved.
|
||||
if (!empty($fields['ddate_start'])) {
|
||||
$type=1;
|
||||
}
|
||||
if (!empty($fields['ddate_end'])) {
|
||||
$type=1;
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref
|
||||
print '<td class="nowrap" align="left">'.$fields['link'].'</td>';
|
||||
// Invoice date
|
||||
print '<td align="left">' . $fields['datef'] . '</td>';
|
||||
// Company name
|
||||
print '<td align="left">' . $fields['company_link'] . '</td>';
|
||||
|
||||
// Description
|
||||
print '<td align="left">';
|
||||
if ($fields['pid']) {
|
||||
$product_static->id=$fields['pid'];
|
||||
$product_static->ref=$fields['pref'];
|
||||
$product_static->type=$fields['ptype'];
|
||||
print $product_static->getNomUrl(1);
|
||||
if (dol_string_nohtmltag($fields['descr'])) {
|
||||
print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
}
|
||||
} else {
|
||||
if ($type) {
|
||||
$text = img_object($langs->trans('Service'),'service');
|
||||
} else {
|
||||
$text = img_object($langs->trans('Product'),'product');
|
||||
}
|
||||
print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']),16);
|
||||
|
||||
// Show range
|
||||
print_date_range($fields['ddate_start'],$fields['ddate_end']);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Total HT
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right">';
|
||||
print price($fields['totalht']);
|
||||
if (price2num($fields['ftotal_ttc'])) {
|
||||
//print $fields['dtotal_ttc']."/".$fields['ftotal_ttc']." - ";
|
||||
$ratiolineinvoice=($fields['dtotal_ttc']/$fields['ftotal_ttc']);
|
||||
//print ' ('.round($ratiolineinvoice*100,2).'%)';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Payment
|
||||
$ratiopaymentinvoice=1;
|
||||
if ($modetax == 0) {
|
||||
if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) {
|
||||
$ratiopaymentinvoice=($fields['payment_amount']/$fields['ftotal_ttc']);
|
||||
}
|
||||
print '<td class="nowrap" align="right">';
|
||||
if ($fields['payment_amount'] && $fields['ftotal_ttc']) {
|
||||
$paymentfourn_static->id=$fields['payment_id'];
|
||||
print $paymentfourn_static->getNomUrl(2);
|
||||
}
|
||||
if ($type == 0) {
|
||||
print $langs->trans("NotUsedForGoods");
|
||||
} else {
|
||||
print $fields['payment_amount'];
|
||||
if (isset($fields['payment_amount'])) {
|
||||
print ' ('.round($ratiopaymentinvoice*100,2).'%)';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// VAT paid
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_ht=$fields['totalht'];
|
||||
if ($type == 1) {
|
||||
$temp_ht=$fields['totalht']*$ratiopaymentinvoice;
|
||||
}
|
||||
print price(price2num($temp_ht,'MT'),1);
|
||||
print '</td>';
|
||||
|
||||
// VAT
|
||||
print '<td class="nowrap" align="right">';
|
||||
$temp_vat=$fields['vat'];
|
||||
if ($type == 1) {
|
||||
$temp_vat=$fields['vat']*$ratiopaymentinvoice;
|
||||
}
|
||||
print price(price2num($temp_vat,'MT'),1);
|
||||
//print price($fields['vat']);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$subtot_paye_total_ht += $temp_ht;
|
||||
$subtot_paye_vat += $temp_vat;
|
||||
$x_paye_sum += $temp_vat;
|
||||
}
|
||||
}
|
||||
// Total suppliers for this vat rate
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$span.'"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num($subtot_paye_total_ht,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num($subtot_paye_vat,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if (count($x_paye) == 0) { // Show a total line if nothing shown
|
||||
print '<tr class="liste_total">';
|
||||
print '<td colspan="'.$span.'"></td>';
|
||||
print '<td align="right">'.$langs->trans("Total").':</td>';
|
||||
if ($modetax == 0) {
|
||||
print '<td class="nowrap" align="right"> </td>';
|
||||
print '<td align="right"> </td>';
|
||||
}
|
||||
print '<td align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '<td class="nowrap" align="right">'.price(price2num(0,'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Total to pay
|
||||
print '<br><br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
$diff = $x_coll_sum - $x_paye_sum;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total" colspan="'.$span.'">'.$langs->trans("TotalToPay").($q?', '.$langs->trans("Quadri").' '.$q:'').'</td>';
|
||||
print '<td class="liste_total nowrap" align="right"><b>'.price(price2num($diff,'MT'))."</b></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -101,7 +101,7 @@ if (! $sortfield) $sortfield='a.datep, a.id';
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('contactcard','globalcard'));
|
||||
$hookmanager->initHooks(array('contactagenda','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -121,7 +121,8 @@ else if ($type == "o")
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new Contact($db);
|
||||
$hookmanager->initHooks(array('contactlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -264,6 +264,7 @@ class Contrat extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see closeAll
|
||||
*/
|
||||
function activateAll($user, $date_start='', $notrigger=0, $comment='')
|
||||
{
|
||||
@ -279,7 +280,7 @@ class Contrat extends CommonObject
|
||||
foreach($this->lines as $contratline)
|
||||
{
|
||||
// Open lines not already open
|
||||
if ($contratline->statut != 4)
|
||||
if ($contratline->statut != ContratLigne::STATUS_OPEN)
|
||||
{
|
||||
$contratline->context = $this->context;
|
||||
|
||||
@ -319,6 +320,7 @@ class Contrat extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @param string $comment Comment
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @see activateAll
|
||||
*/
|
||||
function closeAll(User $user, $notrigger=0, $comment='')
|
||||
{
|
||||
@ -334,11 +336,11 @@ class Contrat extends CommonObject
|
||||
foreach($this->lines as $contratline)
|
||||
{
|
||||
// Close lines not already closed
|
||||
if ($contratline->statut != 5)
|
||||
if ($contratline->statut != ContratLigne::STATUS_CLOSED)
|
||||
{
|
||||
$contratline->date_cloture=$now;
|
||||
$contratline->fk_user_cloture=$user->id;
|
||||
$contratline->statut='5';
|
||||
$contratline->statut=ContratLigne::STATUS_CLOSED;
|
||||
$result=$contratline->close_line($user, $now, $comment, $notrigger);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -675,7 +677,8 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load lines array into this->lines
|
||||
* Load lines array into this->lines.
|
||||
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
|
||||
*
|
||||
* @return ContratLigne[] Return array of contract lines
|
||||
*/
|
||||
@ -805,10 +808,10 @@ class Contrat extends CommonObject
|
||||
//dol_syslog("1 ".$line->desc);
|
||||
//dol_syslog("2 ".$line->product_desc);
|
||||
|
||||
if ($line->statut == 0) $this->nbofserviceswait++;
|
||||
if ($line->statut == 4 && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
||||
if ($line->statut == ContratLigne::STATUS_INITIAL) $this->nbofserviceswait++;
|
||||
if ($line->statut == ContratLigne::STATUS_OPEN && (empty($line->date_fin_prevue) || $line->date_fin_prevue >= $now)) $this->nbofservicesopened++;
|
||||
if ($line->statut == ContratLigne::STATUS_OPEN && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
||||
if ($line->statut == ContratLigne::STATUS_CLOSED) $this->nbofservicesclosed++;
|
||||
|
||||
$total_ttc+=$objp->total_ttc; // TODO Not saved into database
|
||||
$total_vat+=$objp->total_tva;
|
||||
@ -2517,6 +2520,11 @@ class ContratLigne extends CommonObjectLine
|
||||
var $fk_user_cloture;
|
||||
var $commentaire;
|
||||
|
||||
const STATUS_INITIAL = 0;
|
||||
const STATUS_OPEN = 4;
|
||||
const STATUS_CLOSED = 5;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -2555,51 +2563,51 @@ class ContratLigne extends CommonObjectLine
|
||||
$langs->load("contracts");
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); }
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed"); }
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); }
|
||||
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); }
|
||||
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); }
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == 0) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == 4 && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == 4 && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == 4 && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == 5) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); }
|
||||
if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); }
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($statut == 0) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
||||
if ($statut == 4 && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); }
|
||||
if ($statut == 4 && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == 5) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
||||
if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); }
|
||||
if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); }
|
||||
if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); }
|
||||
}
|
||||
}
|
||||
|
||||
@ -3095,13 +3103,13 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 4,";
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = ".ContratLigne::STATUS_OPEN.",";
|
||||
$sql .= " date_ouverture = " . (dol_strlen($date) != 0 ? "'" . $this->db->idate($date) . "'" : "null") . ",";
|
||||
if ($date_end >= 0) $sql .= " date_fin_validite = " . (dol_strlen($date_end) != 0 ? "'" . $this->db->idate($date_end) . "'" : "null") . ",";
|
||||
$sql .= " fk_user_ouverture = " . $user->id . ",";
|
||||
$sql .= " date_cloture = null,";
|
||||
$sql .= " commentaire = '" . $this->db->escape($comment) . "'";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND (statut = 0 OR statut = 3 OR statut = 5)";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND (statut = ".ContratLigne::STATUS_INITIAL." OR statut = ".ContratLigne::STATUS_CLOSED.")";
|
||||
|
||||
dol_syslog(get_class($this) . "::active_line", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -3113,7 +3121,7 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->statut = 4;
|
||||
$this->statut = ContratLigne::STATUS_OPEN;
|
||||
$this->date_ouverture = $date;
|
||||
$this->date_fin_validite = $date_end;
|
||||
$this->fk_user_ouverture = $user->id;
|
||||
@ -3159,11 +3167,11 @@ class ContratLigne extends CommonObjectLine
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = 5,";
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "contratdet SET statut = ".ContratLigne::STATUS_CLOSED.",";
|
||||
$sql .= " date_cloture = '" . $this->db->idate($date_end) . "',";
|
||||
$sql .= " fk_user_cloture = " . $user->id . ",";
|
||||
$sql .= " commentaire = '" . $this->db->escape($comment) . "'";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND statut = 4";
|
||||
$sql .= " WHERE rowid = " . $this->id . " AND statut = ".ContratLigne::STATUS_OPEN;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -45,6 +45,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'):'contractlist'; // To manage different context of search
|
||||
|
||||
$search_name=GETPOST('search_name');
|
||||
$search_email=GETPOST('search_email');
|
||||
@ -95,10 +96,8 @@ $staticcontratligne=new ContratLigne($db);
|
||||
if ($search_status == '') $search_status=1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='contractlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new Contrat($db);
|
||||
$hookmanager->initHooks(array('contractlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -53,6 +53,7 @@ $search_status=GETPOST("search_status","alpha");
|
||||
$statut=GETPOST('statut')?GETPOST('statut'):1;
|
||||
$search_product_category=GETPOST('search_product_category','int');
|
||||
$socid=GETPOST('socid','int');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
|
||||
|
||||
$opouvertureprevuemonth=GETPOST('opouvertureprevuemonth');
|
||||
$opouvertureprevueday=GETPOST('opouvertureprevueday');
|
||||
@ -74,11 +75,10 @@ $opclotureday=GETPOST('opclotureday');
|
||||
$opclotureyear=GETPOST('opclotureyear');
|
||||
$filter_opcloture=GETPOST('filter_opcloture');
|
||||
|
||||
// Initialize context for list
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'contractservicelist'.$mode;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new ContratLigne($db);
|
||||
$hookmanager->initHooks(array('contractservicelist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -413,7 +413,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
if ($mailfile->error)
|
||||
{
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
||||
$action='presend';
|
||||
}
|
||||
else
|
||||
|
||||
@ -753,7 +753,7 @@ class CMailFile
|
||||
$domainName = $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
$selector = $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
$signer = new Swift_Signers_DKIMSigner($privateKey, $domainName, $selector);
|
||||
$this->message->attachSigner($signer);
|
||||
$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
|
||||
@ -6551,7 +6551,7 @@ abstract class CommonObject
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function set_save_query()
|
||||
protected function setSaveQuery()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -6650,7 +6650,7 @@ abstract class CommonObject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_field_list()
|
||||
protected function getFieldList()
|
||||
{
|
||||
$keys = array_keys($this->fields);
|
||||
return implode(',', $keys);
|
||||
@ -6685,7 +6685,7 @@ abstract class CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$fieldvalues = $this->set_save_query();
|
||||
$fieldvalues = $this->setSaveQuery();
|
||||
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now);
|
||||
if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id;
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
|
||||
@ -6778,7 +6778,7 @@ abstract class CommonObject
|
||||
{
|
||||
if (empty($id) && empty($ref)) return false;
|
||||
|
||||
$sql = 'SELECT '.$this->get_field_list();
|
||||
$sql = 'SELECT '.$this->getFieldList();
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
|
||||
|
||||
if (!empty($id)) $sql.= ' WHERE rowid = '.$id;
|
||||
@ -6822,7 +6822,7 @@ abstract class CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$fieldvalues = $this->set_save_query();
|
||||
$fieldvalues = $this->setSaveQuery();
|
||||
if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification']=$this->db->idate($now);
|
||||
if (array_key_exists('fk_user_modif', $fieldvalues) && ! ($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif']=$user->id;
|
||||
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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
|
||||
@ -24,8 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class DiscountAbsolute
|
||||
* \brief Class to manage absolute discounts
|
||||
* Class to manage absolute discounts
|
||||
*/
|
||||
class DiscountAbsolute
|
||||
{
|
||||
@ -231,7 +230,7 @@ class DiscountAbsolute
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we can remove the discount
|
||||
if ($this->fk_invoice_supplier_source)
|
||||
{
|
||||
@ -241,7 +240,7 @@ class DiscountAbsolute
|
||||
$sql.=" OR fk_invoice_supplier IS NOT NULL)"; // Not used as credit note and not used as deposit
|
||||
$sql.=" AND fk_invoice_supplier_source = ".$this->fk_invoice_supplier_source;
|
||||
//$sql.=" AND rowid != ".$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -298,7 +297,7 @@ class DiscountAbsolute
|
||||
}
|
||||
}
|
||||
elseif($this->fk_invoice_supplier_source) {
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
||||
$sql.=" set paye=0, fk_statut=1";
|
||||
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_invoice_supplier_source;
|
||||
|
||||
@ -739,6 +739,21 @@ class ExtraFields
|
||||
// To avoid conflicts with external modules. TODO Remove this.
|
||||
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label;
|
||||
|
||||
// Set array of label of entity
|
||||
$labelmulticompany=array();
|
||||
if (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql_entity_name='SELECT rowid, label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid in (0,'.$conf->entity.')';
|
||||
$resql_entity_name=$this->db->query($sql_entity_name);
|
||||
if ($resql_entity_name)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($resql_entity_name))
|
||||
{
|
||||
$labelmulticompany[$obj->rowid]=$obj->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
|
||||
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
|
||||
|
||||
@ -778,6 +793,7 @@ class ExtraFields
|
||||
$this->attribute_langfile[$tab->name]=$tab->langs;
|
||||
$this->attribute_list[$tab->name]=$tab->list;
|
||||
$this->attribute_entityid[$tab->name]=$tab->entity;
|
||||
$this->attribute_entitylabel[$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]);
|
||||
|
||||
// New usage
|
||||
$this->attributes[$tab->elementtype]['type'][$tab->name]=$tab->type;
|
||||
@ -795,23 +811,7 @@ class ExtraFields
|
||||
$this->attributes[$tab->elementtype]['langfile'][$tab->name]=$tab->langs;
|
||||
$this->attributes[$tab->elementtype]['list'][$tab->name]=$tab->list;
|
||||
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
||||
|
||||
if (!empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql_entity_name='SELECT label FROM '.MAIN_DB_PREFIX.'entity WHERE rowid='.$tab->entity;
|
||||
$resql_entity_name=$this->db->query($sql_entity_name);
|
||||
if ($resql_entity_name)
|
||||
{
|
||||
if ($this->db->num_rows($resql_entity_name))
|
||||
{
|
||||
if ($obj = $this->db->fetch_object($resql_entity_name))
|
||||
{
|
||||
$this->attribute_entitylabel[$tab->name]=$obj->label; // Old usage
|
||||
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=$obj->label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]);
|
||||
|
||||
$this->attributes[$tab->elementtype]['loaded']=1;
|
||||
}
|
||||
@ -1743,7 +1743,7 @@ class ExtraFields
|
||||
*/
|
||||
function showSeparator($key)
|
||||
{
|
||||
$out = '<tr class="trextrafieldseparator"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
|
||||
$out = '<tr class="trextrafieldseparator trextrafieldseparator'.$key.'"><td colspan="4"><strong>'.$this->attribute_label[$key].'</strong></td></tr>';
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ class Form
|
||||
$ret.='<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$ret.='<input type="hidden" name="'.$paramid.'" value="'.$object->id.'">';
|
||||
if (empty($notabletag)) $ret.='<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret.='<table class="nobordernopadding centpercent" cellpadding="0" cellspacing="0">';
|
||||
if (empty($notabletag)) $ret.='<tr><td>';
|
||||
if (preg_match('/^(string|email)/',$typeofdata))
|
||||
{
|
||||
@ -1072,11 +1072,11 @@ class Form
|
||||
// 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";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('societe').")";
|
||||
if (! empty($user->societe_id)) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
if (! empty($user->socid)) $sql.= " AND s.rowid = ".$user->socid;
|
||||
if ($filter) $sql.= " AND (".$filter.")";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if (! empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) $sql.= " AND s.status <> 0";
|
||||
// Add criteria
|
||||
if ($filterkey && $filterkey != '')
|
||||
@ -3596,8 +3596,8 @@ class Form
|
||||
* @param string $question Question
|
||||
* @param string $action Action
|
||||
* @param array $formquestion An array with complementary inputs to add into forms: array(array('label'=> ,'type'=> , ))
|
||||
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', ...
|
||||
* @param string $selectedchoice '' or 'no' or 'yes' or '1' or '0'
|
||||
* type can be 'hidden', 'text', 'password', 'checkbox', 'radio', 'date', 'morecss', ...
|
||||
* @param string $selectedchoice '' or 'no', or 'yes' or '1' or '0'
|
||||
* @param int $useajax 0=No, 1=Yes, 2=Yes but submit page with &confirm=no if choice is No, 'xxx'=Yes and preoutput confirm box with div id=dialog-confirm-xxx
|
||||
* @param int $height Force height of box
|
||||
* @param int $width Force width of box ('999' or '90%'). Ignored and forced to 90% on smartphones.
|
||||
@ -6444,6 +6444,11 @@ class Form
|
||||
else $morehtmlstatus=$hookmanager->resPrint;
|
||||
if ($morehtmlstatus) $ret.='<div class="statusref">'.$morehtmlstatus.'</div>';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $morehtmlref.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $morehtmlref=$hookmanager->resPrint;
|
||||
|
||||
// Left part of banner
|
||||
if ($morehtmlleft)
|
||||
{
|
||||
|
||||
@ -243,7 +243,7 @@ class FormAccounting extends Form
|
||||
*
|
||||
* @param string $selectid Preselected id or code of accounting accounts (depends on $select_in)
|
||||
* @param string $htmlname Name of HTML field id. If name start with '.', it is name of HTML css class, so several component with same name in different forms can be used.
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $showempty 1=Add an empty field, 2=Add an empty field+'None' field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number
|
||||
* @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number
|
||||
@ -253,7 +253,7 @@ class FormAccounting extends Form
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
@ -318,7 +318,12 @@ class FormAccounting extends Form
|
||||
}
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
if ($showempty == 2)
|
||||
{
|
||||
$options['0'] = $langs->trans("None");
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, ($showempty > 0 ? 1 : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -122,13 +122,13 @@ class FormBarCode
|
||||
|
||||
if ($useempty && $num > 0)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
print '<select class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
print '<option value="0"> </option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<select disabled class="flat" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
print '<select disabled class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
||||
print '<option value="0" selected>'.$langs->trans('ErrorNoActivatedBarcode').'</option>';
|
||||
}
|
||||
|
||||
|
||||
209
htdocs/core/get_info.php
Normal file
209
htdocs/core/get_info.php
Normal file
@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This file is a modified version of datepicker.php from phpBSM to fix some
|
||||
* bugs, to add new features and to dramatically increase speed.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/get_info.php
|
||||
* \brief File to return a single page with just logged user info, to be used by other frontend
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
|
||||
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
|
||||
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
|
||||
|
||||
require_once '../main.inc.php';
|
||||
|
||||
if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
|
||||
|
||||
$langs->load("main");
|
||||
|
||||
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
|
||||
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$title=$langs->trans("Info");
|
||||
|
||||
// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
|
||||
$head='<!-- Quick access -->'."\n";
|
||||
$arrayofjs=array();
|
||||
$arrayofcss=array();
|
||||
top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
|
||||
|
||||
print '<body>'."\n";
|
||||
print '<div style="padding: 20px;">';
|
||||
//print '<br>';
|
||||
|
||||
$nbofsearch=0;
|
||||
|
||||
// Define link to login card
|
||||
$appli=constant('DOL_APPLICATION_TITLE');
|
||||
if (! empty($conf->global->MAIN_APPLICATION_TITLE))
|
||||
{
|
||||
$appli=$conf->global->MAIN_APPLICATION_TITLE;
|
||||
if (preg_match('/\d\.\d/', $appli))
|
||||
{
|
||||
if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
}
|
||||
else $appli.=" ".DOL_VERSION;
|
||||
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
|
||||
|
||||
$logouttext='';
|
||||
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
//$logouthtmltext=$appli.'<br>';
|
||||
if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http')
|
||||
{
|
||||
$logouthtmltext.=$langs->trans("Logout").'<br>';
|
||||
|
||||
$logouttext .='<a href="'.DOL_URL_ROOT.'/user/logout.php">';
|
||||
//$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
||||
$logouttext .='<span class="fa fa-sign-out atoplogin"></span>';
|
||||
$logouttext .='</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$logouthtmltext.=$langs->trans("NoLogoutProcessWithAuthMode",$_SESSION["dol_authmode"]);
|
||||
$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
print '<div class="login_block_getinfo">'."\n";
|
||||
|
||||
// Add login user link
|
||||
$toprightmenu.='<div class="login_block_user">';
|
||||
|
||||
// Login name with photo and tooltip
|
||||
$mode=-1;
|
||||
$toprightmenu.='<div class="inline-block nowrap"><div class="inline-block login_block_elem login_block_elem_name" style="padding: 0px;">';
|
||||
$toprightmenu.=$user->getNomUrl($mode, '', -1, 0, 11, 0, ($user->firstname ? 'firstname' : -1),'atoplogin');
|
||||
$toprightmenu.='</div></div>';
|
||||
|
||||
$toprightmenu.='</div>'."\n";
|
||||
|
||||
$toprightmenu.='<div class="login_block_other">';
|
||||
|
||||
// Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
|
||||
$parameters=array();
|
||||
$result=$hookmanager->executeHooks('printTopRightMenu',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if (is_numeric($result))
|
||||
{
|
||||
if (empty($result)) $toprightmenu.=$hookmanager->resPrint; // add
|
||||
else $toprightmenu=$hookmanager->resPrint; // replace
|
||||
}
|
||||
else $toprightmenu.=$result; // For backward compatibility
|
||||
|
||||
// Link to module builder
|
||||
if (! empty($conf->modulebuilder->enabled))
|
||||
{
|
||||
$text ='<a href="'.DOL_URL_ROOT.'/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
|
||||
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
|
||||
$text.='<span class="fa fa-bug atoplogin"></span>';
|
||||
$text.='</a>';
|
||||
$toprightmenu.=@Form::textwithtooltip('',$langs->trans("ModuleBuilder"),2,1,$text,'login_block_elem',2);
|
||||
}
|
||||
|
||||
// Link to print main content area
|
||||
/*
|
||||
if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && empty($conf->browser->phone))
|
||||
{
|
||||
$qs=dol_escape_htmltag($_SERVER["QUERY_STRING"]);
|
||||
|
||||
if (is_array($_POST))
|
||||
{
|
||||
foreach($_POST as $key=>$value) {
|
||||
if ($key!=='action' && $key!=='password' && !is_array($value)) $qs.='&'.$key.'='.urlencode($value);
|
||||
}
|
||||
}
|
||||
$qs.=(($qs && $morequerystring)?'&':'').$morequerystring;
|
||||
$text ='<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs?'&':'').'optioncss=print" target="_blank">';
|
||||
//$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
|
||||
$text.='<span class="fa fa-print atoplogin"></span>';
|
||||
$text.='</a>';
|
||||
$toprightmenu.=@Form::textwithtooltip('',$langs->trans("PrintContentArea"),2,1,$text,'login_block_elem',2);
|
||||
}
|
||||
*/
|
||||
|
||||
// Link to Dolibarr wiki pages
|
||||
/*
|
||||
if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$langs->load("help");
|
||||
|
||||
$helpbaseurl='';
|
||||
$helppage='';
|
||||
$mode='';
|
||||
|
||||
if (empty($helppagename)) $helppagename='EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
|
||||
|
||||
// Get helpbaseurl, helppage and mode from helppagename and langs
|
||||
$arrayres=getHelpParamFor($helppagename,$langs);
|
||||
$helpbaseurl=$arrayres['helpbaseurl'];
|
||||
$helppage=$arrayres['helppage'];
|
||||
$mode=$arrayres['mode'];
|
||||
|
||||
// Link to help pages
|
||||
if ($helpbaseurl && $helppage)
|
||||
{
|
||||
$text='';
|
||||
$title=$appli.'<br>';
|
||||
$title.=$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
|
||||
if ($mode == 'wiki') $title.=' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage,'_',' ')).'"';
|
||||
$text.='<a class="help" target="_blank" rel="noopener" href="';
|
||||
if ($mode == 'wiki') $text.=sprintf($helpbaseurl,urlencode(html_entity_decode($helppage)));
|
||||
else $text.=sprintf($helpbaseurl,$helppage);
|
||||
$text.='">';
|
||||
//$text.=img_picto('', 'helpdoc_top').' ';
|
||||
$text.='<span class="fa fa-question-circle atoplogin"></span>';
|
||||
//$toprightmenu.=$langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help');
|
||||
//if ($mode == 'wiki') $text.=' ('.dol_trunc(strtr($helppage,'_',' '),8).')';
|
||||
$text.='</a>';
|
||||
//$toprightmenu.='</div>'."\n";
|
||||
$toprightmenu.=@Form::textwithtooltip('',$title,2,1,$text,'login_block_elem',2);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Logout link
|
||||
if (GETPOST('withlogout','int')) $toprightmenu.=@Form::textwithtooltip('',$logouthtmltext,2,1,$logouttext,'login_block_elem',2);
|
||||
|
||||
$toprightmenu.='</div>';
|
||||
|
||||
print $toprightmenu;
|
||||
|
||||
print "</div>\n"; // end div class="login_block"
|
||||
|
||||
print '</div>';
|
||||
print '</body></html>'."\n";
|
||||
|
||||
$db->close();
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/get_menudiv.php
|
||||
* \brief File to return menu into a div tree
|
||||
* \brief File to return menu into a div tree, to be used by other frontend
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
|
||||
@ -37,8 +37,6 @@ if (! defined('DISABLE_JQUERY_TABLEDND')) define('DISABLE_JQUERY_TABLEDND',1);
|
||||
if (! defined('DISABLE_JQUERY_JNOTIFY')) define('DISABLE_JQUERY_JNOTIFY',1);
|
||||
if (! defined('DISABLE_JQUERY_FLOT')) define('DISABLE_JQUERY_FLOT',1);
|
||||
if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
|
||||
if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1);
|
||||
if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1);
|
||||
if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1);
|
||||
if (! defined('DISABLE_BROWSER_NOTIF')) define('DISABLE_BROWSER_NOTIF',1);
|
||||
if (! defined('DISABLE_DATE_PICKER')) define('DISABLE_DATE_PICKER',1);
|
||||
|
||||
@ -1298,6 +1298,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
|
||||
$maxvisiblephotos=1;
|
||||
$showimage=1;
|
||||
$entity=(empty($object->entity)?$conf->entity:$object->entity);
|
||||
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||
$modulepart='unknown';
|
||||
@ -1324,10 +1325,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$entity]);
|
||||
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
@ -1343,10 +1344,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
elseif ($object->element == 'ticketsup')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
$showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id);
|
||||
$showimage=$object->is_photo_available($conf->ticketsup->multidir_output[$entity].'/'.$object->track_id);
|
||||
$maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticketsup', $conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticketsup', $conf->ticketsup->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
|
||||
@ -1370,7 +1371,7 @@ 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->dir_output . "/";
|
||||
$dir_output = $conf->$modulepart->multidir_output[$entity] . "/";
|
||||
if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
|
||||
{
|
||||
$subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref; // the objectref dir is not include into get_exdir when used with level=2, so we add it here
|
||||
@ -3082,13 +3083,14 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto);
|
||||
|
||||
//if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on')))
|
||||
if (in_array($pictowithoutext, array('delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
|
||||
if (in_array($pictowithoutext, array('bank', 'delete', 'edit', 'off', 'on', 'play', 'playdisabled', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow')))
|
||||
{
|
||||
$fakey = $pictowithoutext; $facolor=''; $fasize='';
|
||||
if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; }
|
||||
elseif ($pictowithoutext == 'switch_on') { $fakey = 'fa-toggle-on'; $facolor='#227722'; $fasize='2em'; }
|
||||
elseif ($pictowithoutext == 'off') { $fakey = 'fa-square-o'; $fasize='1.3em'; }
|
||||
elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; }
|
||||
elseif ($pictowithoutext == 'bank') { $fakey = 'fa-bank'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; }
|
||||
elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; }
|
||||
|
||||
@ -127,15 +127,18 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
{
|
||||
$i++;
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; // addslashes is escape for PHP
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; // addslashes is escape for PHP
|
||||
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -301,11 +304,20 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($val['index'])
|
||||
if (! empty($val['index']))
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
if (! empty($val['foreignkey']))
|
||||
{
|
||||
$tmp=explode('.',$val['foreignkey']);
|
||||
if (! empty($tmp[0]) && ! empty($tmp[1]))
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$texttoinsert.= '-- END MODULEBUILDER INDEXES';
|
||||
|
||||
@ -227,7 +227,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
|
||||
* @param Object $object Object related to payment
|
||||
* @return void
|
||||
*/
|
||||
function htmlPrintOnlinePaymentFooter($fromcompany,$langs,$addformmessage=0,$suffix='',$object=null)
|
||||
function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage=0, $suffix='', $object=null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param ChargeSociales $object Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function tax_prepare_head(ChargeSociales $object)
|
||||
{
|
||||
@ -184,7 +184,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction
|
||||
* Gets Tax to collect for the given year (and given quarter or month)
|
||||
* The function gets the Tax in split results, as the Tax declaration asks
|
||||
* to report the amounts for different Tax rates as different lines.
|
||||
* This function also accounts recurrent invoices.
|
||||
*
|
||||
* @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2'
|
||||
* @param DoliDB $db Database handler object
|
||||
@ -236,12 +235,13 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
|
||||
$total_localtax1='total_localtax1';
|
||||
$total_localtax2='total_localtax2';
|
||||
|
||||
// CAS DES BIENS
|
||||
|
||||
// CAS DES BIENS/PRODUITS
|
||||
|
||||
// Define sql request
|
||||
$sql='';
|
||||
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
||||
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|
||||
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice'))
|
||||
{
|
||||
// Count on delivery date (use invoice date as delivery is unknown)
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
@ -273,44 +273,48 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
if ($q) $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3)." AND date_format(f.datef,'%m') <= ".($q*3).")";
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = 0"; // Limit to products
|
||||
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of service
|
||||
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
}
|
||||
else // Option vat on delivery for goods (payments) and payments for services
|
||||
else
|
||||
{
|
||||
// Count on delivery date (use invoice date as delivery is unknown)
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef as date_f, s.nom as company_name, s.rowid as company_id,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype,";
|
||||
$sql.= " 0 as payment_id, 0 as payment_amount";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d" ;
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
|
||||
$sql.= " WHERE f.entity = " . $conf->entity;
|
||||
$sql.= " AND f.fk_statut in (1,2)"; // Validated or paid (partially or completely)
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||
$sql.= " AND f.rowid = d.".$fk_facture;
|
||||
$sql.= " AND s.rowid = f.fk_soc";
|
||||
if ($y && $m)
|
||||
{
|
||||
$sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,$m,false))."'";
|
||||
$sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,$m,false))."'";
|
||||
}
|
||||
else if ($y)
|
||||
{
|
||||
$sql.= " AND f.datef >= '".$db->idate(dol_get_first_day($y,1,false))."'";
|
||||
$sql.= " AND f.datef <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||
}
|
||||
if ($q) $sql.= " AND (date_format(f.datef,'%m') > ".(($q-1)*3)." AND date_format(f.datef,'%m') <= ".($q*3).")";
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = 0"; // Limit to products
|
||||
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of service
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
//print $sql;
|
||||
// Count on payments date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
$sql .=" d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
|
||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype,";
|
||||
$sql.= " pf.".$fk_payment." as payment_id, pf.amount as payment_amount,";
|
||||
$sql.= " pa.datep as datep";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$paymentfacturetable." as pf,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$invoicedettable." as d";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p on d.fk_product = p.rowid";
|
||||
$sql.= " WHERE f.entity = " . $conf->entity;
|
||||
$sql.= " AND f.fk_statut in (1,2)"; // Paid (partially or completely)
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
|
||||
else $sql.= " AND f.type IN (0,1,2,3,5)";
|
||||
$sql.= " AND f.rowid = d.".$fk_facture;
|
||||
$sql.= " AND s.rowid = f.fk_soc";
|
||||
$sql.= " AND pf.".$fk_facture2." = f.rowid";
|
||||
$sql.= " AND pa.rowid = pf.".$fk_payment;
|
||||
if ($y && $m)
|
||||
{
|
||||
$sql.= " AND pa.datep >= '".$db->idate(dol_get_first_day($y,$m,false))."'";
|
||||
$sql.= " AND pa.datep <= '".$db->idate(dol_get_last_day($y,$m,false))."'";
|
||||
}
|
||||
else if ($y)
|
||||
{
|
||||
$sql.= " AND pa.datep >= '".$db->idate(dol_get_first_day($y,1,false))."'";
|
||||
$sql.= " AND pa.datep <= '".$db->idate(dol_get_last_day($y,12,false))."'";
|
||||
}
|
||||
if ($q) $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")";
|
||||
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = 0"; // Limit to products
|
||||
$sql.= " AND d.date_start is null AND d.date_end IS NULL)"; // enhance detection of products
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
|
||||
}
|
||||
|
||||
//print $sql.'<br>';
|
||||
@ -318,7 +322,7 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
if ($sql == 'TODO') return -2;
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||
dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
@ -342,7 +346,8 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
}
|
||||
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
|
||||
$list[$assoc['rate']]['datef'][] = $assoc['datef'];
|
||||
$list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
|
||||
$list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
|
||||
$list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
|
||||
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
@ -381,7 +386,8 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
|
||||
// Define sql request
|
||||
$sql='';
|
||||
if ($modetax == 1) // Option vat on delivery for goods (payment) and debit invoice for services
|
||||
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')
|
||||
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice'))
|
||||
{
|
||||
// Count on invoice date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
@ -414,9 +420,9 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
if ($date_start && $date_end) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = 1"; // Limit to services
|
||||
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture;
|
||||
}
|
||||
else // Option vat on delivery for goods (payments) and payments for services
|
||||
else
|
||||
{
|
||||
// Count on payments date
|
||||
$sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
|
||||
@ -424,7 +430,8 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
$sql.= " d.date_start as date_start, d.date_end as date_end,";
|
||||
$sql.= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef, s.nom as company_name, s.rowid as company_id,";
|
||||
$sql.= " p.rowid as pid, p.ref as pref, p.fk_product_type as ptype,";
|
||||
$sql.= " pf.".$fk_payment." as payment_id, pf.amount as payment_amount";
|
||||
$sql.= " pf.".$fk_payment." as payment_id, pf.amount as payment_amount,";
|
||||
$sql.= " pa.datep as datep";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$invoicetable." as f,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$paymentfacturetable." as pf,";
|
||||
$sql.= " ".MAIN_DB_PREFIX.$paymenttable." as pa,";
|
||||
@ -451,20 +458,20 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
}
|
||||
if ($q) $sql.= " AND (date_format(pa.datep,'%m') > ".(($q-1)*3)." AND date_format(pa.datep,'%m') <= ".($q*3).")";
|
||||
if ($date_start && $date_end) $sql.= " AND pa.datep >= '".$db->idate($date_start)."' AND pa.datep <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = 1"; // Limit to services
|
||||
$sql.= " AND (d.product_type = 1"; // Limit to services
|
||||
$sql.= " OR d.date_start is NOT null OR d.date_end IS NOT NULL)"; // enhance detection of service
|
||||
$sql.= " ORDER BY d.rowid, d.".$fk_facture.", pf.rowid";
|
||||
}
|
||||
|
||||
if (! $sql)
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
|
||||
dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR);
|
||||
return -1; // -1 = Not accountancy module enabled
|
||||
}
|
||||
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||
dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -487,7 +494,8 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
}
|
||||
$list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
|
||||
$list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
|
||||
$list[$assoc['rate']]['datef'][] = $assoc['datef'];
|
||||
$list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
|
||||
$list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
|
||||
$list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
|
||||
$list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
|
||||
$list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
|
||||
@ -550,19 +558,19 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
}
|
||||
if ($q) $sql.= " AND (date_format(p.datep,'%m') > ".(($q-1)*3)." AND date_format(p.datep,'%m') <= ".($q*3).")";
|
||||
if ($date_start && $date_end) $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
$sql.= " AND (d.product_type = -1";
|
||||
$sql.= " AND (d.product_type = -1";
|
||||
$sql.= " OR e.date_debut is NOT null OR e.date_fin IS NOT NULL)"; // enhance detection of service
|
||||
$sql.= " ORDER BY e.rowid";
|
||||
|
||||
if (! $sql)
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR);
|
||||
dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR);
|
||||
return -1; // -1 = Not accountancy module enabled
|
||||
}
|
||||
if ($sql == 'TODO') return -2; // -2 = Feature not yet available
|
||||
if ($sql != 'TODO')
|
||||
{
|
||||
dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG);
|
||||
dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -624,24 +632,3 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets VAT to collect for the given year (and given quarter or month)
|
||||
* The function gets the VAT in split results, as the VAT declaration asks
|
||||
* to report the amounts for different VAT rates as different lines.
|
||||
* This function also accounts recurrent invoices.
|
||||
*
|
||||
* @param DoliDB $db Database handler object
|
||||
* @param int $y Year
|
||||
* @param int $q Quarter
|
||||
* @param string $date_start Start date
|
||||
* @param string $date_end End date
|
||||
* @param int $modetax 0 or 1 (option vat on debit)
|
||||
* @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
|
||||
* @param int $m Month
|
||||
* @return array List of quarters with vat
|
||||
*/
|
||||
function vat_by_date ($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0)
|
||||
{
|
||||
return tax_by_date('vat', $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m);
|
||||
}
|
||||
|
||||
|
||||
@ -591,6 +591,7 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) {
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
@ -626,6 +627,34 @@ class ImportCsv extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
@ -651,6 +651,34 @@ class ImportXlsx extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
340
htdocs/core/modules/modDav.class.php
Normal file
340
htdocs/core/modules/modDav.class.php
Normal file
@ -0,0 +1,340 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup dav Module dav
|
||||
* \brief dav module descriptor.
|
||||
*
|
||||
* \file htdocs/dav/core/modules/modDav.class.php
|
||||
* \ingroup dav
|
||||
* \brief Description and activation file for module dav
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
// The class name should start with a lower case mod for Dolibarr to pick it up
|
||||
// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule.
|
||||
// @codingStandardsIgnoreStart
|
||||
/**
|
||||
* Description and activation class for module dav
|
||||
*/
|
||||
class modDav extends DolibarrModules
|
||||
{
|
||||
// @codingStandardsIgnoreEnd
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 50310; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve id number for your module
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'dav';
|
||||
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "interface";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '90';
|
||||
// Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
|
||||
// Module label (no space allowed), used if translation string 'ModuledavName' not found (MyModue is name of module).
|
||||
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||
// Module description, used if translation string 'ModuledavDesc' not found (MyModue is name of module).
|
||||
$this->description = "davDescription";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "davDescription (Long)";
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where DAV is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto='generic';
|
||||
|
||||
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
|
||||
// for default path (eg: /dav/core/xxxxx) (0=disable, 1=enable)
|
||||
// for specific path of parts (eg: /dav/core/modules/barcode)
|
||||
// for specific css file (eg: /dav/css/dav.css.php)
|
||||
$this->module_parts = array(
|
||||
'triggers' => 0, // Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'login' => 0, // Set this to 1 if module has its own login method file (core/login)
|
||||
'substitutions' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'menus' => 0, // Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'theme' => 0, // Set this to 1 if module has its own theme directory (theme)
|
||||
'tpl' => 0, // Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'css' => array(''), // Set this to relative path of css file if module has its own css file
|
||||
'js' => array(''), // Set this to relative path of js file if module must load a js on all pages
|
||||
'hooks' => array() // Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context 'all'
|
||||
);
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/dav/temp","/dav/subdir");
|
||||
$this->dirs = array("/dav/temp","/dav/public");
|
||||
|
||||
// Config pages. Put here list of php page, stored into dav/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("dav.php");
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->langfiles = array("admin");
|
||||
$this->phpmin = array(5,4); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(7,0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'davWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(0=>array('DAV_MYNEWCONST1','chaine','myvalue','This is a constant to add',1),
|
||||
// 1=>array('DAV_MYNEWCONST2','chaine','myvalue','This is another constant to add',0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
1=>array('DAV_MYCONSTANT', 'chaine', 'avalue', 'This is a constant to add', 1, 'allentities', 1)
|
||||
);
|
||||
|
||||
|
||||
if (! isset($conf->dav) || ! isset($conf->dav->enabled))
|
||||
{
|
||||
$conf->dav=new stdClass();
|
||||
$conf->dav->enabled=0;
|
||||
}
|
||||
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// Example:
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@dav:$user->rights->dav->read:/dav/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@dav:$user->rights->othermodule->read:/dav/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||
//
|
||||
// Where objecttype can be
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'user' to add a tab in user view
|
||||
|
||||
|
||||
// Dictionaries
|
||||
$this->dictionaries=array();
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs'=>'mylangfile@dav',
|
||||
'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor
|
||||
'tablib'=>array("Table1","Table2","Table3"), // Label of tables
|
||||
'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields
|
||||
'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order
|
||||
'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary)
|
||||
'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record)
|
||||
'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert)
|
||||
'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid')
|
||||
'tabcond'=>array($conf->dav->enabled,$conf->dav->enabled,$conf->dav->enabled) // Condition to show each dictionary
|
||||
);
|
||||
*/
|
||||
|
||||
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in dav/core/boxes that contains class to show a widget.
|
||||
$this->boxes = array(
|
||||
//0=>array('file'=>'davwidget1.php@dav','note'=>'Widget provided by dav','enabledbydefaulton'=>'Home'),
|
||||
//1=>array('file'=>'davwidget2.php@dav','note'=>'Widget provided by dav'),
|
||||
//2=>array('file'=>'davwidget3.php@dav','note'=>'Widget provided by dav')
|
||||
);
|
||||
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
//0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/dav/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true)
|
||||
);
|
||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true)
|
||||
// );
|
||||
|
||||
|
||||
// Permissions
|
||||
$this->rights = array(); // Permission array used by this module
|
||||
|
||||
/*
|
||||
$r=0;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read myobject of dav'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update myobject of dav'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete myobject of dav'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Permission by default for new user (0/1)
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->dav->level1->level2)
|
||||
*/
|
||||
|
||||
// Main menu entries
|
||||
$this->menu = array(); // List of menus to add
|
||||
$r=0;
|
||||
|
||||
// Add here entries to declare new menus
|
||||
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
/*$this->menu[$r++]=array('fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'top', // This is a Top menu entry
|
||||
'titre'=>'dav',
|
||||
'mainmenu'=>'dav',
|
||||
'leftmenu'=>'',
|
||||
'url'=>'/dav/davindex.php',
|
||||
'langs'=>'dav@dav', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->dav->enabled', // Define condition to show or hide menu entry. Use '$conf->dav->enabled' if entry must be visible if module is enabled.
|
||||
'perms'=>'1', // Use 'perms'=>'$user->rights->dav->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
*/
|
||||
/* END MODULEBUILDER TOPMENU */
|
||||
|
||||
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
|
||||
$this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=dav', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'List MyObject',
|
||||
'mainmenu'=>'dav',
|
||||
'leftmenu'=>'dav_myobject_list',
|
||||
'url'=>'/dav/myobject_list.php',
|
||||
'langs'=>'dav@dav', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->dav->enabled', // Define condition to show or hide menu entry. Use '$conf->dav->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->dav->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
$this->menu[$r++]=array( 'fk_menu'=>'fk_mainmenu=dav,fk_leftmenu=dav', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||
'type'=>'left', // This is a Left menu entry
|
||||
'titre'=>'New MyObject',
|
||||
'mainmenu'=>'dav',
|
||||
'leftmenu'=>'dav_myobject_new',
|
||||
'url'=>'/dav/myobject_page.php?action=create',
|
||||
'langs'=>'dav@dav', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||
'position'=>1000+$r,
|
||||
'enabled'=>'$conf->dav->enabled', // Define condition to show or hide menu entry. Use '$conf->dav->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->dav->level1->level2' if you want your menu with a permission rules
|
||||
'target'=>'',
|
||||
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
|
||||
END MODULEBUILDER LEFTMENU MYOBJECT */
|
||||
|
||||
|
||||
// Exports
|
||||
$r=1;
|
||||
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("dav@dav");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='myobject@dav';
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/mymobule/class/myobject.class.php'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r]=array('mysubobject'=>'ts.rowid', 't.myfield'=>array('t.myfield2','t.myfield3')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'myobject as t';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options='')
|
||||
{
|
||||
$this->_load_tables();
|
||||
|
||||
// Create extrafields
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
|
||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1 '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'dav@dav', '$conf->dav->enabled');
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
|
||||
}
|
||||
@ -93,7 +93,7 @@ class modTicketsup extends DolibarrModules
|
||||
// Set this to 1 if module has its own models directory
|
||||
'models' => 1,
|
||||
// Set this to relative path of css if module has its own css file
|
||||
'css' => '/ticketsup/css/ticketsup.css',
|
||||
//'css' => '',
|
||||
// Set here all hooks context managed by module
|
||||
'hooks' => array('admin')
|
||||
// Set here all workflow context managed by module
|
||||
|
||||
@ -38,23 +38,78 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
*/
|
||||
class pdf_aurore extends ModelePDFSupplierProposal
|
||||
{
|
||||
var $db;
|
||||
var $name;
|
||||
var $description;
|
||||
var $type;
|
||||
/**
|
||||
* @var DoliDb Database handler
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string model name
|
||||
*/
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string model description (short text)
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string document type
|
||||
*/
|
||||
public $type;
|
||||
|
||||
var $phpmin = array(4,3,0); // Minimum version of PHP required by module
|
||||
var $version = 'dolibarr';
|
||||
/**
|
||||
* @var array() Minimum version of PHP required by module.
|
||||
* e.g.: PHP ≥ 5.3 = array(5, 3)
|
||||
*/
|
||||
public $phpmin = array(5, 2);
|
||||
|
||||
/**
|
||||
* Dolibarr version of the loaded document
|
||||
* @public string
|
||||
*/
|
||||
public $version = 'dolibarr';
|
||||
|
||||
var $page_largeur;
|
||||
var $page_hauteur;
|
||||
var $format;
|
||||
var $marge_gauche;
|
||||
var $marge_droite;
|
||||
var $marge_haute;
|
||||
var $marge_basse;
|
||||
/**
|
||||
* @var int page_largeur
|
||||
*/
|
||||
public $page_largeur;
|
||||
|
||||
/**
|
||||
* @var int page_hauteur
|
||||
*/
|
||||
public $page_hauteur;
|
||||
|
||||
/**
|
||||
* @var array format
|
||||
*/
|
||||
public $format;
|
||||
|
||||
/**
|
||||
* @var int marge_gauche
|
||||
*/
|
||||
public $marge_gauche;
|
||||
|
||||
/**
|
||||
* @var int marge_droite
|
||||
*/
|
||||
public $marge_droite;
|
||||
|
||||
/**
|
||||
* @var int marge_haute
|
||||
*/
|
||||
public $marge_haute;
|
||||
|
||||
/**
|
||||
* @var int marge_basse
|
||||
*/
|
||||
public $marge_basse;
|
||||
|
||||
var $emetteur; // Objet societe qui emet
|
||||
/**
|
||||
* Issuer
|
||||
* @var Societe
|
||||
*/
|
||||
public $emetteur;
|
||||
|
||||
|
||||
/**
|
||||
@ -62,9 +117,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
global $conf, $langs, $mysoc;
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("main", "bills"));
|
||||
@ -146,13 +201,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
|
||||
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("dict");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("supplier_proposal");
|
||||
$outputlangs->load("products");
|
||||
|
||||
// Translations
|
||||
$outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal"));
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
@ -1188,11 +1239,9 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("supplier_proposal");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
// Translations
|
||||
$outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies"));
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
|
||||
@ -8,16 +8,17 @@ if (empty($conf) || ! is_object($conf))
|
||||
}
|
||||
|
||||
// Loop to show all columns of extrafields for the title line
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
if (is_array($extrafields->attributes[$object->element]['label']) && count($extrafields->attributes[$object->element]['label']))
|
||||
{
|
||||
foreach($extrafields->attribute_label as $key => $val)
|
||||
foreach($extrafields->attributes[$object->element]['label'] as $key => $val)
|
||||
{
|
||||
if (! empty($arrayfields["ef.".$key]['checked']))
|
||||
{
|
||||
$align=$extrafields->getAlignFlag($key);
|
||||
$sortonfield = "ef.".$key;
|
||||
if (! empty($extrafields->attribute_computed[$key])) $sortonfield='';
|
||||
print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||
if (! empty($extrafields->attributes[$object->element]['computed'][$key])) $sortonfield='';
|
||||
if ($extrafields->attributes[$object->element]['type'][$key] == 'separate') print '<th class="liste_titre thseparator"></th>';
|
||||
else print getTitleFieldOfList($langs->trans($extralabels[$key]), 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align?'align="'.$align.'"':''), $sortfield, $sortorder)."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,14 +138,15 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
// Show date range
|
||||
if ($line->element == 'facturedetrec') {
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><br><div class="nowraponall">';
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">';
|
||||
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
|
||||
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
|
||||
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
|
||||
}
|
||||
else {
|
||||
echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
//echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
// Add description in form
|
||||
|
||||
@ -440,7 +440,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
if ($object->typeid > 0)
|
||||
{
|
||||
$membertype->fetch($object->typeid);
|
||||
$membertype->listMembersForMemberType();
|
||||
$membertype->listMembersForMemberType('', 1);
|
||||
|
||||
$oldinfo=$membertype->_load_ldap_info();
|
||||
$olddn=$membertype->_load_ldap_dn($oldinfo);
|
||||
@ -560,7 +560,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
*/
|
||||
$newmembertype=new AdherentType($this->db);
|
||||
$newmembertype->fetch($object->typeid);
|
||||
$newmembertype->listMembersForMemberType();
|
||||
$newmembertype->listMembersForMemberType('', 1);
|
||||
|
||||
$oldinfo=$newmembertype->_load_ldap_info();
|
||||
$olddn=$newmembertype->_load_ldap_dn($oldinfo);
|
||||
@ -586,7 +586,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
*/
|
||||
$oldmembertype=new AdherentType($this->db);
|
||||
$oldmembertype->fetch($object->oldcopy->typeid);
|
||||
$oldmembertype->listMembersForMemberType();
|
||||
$oldmembertype->listMembersForMemberType('', 1);
|
||||
|
||||
$oldinfo=$oldmembertype->_load_ldap_info();
|
||||
$olddn=$oldmembertype->_load_ldap_dn($oldinfo);
|
||||
@ -684,7 +684,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
*/
|
||||
$membertype=new AdherentType($this->db);
|
||||
$membertype->fetch($object->typeid);
|
||||
$membertype->listMembersForMemberType('a.rowid != ' . $object->id); // remove deleted member from the list
|
||||
$membertype->listMembersForMemberType('a.rowid != ' . $object->id, 1); // remove deleted member from the list
|
||||
|
||||
$oldinfo=$membertype->_load_ldap_info();
|
||||
$olddn=$membertype->_load_ldap_dn($oldinfo);
|
||||
@ -751,7 +751,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$object->oldcopy = clone $object;
|
||||
}
|
||||
|
||||
$object->oldcopy->listMembersForMemberType();
|
||||
$object->oldcopy->listMembersForMemberType('', 1);
|
||||
|
||||
$oldinfo=$object->oldcopy->_load_ldap_info();
|
||||
$olddn=$object->oldcopy->_load_ldap_dn($oldinfo);
|
||||
@ -765,7 +765,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers
|
||||
$olddn = '';
|
||||
}
|
||||
|
||||
$object->listMembersForMemberType();
|
||||
$object->listMembersForMemberType('', 1);
|
||||
|
||||
$info=$object->_load_ldap_info();
|
||||
$dn=$object->_load_ldap_dn($info);
|
||||
|
||||
@ -56,10 +56,10 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// We add subscription if we change category (new category may means more mailing-list to subscribe)
|
||||
if (is_object($object->linkto) && method_exists($object->linkto, 'add_to_abo') && $object->linkto->add_to_abo() < 0)
|
||||
if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0)
|
||||
{
|
||||
$this->error=$object->linkto->error;
|
||||
$this->errors=$object->linkto->errors;
|
||||
$this->error=$object->context['linkto']->error;
|
||||
$this->errors=$object->context['linkto']->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
|
||||
@ -517,7 +517,7 @@ if ($num > 0)
|
||||
print '<td align="right" class="nowraponall">';
|
||||
if ($user->rights->cron->create)
|
||||
{
|
||||
print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."</a> ";
|
||||
print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].'?'.$param.($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."</a> ";
|
||||
}
|
||||
if ($user->rights->cron->delete)
|
||||
{
|
||||
|
||||
299
htdocs/dav/dav.class.php
Normal file
299
htdocs/dav/dav.class.php
Normal file
@ -0,0 +1,299 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/dav/dav.class.php
|
||||
* \ingroup dav
|
||||
* \brief Server DAV
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Define Common function to access calendar items and format it in vCalendar
|
||||
*/
|
||||
class CdavLib
|
||||
{
|
||||
|
||||
private $db;
|
||||
|
||||
private $user;
|
||||
|
||||
private $langs;
|
||||
|
||||
function __construct($user, $db, $langs)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->db = $db;
|
||||
$this->langs = $langs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base sql request for calendar events
|
||||
*
|
||||
* @param int $calid Calendard id
|
||||
* @param int|boolean $oid Oid
|
||||
* @param int|boolean $ouri Ouri
|
||||
* @return string
|
||||
*/
|
||||
public function getSqlCalEvents($calid, $oid=false, $ouri=false)
|
||||
{
|
||||
// TODO : replace GROUP_CONCAT by
|
||||
$sql = 'SELECT
|
||||
a.tms AS lastupd,
|
||||
a.*,
|
||||
sp.firstname,
|
||||
sp.lastname,
|
||||
sp.address,
|
||||
sp.zip,
|
||||
sp.town,
|
||||
co.label country_label,
|
||||
sp.phone,
|
||||
sp.phone_perso,
|
||||
sp.phone_mobile,
|
||||
s.nom AS soc_nom,
|
||||
s.address soc_address,
|
||||
s.zip soc_zip,
|
||||
s.town soc_town,
|
||||
cos.label soc_country_label,
|
||||
s.phone soc_phone,
|
||||
ac.sourceuid,
|
||||
(SELECT GROUP_CONCAT(u.login) FROM '.MAIN_DB_PREFIX.'actioncomm_resources ar
|
||||
LEFT OUTER JOIN '.MAIN_DB_PREFIX.'user AS u ON (u.rowid=fk_element)
|
||||
WHERE ar.element_type=\'user\' AND fk_actioncomm=a.id) AS other_users
|
||||
FROM '.MAIN_DB_PREFIX.'actioncomm AS a';
|
||||
if (! $this->user->rights->societe->client->voir )//FIXME si 'voir' on voit plus de chose ?
|
||||
{
|
||||
$sql.=' LEFT OUTER JOIN '.MAIN_DB_PREFIX.'societe_commerciaux AS sc ON (a.fk_soc = sc.fk_soc AND sc.fk_user='.$this->user->id.')
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON (s.rowid = sc.fk_soc)
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'socpeople AS sp ON (sp.fk_soc = sc.fk_soc AND sp.rowid = a.fk_contact)
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_cdav AS ac ON (a.id = ac.fk_object)';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON (s.rowid = a.fk_soc)
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'socpeople AS sp ON (sp.rowid = a.fk_contact)
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_cdav AS ac ON (a.id = ac.fk_object)';
|
||||
}
|
||||
|
||||
$sql.=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON co.rowid = sp.fk_pays
|
||||
LEFT JOIN '.MAIN_DB_PREFIX.'c_country as cos ON cos.rowid = s.fk_pays
|
||||
WHERE a.id IN (SELECT ar.fk_actioncomm FROM '.MAIN_DB_PREFIX.'actioncomm_resources ar WHERE ar.element_type=\'user\' AND ar.fk_element='.intval($calid).')
|
||||
AND a.code IN (SELECT cac.code FROM '.MAIN_DB_PREFIX.'c_actioncomm cac WHERE cac.type<>\'systemauto\')
|
||||
AND a.entity IN ('.getEntity('societe', 1).')';
|
||||
if($oid!==false) {
|
||||
if($ouri===false)
|
||||
{
|
||||
$sql.=' AND a.id = '.intval($oid);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.=' AND (a.id = '.intval($oid).' OR ac.uuidext = \''.$this->db->escape($ouri).'\')';
|
||||
}
|
||||
}
|
||||
|
||||
return $sql;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert calendar row to VCalendar string
|
||||
*
|
||||
* @param int $calid Calendar id
|
||||
* @param Object $obj Object id
|
||||
* @return string
|
||||
*/
|
||||
public function toVCalendar($calid, $obj)
|
||||
{
|
||||
/*$categ = array();
|
||||
if($obj->soc_client)
|
||||
{
|
||||
$nick[] = $obj->soc_code_client;
|
||||
$categ[] = $this->langs->transnoentitiesnoconv('Customer');
|
||||
}*/
|
||||
|
||||
$location=$obj->location;
|
||||
|
||||
// contact address
|
||||
if(empty($location) && !empty($obj->address))
|
||||
{
|
||||
$location = trim(str_replace(array("\r","\t","\n"),' ', $obj->address));
|
||||
$location = trim($location.', '.$obj->zip);
|
||||
$location = trim($location.' '.$obj->town);
|
||||
$location = trim($location.', '.$obj->country_label);
|
||||
}
|
||||
|
||||
// contact address
|
||||
if(empty($location) && !empty($obj->soc_address))
|
||||
{
|
||||
$location = trim(str_replace(array("\r","\t","\n"),' ', $obj->soc_address));
|
||||
$location = trim($location.', '.$obj->soc_zip);
|
||||
$location = trim($location.' '.$obj->soc_town);
|
||||
$location = trim($location.', '.$obj->soc_country_label);
|
||||
}
|
||||
|
||||
$address=explode("\n",$obj->address,2);
|
||||
foreach($address as $kAddr => $vAddr)
|
||||
{
|
||||
$address[$kAddr] = trim(str_replace(array("\r","\t"),' ', str_replace("\n",' | ', trim($vAddr))));
|
||||
}
|
||||
$address[]='';
|
||||
$address[]='';
|
||||
|
||||
if($obj->percent==-1 && trim($obj->datep)!='')
|
||||
$type='VEVENT';
|
||||
else
|
||||
$type='VTODO';
|
||||
|
||||
$timezone = date_default_timezone_get();
|
||||
|
||||
$caldata ="BEGIN:VCALENDAR\n";
|
||||
$caldata.="VERSION:2.0\n";
|
||||
$caldata.="METHOD:PUBLISH\n";
|
||||
$caldata.="PRODID:-//Dolibarr CDav//FR\n";
|
||||
$caldata.="BEGIN:".$type."\n";
|
||||
$caldata.="CREATED:".gmdate('Ymd\THis', strtotime($obj->datec))."Z\n";
|
||||
$caldata.="LAST-MODIFIED:".gmdate('Ymd\THis', strtotime($obj->lastupd))."Z\n";
|
||||
$caldata.="DTSTAMP:".gmdate('Ymd\THis', strtotime($obj->lastupd))."Z\n";
|
||||
if($obj->sourceuid=='')
|
||||
$caldata.="UID:".$obj->id.'-ev-'.$calid.'-cal-'.CDAV_URI_KEY."\n";
|
||||
else
|
||||
$caldata.="UID:".$obj->sourceuid."\n";
|
||||
$caldata.="SUMMARY:".$obj->label."\n";
|
||||
$caldata.="LOCATION:".$location."\n";
|
||||
$caldata.="PRIORITY:".$obj->priority."\n";
|
||||
if($obj->fulldayevent)
|
||||
{
|
||||
$caldata.="DTSTART;VALUE=DATE:".date('Ymd', strtotime($obj->datep))."\n";
|
||||
if($type=='VEVENT')
|
||||
{
|
||||
if(trim($obj->datep2)!='')
|
||||
$caldata.="DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep2)+1)."\n";
|
||||
else
|
||||
$caldata.="DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep)+(25*3600))."\n";
|
||||
}
|
||||
elseif(trim($obj->datep2)!='')
|
||||
$caldata.="DUE;VALUE=DATE:".date('Ymd', strtotime($obj->datep2)+1)."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$caldata.="DTSTART;TZID=".$timezone.":".strtr($obj->datep,array(" "=>"T", ":"=>"", "-"=>""))."\n";
|
||||
if($type=='VEVENT')
|
||||
{
|
||||
if(trim($obj->datep2)!='')
|
||||
$caldata.="DTEND;TZID=".$timezone.":".strtr($obj->datep2,array(" "=>"T", ":"=>"", "-"=>""))."\n";
|
||||
else
|
||||
$caldata.="DTEND;TZID=".$timezone.":".strtr($obj->datep,array(" "=>"T", ":"=>"", "-"=>""))."\n";
|
||||
}
|
||||
elseif(trim($obj->datep2)!='')
|
||||
$caldata.="DUE;TZID=".$timezone.":".strtr($obj->datep2,array(" "=>"T", ":"=>"", "-"=>""))."\n";
|
||||
}
|
||||
$caldata.="CLASS:PUBLIC\n";
|
||||
if($obj->transparency==1)
|
||||
$caldata.="TRANSP:TRANSPARENT\n";
|
||||
else
|
||||
$caldata.="TRANSP:OPAQUE\n";
|
||||
|
||||
if($type=='VEVENT')
|
||||
$caldata.="STATUS:CONFIRMED\n";
|
||||
elseif($obj->percent==0)
|
||||
$caldata.="STATUS:NEEDS-ACTION\n";
|
||||
elseif($obj->percent==100)
|
||||
$caldata.="STATUS:COMPLETED\n";
|
||||
else
|
||||
{
|
||||
$caldata.="STATUS:IN-PROCESS\n";
|
||||
$caldata.="PERCENT-COMPLETE:".$obj->percent."\n";
|
||||
}
|
||||
|
||||
$caldata.="DESCRIPTION:";
|
||||
$caldata.=strtr($obj->note, array("\n"=>"\\n", "\r"=>""));
|
||||
if(!empty($obj->soc_nom))
|
||||
$caldata.="\\n*DOLIBARR-SOC: ".$obj->soc_nom;
|
||||
if(!empty($obj->soc_phone))
|
||||
$caldata.="\\n*DOLIBARR-SOC-TEL: ".$obj->soc_phone;
|
||||
if(!empty($obj->firstname) || !empty($obj->lastname))
|
||||
$caldata.="\\n*DOLIBARR-CTC: ".trim($obj->firstname.' '.$obj->lastname);
|
||||
if(!empty($obj->phone) || !empty($obj->phone_perso) || !empty($obj->phone_mobile))
|
||||
$caldata.="\\n*DOLIBARR-CTC-TEL: ".trim($obj->phone.' '.$obj->phone_perso.' '.$obj->phone_mobile);
|
||||
if(strpos($obj->other_users,',')) // several
|
||||
$caldata.="\\n*DOLIBARR-USR: ".$obj->other_users;
|
||||
$caldata.="\n";
|
||||
|
||||
$caldata.="END:".$type."\n";
|
||||
$caldata.="END:VCALENDAR\n";
|
||||
|
||||
return $caldata;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFullCalendarObjects
|
||||
*
|
||||
* @param int $calendarId Calendar id
|
||||
* @param int $bCalendarData Add calendar data
|
||||
* @return array|string[][]|unknown[][]|NULL[][]
|
||||
*/
|
||||
public function getFullCalendarObjects($calendarId, $bCalendarData)
|
||||
{
|
||||
$calid = ($calendarId*1);
|
||||
$calevents = array();
|
||||
|
||||
if(! $this->user->rights->agenda->myactions->read)
|
||||
return $calevents;
|
||||
|
||||
if($calid!=$this->user->id && (!isset($this->user->rights->agenda->allactions->read) || !$this->user->rights->agenda->allactions->read))
|
||||
return $calevents;
|
||||
|
||||
$sql = $this->getSqlCalEvents($calid);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
while ($obj = $this->db->fetch_object($result))
|
||||
{
|
||||
$calendardata = $this->toVCalendar($calid, $obj);
|
||||
|
||||
if($bCalendarData)
|
||||
{
|
||||
$calevents[] = array(
|
||||
'calendardata' => $calendardata,
|
||||
'uri' => $obj->id.'-ev-'.CDAV_URI_KEY,
|
||||
'lastmodified' => strtotime($obj->lastupd),
|
||||
'etag' => '"'.md5($calendardata).'"',
|
||||
'calendarid' => $calendarId,
|
||||
'size' => strlen($calendardata),
|
||||
'component' => strpos($calendardata, 'BEGIN:VEVENT')>0 ? 'vevent' : 'vtodo',
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$calevents[] = array(
|
||||
// 'calendardata' => $calendardata, not necessary because etag+size are present
|
||||
'uri' => $obj->id.'-ev-'.CDAV_URI_KEY,
|
||||
'lastmodified' => strtotime($obj->lastupd),
|
||||
'etag' => '"'.md5($calendardata).'"',
|
||||
'calendarid' => $calendarId,
|
||||
'size' => strlen($calendardata),
|
||||
'component' => strpos($calendardata, 'BEGIN:VEVENT')>0 ? 'vevent' : 'vtodo',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $calevents;
|
||||
}
|
||||
|
||||
}
|
||||
40
htdocs/dav/dav.lib.php
Normal file
40
htdocs/dav/dav.lib.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/dav/dav.lib.php
|
||||
* \ingroup dav
|
||||
* \brief Server DAV
|
||||
*/
|
||||
|
||||
// define CDAV_CONTACT_TAG if not
|
||||
if(!defined('CDAV_CONTACT_TAG'))
|
||||
{
|
||||
if(isset($conf->global->CDAV_CONTACT_TAG))
|
||||
define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG);
|
||||
else
|
||||
define('CDAV_CONTACT_TAG', '');
|
||||
}
|
||||
|
||||
// define CDAV_URI_KEY if not
|
||||
if(!defined('CDAV_URI_KEY'))
|
||||
{
|
||||
if(isset($conf->global->CDAV_URI_KEY))
|
||||
define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY);
|
||||
else
|
||||
define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']),0,8));
|
||||
}
|
||||
153
htdocs/dav/fileserver.php
Normal file
153
htdocs/dav/fileserver.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 Destailleur Laurent <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/dav/fileserver.php
|
||||
* \ingroup dav
|
||||
* \brief Server DAV
|
||||
*/
|
||||
|
||||
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no menu to show
|
||||
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
|
||||
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||
|
||||
require ("../main.inc.php");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/dav/dav.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/dav/dav.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/sabre/autoload.php';
|
||||
|
||||
|
||||
$user = new User($db);
|
||||
if(isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_USER']!='')
|
||||
{
|
||||
$user->fetch('',$_SERVER['PHP_AUTH_USER']);
|
||||
$user->getrights();
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("main","other"));
|
||||
|
||||
|
||||
if(empty($conf->dav->enabled))
|
||||
accessforbidden();
|
||||
|
||||
|
||||
// settings
|
||||
$publicDir = $conf->dav->dir_output.'/public';
|
||||
$tmpDir = $conf->dav->dir_output.'/tmp';
|
||||
|
||||
// Authentication callback function
|
||||
$authBackend = new \Sabre\DAV\Auth\Backend\BasicCallBack(function ($username, $password)
|
||||
{
|
||||
global $user;
|
||||
global $conf;
|
||||
global $dolibarr_main_authentication;
|
||||
|
||||
if (empty($user->login))
|
||||
return false;
|
||||
if ($user->socid > 0)
|
||||
return false;
|
||||
if ($user->login != $username)
|
||||
return false;
|
||||
|
||||
// Authentication mode
|
||||
if (empty($dolibarr_main_authentication))
|
||||
$dolibarr_main_authentication='http,dolibarr';
|
||||
$authmode = explode(',',$dolibarr_main_authentication);
|
||||
$entity = (GETPOST('entity','int') ? GETPOST('entity','int') : (!empty($conf->entity) ? $conf->entity : 1));
|
||||
|
||||
if (checkLoginPassEntity($username,$password,$entity,$authmode) != $username)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
$authBackend->setRealm(constant('DOL_APPLICATION_TITLE'));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions and View
|
||||
*/
|
||||
|
||||
// Create the root node
|
||||
// Setting up the directory tree //
|
||||
$nodes = array();
|
||||
|
||||
// Enable directories and features according to DAV setup
|
||||
// / Public docs
|
||||
$nodes[] = new \Sabre\DAV\FS\Directory($dolibarr_main_data_root. '/dav/public');
|
||||
|
||||
// Principals Backend
|
||||
//$principalBackend = new \Sabre\DAVACL\PrincipalBackend\Dolibarr($user,$db);
|
||||
// /principals
|
||||
//$nodes[] = new \Sabre\DAVACL\PrincipalCollection($principalBackend);
|
||||
// CardDav & CalDav Backend
|
||||
//$carddavBackend = new \Sabre\CardDAV\Backend\Dolibarr($user,$db,$langs);
|
||||
//$caldavBackend = new \Sabre\CalDAV\Backend\Dolibarr($user,$db,$langs, $cdavLib);
|
||||
// /addressbook
|
||||
//$nodes[] = new \Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend);
|
||||
// /calendars
|
||||
//$nodes[] = new \Sabre\CalDAV\CalendarRoot($principalBackend, $caldavBackend);
|
||||
|
||||
|
||||
// The rootnode needs in turn to be passed to the server class
|
||||
$server = new \Sabre\DAV\Server($nodes);
|
||||
|
||||
// If you want to run the SabreDAV server in a custom location (using mod_rewrite for instance)
|
||||
// You can override the baseUri here.
|
||||
$baseUri = DOL_URL_ROOT.'/dav/fileserver.php/';
|
||||
if (isset($baseUri)) $server->setBaseUri($baseUri);
|
||||
|
||||
// Add authentication function
|
||||
$server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend));
|
||||
|
||||
// Support for LOCK and UNLOCK
|
||||
$lockBackend = new \Sabre\DAV\Locks\Backend\File($tmpDir . '/.locksdb');
|
||||
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
|
||||
$server->addPlugin($lockPlugin);
|
||||
|
||||
// Support for html frontend
|
||||
$browser = new \Sabre\DAV\Browser\Plugin();
|
||||
$server->addPlugin($browser);
|
||||
|
||||
// Automatically guess (some) contenttypes, based on extension
|
||||
//$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
|
||||
|
||||
//$server->addPlugin(new \Sabre\CardDAV\Plugin());
|
||||
//$server->addPlugin(new \Sabre\CalDAV\Plugin());
|
||||
//$server->addPlugin(new \Sabre\DAVACL\Plugin());
|
||||
|
||||
// Temporary file filter
|
||||
/*$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
|
||||
$server->addPlugin($tempFF);
|
||||
*/
|
||||
|
||||
// And off we go!
|
||||
$server->exec();
|
||||
|
||||
if (is_object($db)) $db->close();
|
||||
@ -32,6 +32,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
|
||||
$langs->loadLangs(array("sendings","deliveries",'companies','bills'));
|
||||
|
||||
$contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'shipmentlist'; // To manage different context of search
|
||||
|
||||
$socid=GETPOST('socid','int');
|
||||
// Security check
|
||||
$expeditionid = GETPOST('id','int');
|
||||
@ -64,9 +66,6 @@ $offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$contextpage='shipmentlist';
|
||||
|
||||
$viewstatut=GETPOST('viewstatut');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
|
||||
@ -1128,11 +1128,17 @@ if (empty($reshook))
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PriceUTTC")), null, 'errors');
|
||||
}
|
||||
// Warning if date out of range
|
||||
if ($date < $object->date_debut || $date > ($object->date_fin + (24 * 3600 - 1)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
|
||||
}
|
||||
|
||||
// S'il y'a eu au moins une erreur
|
||||
if (! $error)
|
||||
{
|
||||
$type = 0; // TODO What if service ?
|
||||
$type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees
|
||||
|
||||
// Insert line
|
||||
$result = $object->addline($qty,$value_unit,$fk_c_type_fees,$vatrate,$date,$comments,$fk_projet,$fk_c_exp_tax_cat,$type);
|
||||
@ -1243,6 +1249,12 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors');
|
||||
$action='';
|
||||
}
|
||||
// Warning if date out of range
|
||||
if ($date < $object->date_debut || $date > ($object->date_fin + (24 * 3600 - 1)))
|
||||
{
|
||||
$langs->load("errors");
|
||||
setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings');
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -1272,8 +1284,8 @@ if (empty($reshook))
|
||||
|
||||
$result = $object->recalculer($id);
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
//header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
//exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -92,6 +92,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
|
||||
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
|
||||
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
|
||||
if (! empty($this->fk_expensereport)) $this->chid = $this->fk_expensereport;
|
||||
|
||||
$totalamount = 0;
|
||||
foreach ($this->amounts as $key => $value) // How payment is dispatch
|
||||
@ -108,9 +109,6 @@ class PaymentExpenseReport extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
//Fix me fields
|
||||
$this->chid = $this->fk_expensereport;
|
||||
|
||||
if ($totalamount != 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,";
|
||||
@ -515,7 +513,7 @@ class PaymentExpenseReport extends CommonObject
|
||||
//Fix me field
|
||||
$this->total = $this->amount;
|
||||
$total = $this->total;
|
||||
|
||||
|
||||
if ($mode == 'payment_expensereport') $amount=$total;
|
||||
|
||||
// Insert payment into llx_bank
|
||||
|
||||
@ -43,6 +43,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'):'expensereportlist';
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST('socid','int');
|
||||
@ -82,10 +83,8 @@ $optioncss = GETPOST('optioncss','alpha');
|
||||
if ($search_status == '') $search_status=-1;
|
||||
if ($search_user == '') $search_user=-1;
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'expensereportlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new ExpenseReport($db);
|
||||
$hookmanager->initHooks(array('expensereportlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ $langs->load("bills");
|
||||
$langs->load("banks");
|
||||
$langs->load("trips");
|
||||
|
||||
$chid=GETPOST("id",'int');
|
||||
$id=GETPOST("id",'int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
$action=GETPOST('action','aZ09');
|
||||
$amounts = array();
|
||||
@ -55,13 +55,18 @@ if ($action == 'add_payment')
|
||||
|
||||
if ($_POST["cancel"])
|
||||
{
|
||||
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$chid;
|
||||
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id;
|
||||
header("Location: ".$loc);
|
||||
exit;
|
||||
}
|
||||
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($chid, $ref);
|
||||
$result = $expensereport->fetch($id, $ref);
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($expensereport->error, $expensereport->errors, 'errors');
|
||||
}
|
||||
|
||||
$datepaid = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]);
|
||||
|
||||
@ -108,7 +113,7 @@ if ($action == 'add_payment')
|
||||
|
||||
// Create a line of payments
|
||||
$payment = new PaymentExpenseReport($db);
|
||||
$payment->chid = $chid;
|
||||
$payment->chid = $expensereport->id;
|
||||
$payment->datepaid = $datepaid;
|
||||
$payment->amounts = $amounts; // Tableau de montant
|
||||
$payment->total = $total;
|
||||
@ -121,7 +126,7 @@ if ($action == 'add_payment')
|
||||
$paymentid = $payment->create($user);
|
||||
if ($paymentid < 0)
|
||||
{
|
||||
$errmsg=$payment->error;
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -131,7 +136,7 @@ if ($action == 'add_payment')
|
||||
$result=$payment->addPaymentToBank($user,'payment_expensereport','(ExpenseReportPayment)',$accountid,'','');
|
||||
if (! $result > 0)
|
||||
{
|
||||
$errmsg=$payment->error;
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -141,7 +146,7 @@ if ($action == 'add_payment')
|
||||
if ($expensereport->total_ttc - $payment->amount == 0) {
|
||||
$result = $expensereport->set_paid($expensereport->id, $user);
|
||||
if (!$result > 0) {
|
||||
$errmsg = $payment->error;
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -151,7 +156,7 @@ if ($action == 'add_payment')
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$chid;
|
||||
$loc = DOL_URL_ROOT.'/expensereport/card.php?id='.$id;
|
||||
header('Location: '.$loc);
|
||||
exit;
|
||||
}
|
||||
@ -179,7 +184,7 @@ $form=new Form($db);
|
||||
if ($action == 'create' || empty($action))
|
||||
{
|
||||
$expensereport = new ExpenseReport($db);
|
||||
$expensereport->fetch($chid, $ref);
|
||||
$expensereport->fetch($id, $ref);
|
||||
|
||||
$total = $expensereport->total_ttc;
|
||||
|
||||
@ -187,8 +192,8 @@ if ($action == 'create' || empty($action))
|
||||
|
||||
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$chid.'">';
|
||||
print '<input type="hidden" name="chid" value="'.$chid.'">';
|
||||
print '<input type="hidden" name="id" value="'.$expensereport->id.'">';
|
||||
print '<input type="hidden" name="chid" value="'.$expensereport->id.'">';
|
||||
print '<input type="hidden" name="action" value="add_payment">';
|
||||
|
||||
dol_fiche_head(null, '0', '', -1);
|
||||
@ -208,7 +213,7 @@ if ($action == 'create' || empty($action))
|
||||
|
||||
$sql = "SELECT sum(p.amount) as total";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_expensereport as p, ".MAIN_DB_PREFIX."expensereport as e";
|
||||
$sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$chid;
|
||||
$sql.= " WHERE p.fk_expensereport = e.rowid AND p.fk_expensereport = ".$id;
|
||||
$sql.= ' AND e.entity IN ('.getEntity('expensereport').')';
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -41,6 +41,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'):'interventionlist';
|
||||
|
||||
$search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
|
||||
$search_company=GETPOST('search_company','alpha');
|
||||
@ -72,9 +73,6 @@ if (! $sortfield)
|
||||
else $sortfield="f.ref";
|
||||
}
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'interventionlist';
|
||||
|
||||
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
|
||||
$search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
|
||||
$search_company=GETPOST('search_company','alpha');
|
||||
@ -83,7 +81,8 @@ $search_status=GETPOST('search_status');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new Fichinter($db);
|
||||
$hookmanager->initHooks(array('interventionlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -484,7 +484,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
|
||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
|
||||
$sql .= " p.ref, p.label, p.tobatch";
|
||||
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
||||
$sql .= " WHERE l.fk_commande = " . $object->id;
|
||||
@ -676,9 +676,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// Warehouse
|
||||
print '<td align="right">';
|
||||
if (count($listwarehouses) > 1) {
|
||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1);
|
||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1);
|
||||
} elseif (count($listwarehouses) == 1) {
|
||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1);
|
||||
print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1);
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
print $langs->trans("ErrorNoWarehouseDefined");
|
||||
@ -736,7 +736,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// List of lines already dispatched
|
||||
$sql = "SELECT p.ref, p.label,";
|
||||
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
|
||||
$sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
|
||||
$sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p,";
|
||||
$sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||
@ -770,6 +770,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<td>' . $langs->trans("Comment") . '</td>';
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS))
|
||||
print '<td align="center" colspan="2">' . $langs->trans("Status") . '</td>';
|
||||
print '<td>' . $langs->trans("Date") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = false;
|
||||
@ -841,7 +842,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// date
|
||||
print '<td>' . dol_print_date($objp->datec) . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
|
||||
@ -53,6 +53,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'):'supplierorderlist';
|
||||
|
||||
$orderyear=GETPOST("orderyear","int");
|
||||
$ordermonth=GETPOST("ordermonth","int");
|
||||
@ -109,11 +110,9 @@ if (! $sortorder) $sortorder='DESC';
|
||||
|
||||
if ($search_status == '') $search_status=-1;
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierorderlist';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array($contextpage));
|
||||
$object = new CommandeFournisseur($db);
|
||||
$hookmanager->initHooks(array('supplierorderlist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
@ -55,6 +55,7 @@ $show_files=GETPOST('show_files','int');
|
||||
$confirm=GETPOST('confirm','alpha');
|
||||
$toselect = GETPOST('toselect', 'array');
|
||||
$optioncss = GETPOST('optioncss','alpha');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierinvoicelist';
|
||||
|
||||
$socid = GETPOST('socid','int');
|
||||
|
||||
@ -118,16 +119,12 @@ $pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="f.datef,f.rowid";
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'supplierinvoicelist';
|
||||
|
||||
$diroutputmassaction=$conf->fournisseur->facture->dir_output . '/temp/massgeneration/'.$user->id;
|
||||
|
||||
$object=new FactureFournisseur($db);
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new FactureFournisseur($db);
|
||||
$hookmanager->initHooks(array('supplierinvoicelist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
@ -271,7 +268,7 @@ $sql.= " s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql.= " country.code as country_code,";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref";
|
||||
$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
|
||||
// We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0)
|
||||
// TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field.
|
||||
if (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed';
|
||||
@ -877,7 +874,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
|
||||
// Type
|
||||
if (! empty($arrayfields['f.type']['checked']))
|
||||
{
|
||||
@ -925,6 +922,7 @@ if ($resql)
|
||||
{
|
||||
$projectstatic->id=$obj->project_id;
|
||||
$projectstatic->ref=$obj->project_ref;
|
||||
$projectstatic->title=$obj->project_label;
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -34,6 +34,7 @@ $langs->load('users');
|
||||
$langs->load('hrm');
|
||||
|
||||
$action=GETPOST('action','aZ09');
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'defineholidaylist';
|
||||
|
||||
$search_name=GETPOST('search_name', 'alpha');
|
||||
$search_supervisor=GETPOST('search_supervisor', 'int');
|
||||
@ -58,9 +59,6 @@ if ($user->societe_id > 0) accessforbidden();
|
||||
if (!$user->rights->holiday->read) accessforbidden();
|
||||
|
||||
|
||||
// Initialize technical object to manage context to save list fields
|
||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'defineholidaylist';
|
||||
|
||||
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
$hookmanager->initHooks(array('defineholidaylist'));
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -357,7 +355,7 @@ else
|
||||
print '<td>';
|
||||
if ($canedit) print '<input type="text"'.($canedit?'':' disabled="disabled"').' class="maxwidthonsmartphone" value="" name="note_holiday['.$users['rowid'].']" size="30"/>';
|
||||
print '</td>';
|
||||
|
||||
|
||||
// Button modify
|
||||
print '<td>';
|
||||
if (! empty($user->rights->holiday->define_holiday)) // Allowed to set the balance of any user
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
================================================================================
|
||||
|
||||
@ -10,7 +9,7 @@ Copyright (C) 2005 Miles Kaufmann <http://www.twmagic.com/>
|
||||
|
||||
NAME
|
||||
EvalMath - safely evaluate math expressions
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
include('evalmath.class.php');
|
||||
$m = new EvalMath;
|
||||
@ -24,9 +23,9 @@ SYNOPSIS
|
||||
$m->evaluate('f(x,y) = x^2 + y^2 - 2x*y + 1');
|
||||
// and then use them
|
||||
$result = $m->evaluate('3*f(42,a)');
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
Use the EvalMath class when you want to evaluate mathematical expressions
|
||||
Use the EvalMath class when you want to evaluate mathematical expressions
|
||||
from untrusted sources. You can define your own variables and functions,
|
||||
which are stored in the object. Try it, it's fun!
|
||||
|
||||
@ -35,13 +34,13 @@ METHODS
|
||||
Evaluates the expression and returns the result. If an error occurs,
|
||||
prints a warning and returns false. If $expr is a function assignment,
|
||||
returns true on success.
|
||||
|
||||
|
||||
$m->e($expr)
|
||||
A synonym for $m->evaluate().
|
||||
|
||||
|
||||
$m->vars()
|
||||
Returns an associative array of all user-defined variables and values.
|
||||
|
||||
|
||||
$m->funcs()
|
||||
Returns an array of all user-defined functions.
|
||||
|
||||
@ -63,7 +62,7 @@ LICENSE
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
|
||||
1 Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
@ -72,7 +71,7 @@ LICENSE
|
||||
3. The name of the author may not be used to endorse or promote
|
||||
products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
@ -86,13 +85,13 @@ LICENSE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
class EvalMath {
|
||||
|
||||
class EvalMath
|
||||
{
|
||||
var $suppress_errors = false;
|
||||
var $last_error = null;
|
||||
var $last_error_code = null;
|
||||
|
||||
var $v = array('e'=>2.71,'pi'=>3.14); // variables (and constants)
|
||||
|
||||
var $v = array('e'=>2.71,'pi'=>3.14159); // variables (and constants)
|
||||
var $f = array(); // user-defined functions
|
||||
var $vb = array('e', 'pi'); // constants
|
||||
var $fb = array( // built-in functions
|
||||
@ -100,17 +99,20 @@ class EvalMath {
|
||||
'cos','cosh','arccos','acos','arccosh','acosh',
|
||||
'tan','tanh','arctan','atan','arctanh','atanh',
|
||||
'sqrt','abs','ln','log');
|
||||
|
||||
function EvalMath() {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct() {
|
||||
// make the variables a little more accurate
|
||||
$this->v['pi'] = pi();
|
||||
$this->v['e'] = exp(1);
|
||||
}
|
||||
|
||||
|
||||
function e($expr) {
|
||||
return $this->evaluate($expr);
|
||||
}
|
||||
|
||||
|
||||
function evaluate($expr) {
|
||||
$this->last_error = null;
|
||||
$this->last_error_code = null;
|
||||
@ -134,7 +136,8 @@ class EvalMath {
|
||||
}
|
||||
$args = explode(",", preg_replace("/\s+/", "", $matches[2])); // get the arguments
|
||||
if (($stack = $this->nfx($matches[3])) === false) return false; // see if it can be converted to postfix
|
||||
for ($i = 0; $i<count($stack); $i++) { // freeze the state of the non-argument variables
|
||||
$nbstack = count($stack);
|
||||
for ($i = 0; $i < $nbstack; $i++) { // freeze the state of the non-argument variables
|
||||
$token = $stack[$i];
|
||||
if (preg_match('/^[a-z]\w*$/', $token) and !in_array($token, $args)) {
|
||||
if (array_key_exists($token, $this->v)) {
|
||||
@ -151,14 +154,14 @@ class EvalMath {
|
||||
return $this->pfx($this->nfx($expr)); // straight up evaluation, woo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function vars() {
|
||||
$output = $this->v;
|
||||
unset($output['pi']);
|
||||
unset($output['e']);
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function funcs() {
|
||||
$output = array();
|
||||
foreach ($this->f as $fnn=>$dat)
|
||||
@ -170,23 +173,23 @@ class EvalMath {
|
||||
|
||||
// Convert infix to postfix notation
|
||||
function nfx($expr) {
|
||||
|
||||
|
||||
$index = 0;
|
||||
$stack = new EvalMathStack;
|
||||
$stack = new EvalMathStack();
|
||||
$output = array(); // postfix form of expression, to be passed to pfx()
|
||||
$expr = trim(strtolower($expr));
|
||||
|
||||
|
||||
$ops = array('+', '-', '*', '/', '^', '_');
|
||||
$ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator?
|
||||
$ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator?
|
||||
$ops_p = array('+'=>0,'-'=>0,'*'=>1,'/'=>1,'_'=>1,'^'=>2); // operator precedence
|
||||
|
||||
|
||||
$expecting_op = false; // we use this in syntax-checking the expression
|
||||
// and determining when a - is a negation
|
||||
|
||||
|
||||
if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good
|
||||
return $this->trigger(4, "illegal character '{$matches[0]}'", $matches[0]);
|
||||
}
|
||||
|
||||
|
||||
while(1) { // 1 Infinite Loop ;)
|
||||
$op = substr($expr, $index, 1); // get the first character at the current index
|
||||
// find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
|
||||
@ -195,7 +198,7 @@ class EvalMath {
|
||||
if ($op == '-' and !$expecting_op) { // is it a negation instead of a minus?
|
||||
$stack->push('_'); // put a negation on the stack
|
||||
$index++;
|
||||
} elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
|
||||
} elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
|
||||
return $this->trigger(4, "illegal character '_'", "_"); // but not in the input expression
|
||||
//===============
|
||||
} elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack?
|
||||
@ -233,7 +236,7 @@ class EvalMath {
|
||||
$index++;
|
||||
//===============
|
||||
} elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
|
||||
while (($o2 = $stack->pop()) != '(') {
|
||||
while (($o2 = $stack->pop()) != '(') {
|
||||
if (is_null($o2)) return $this->trigger(5, "unexpected ','", ","); // oops, never had a (
|
||||
else $output[] = $o2; // pop the argument expression stuff and push onto the output
|
||||
}
|
||||
@ -282,11 +285,11 @@ class EvalMath {
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
|
||||
while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
|
||||
$index++; // into implicit multiplication if no operator is there)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
while (!is_null($op = $stack->pop())) { // pop everything off the stack and push onto output
|
||||
if ($op == '(') return $this->trigger(11, "expecting ')'", ")"); // if there are (s on the stack, ()s were unbalanced
|
||||
$output[] = $op;
|
||||
@ -296,11 +299,11 @@ class EvalMath {
|
||||
|
||||
// evaluate postfix notation
|
||||
function pfx($tokens, $vars = array()) {
|
||||
|
||||
|
||||
if ($tokens == false) return false;
|
||||
|
||||
$stack = new EvalMathStack;
|
||||
|
||||
|
||||
$stack = new EvalMathStack();
|
||||
|
||||
foreach ($tokens as $token) { // nice and easy
|
||||
// if the token is a binary operator, pop two values off the stack, do the operation, and push the result back on
|
||||
if (in_array($token, array('+', '-', '*', '/', '^'))) {
|
||||
@ -355,7 +358,7 @@ class EvalMath {
|
||||
if ($stack->count != 1) return $this->trigger(18, "internal error");
|
||||
return $stack->pop();
|
||||
}
|
||||
|
||||
|
||||
// trigger an error, but nicely, if need be
|
||||
function trigger($code, $msg, $info = null) {
|
||||
$this->last_error = $msg;
|
||||
@ -365,17 +368,19 @@ class EvalMath {
|
||||
}
|
||||
}
|
||||
|
||||
// for internal use
|
||||
class EvalMathStack {
|
||||
|
||||
/**
|
||||
* Class for internal use
|
||||
*/
|
||||
class EvalMathStack
|
||||
{
|
||||
var $stack = array();
|
||||
var $count = 0;
|
||||
|
||||
|
||||
function push($val) {
|
||||
$this->stack[$this->count] = $val;
|
||||
$this->count++;
|
||||
}
|
||||
|
||||
|
||||
function pop() {
|
||||
if ($this->count > 0) {
|
||||
$this->count--;
|
||||
@ -383,7 +388,7 @@ class EvalMathStack {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function last($n=1) {
|
||||
if (isset($this->stack[$this->count-$n])) {
|
||||
return $this->stack[$this->count-$n];
|
||||
|
||||
7
htdocs/includes/sabre/autoload.php
Normal file
7
htdocs/includes/sabre/autoload.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit60b9ac98a8448ede6c445b0fd4bd31e0::getLoader();
|
||||
441
htdocs/includes/sabre/composer/ClassLoader.php
Normal file
441
htdocs/includes/sabre/composer/ClassLoader.php
Normal file
@ -0,0 +1,441 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
21
htdocs/includes/sabre/composer/LICENSE
Normal file
21
htdocs/includes/sabre/composer/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) 2016 Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
9
htdocs/includes/sabre/composer/autoload_classmap.php
Normal file
9
htdocs/includes/sabre/composer/autoload_classmap.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
16
htdocs/includes/sabre/composer/autoload_files.php
Normal file
16
htdocs/includes/sabre/composer/autoload_files.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
// autoload_files.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'383eaff206634a77a1be54e64e6459c7' => $vendorDir . '/sabre/uri/lib/functions.php',
|
||||
'3569eecfeed3bcf0bad3c998a494ecb8' => $vendorDir . '/sabre/xml/lib/Deserializer/functions.php',
|
||||
'93aa591bc4ca510c520999e34229ee79' => $vendorDir . '/sabre/xml/lib/Serializer/functions.php',
|
||||
'2b9d0f43f9552984cfa82fee95491826' => $vendorDir . '/sabre/event/lib/coroutine.php',
|
||||
'd81bab31d3feb45bfe2f283ea3c8fdf7' => $vendorDir . '/sabre/event/lib/Loop/functions.php',
|
||||
'a1cce3d26cc15c00fcd0b3354bd72c88' => $vendorDir . '/sabre/event/lib/Promise/functions.php',
|
||||
'ebdb698ed4152ae445614b69b5e4bb6a' => $vendorDir . '/sabre/http/lib/functions.php',
|
||||
);
|
||||
9
htdocs/includes/sabre/composer/autoload_namespaces.php
Normal file
9
htdocs/includes/sabre/composer/autoload_namespaces.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
19
htdocs/includes/sabre/composer/autoload_psr4.php
Normal file
19
htdocs/includes/sabre/composer/autoload_psr4.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Sabre\\Xml\\' => array($vendorDir . '/sabre/xml/lib'),
|
||||
'Sabre\\VObject\\' => array($vendorDir . '/sabre/vobject/lib'),
|
||||
'Sabre\\Uri\\' => array($vendorDir . '/sabre/uri/lib'),
|
||||
'Sabre\\HTTP\\' => array($vendorDir . '/sabre/http/lib'),
|
||||
'Sabre\\Event\\' => array($vendorDir . '/sabre/event/lib'),
|
||||
'Sabre\\DAV\\' => array($vendorDir . '/sabre/dav/lib/DAV'),
|
||||
'Sabre\\DAVACL\\' => array($vendorDir . '/sabre/dav/lib/DAVACL'),
|
||||
'Sabre\\CardDAV\\' => array($vendorDir . '/sabre/dav/lib/CardDAV'),
|
||||
'Sabre\\CalDAV\\' => array($vendorDir . '/sabre/dav/lib/CalDAV'),
|
||||
'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
|
||||
);
|
||||
70
htdocs/includes/sabre/composer/autoload_real.php
Normal file
70
htdocs/includes/sabre/composer/autoload_real.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit60b9ac98a8448ede6c445b0fd4bd31e0
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit60b9ac98a8448ede6c445b0fd4bd31e0', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit60b9ac98a8448ede6c445b0fd4bd31e0', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit60b9ac98a8448ede6c445b0fd4bd31e0::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
if ($useStaticLoader) {
|
||||
$includeFiles = Composer\Autoload\ComposerStaticInit60b9ac98a8448ede6c445b0fd4bd31e0::$files;
|
||||
} else {
|
||||
$includeFiles = require __DIR__ . '/autoload_files.php';
|
||||
}
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire60b9ac98a8448ede6c445b0fd4bd31e0($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
|
||||
function composerRequire60b9ac98a8448ede6c445b0fd4bd31e0($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
require $file;
|
||||
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
}
|
||||
}
|
||||
89
htdocs/includes/sabre/composer/autoload_static.php
Normal file
89
htdocs/includes/sabre/composer/autoload_static.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit60b9ac98a8448ede6c445b0fd4bd31e0
|
||||
{
|
||||
public static $files = array (
|
||||
'383eaff206634a77a1be54e64e6459c7' => __DIR__ . '/..' . '/sabre/uri/lib/functions.php',
|
||||
'3569eecfeed3bcf0bad3c998a494ecb8' => __DIR__ . '/..' . '/sabre/xml/lib/Deserializer/functions.php',
|
||||
'93aa591bc4ca510c520999e34229ee79' => __DIR__ . '/..' . '/sabre/xml/lib/Serializer/functions.php',
|
||||
'2b9d0f43f9552984cfa82fee95491826' => __DIR__ . '/..' . '/sabre/event/lib/coroutine.php',
|
||||
'd81bab31d3feb45bfe2f283ea3c8fdf7' => __DIR__ . '/..' . '/sabre/event/lib/Loop/functions.php',
|
||||
'a1cce3d26cc15c00fcd0b3354bd72c88' => __DIR__ . '/..' . '/sabre/event/lib/Promise/functions.php',
|
||||
'ebdb698ed4152ae445614b69b5e4bb6a' => __DIR__ . '/..' . '/sabre/http/lib/functions.php',
|
||||
);
|
||||
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Sabre\\Xml\\' => 10,
|
||||
'Sabre\\VObject\\' => 14,
|
||||
'Sabre\\Uri\\' => 10,
|
||||
'Sabre\\HTTP\\' => 11,
|
||||
'Sabre\\Event\\' => 12,
|
||||
'Sabre\\DAV\\' => 10,
|
||||
'Sabre\\DAVACL\\' => 13,
|
||||
'Sabre\\CardDAV\\' => 14,
|
||||
'Sabre\\CalDAV\\' => 13,
|
||||
),
|
||||
'P' =>
|
||||
array (
|
||||
'Psr\\Log\\' => 8,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Sabre\\Xml\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/xml/lib',
|
||||
),
|
||||
'Sabre\\VObject\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/vobject/lib',
|
||||
),
|
||||
'Sabre\\Uri\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/uri/lib',
|
||||
),
|
||||
'Sabre\\HTTP\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/http/lib',
|
||||
),
|
||||
'Sabre\\Event\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/event/lib',
|
||||
),
|
||||
'Sabre\\DAV\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/dav/lib/DAV',
|
||||
),
|
||||
'Sabre\\DAVACL\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/dav/lib/DAVACL',
|
||||
),
|
||||
'Sabre\\CardDAV\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/dav/lib/CardDAV',
|
||||
),
|
||||
'Sabre\\CalDAV\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/sabre/dav/lib/CalDAV',
|
||||
),
|
||||
'Psr\\Log\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit60b9ac98a8448ede6c445b0fd4bd31e0::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit60b9ac98a8448ede6c445b0fd4bd31e0::$prefixDirsPsr4;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user