Merge remote-tracking branch 'uptream/develop' into 8.0-a11

This commit is contained in:
Alexandre SPANGARO 2018-03-27 21:45:35 +02:00
commit c012c330de
998 changed files with 143610 additions and 12552 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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');
@ -116,8 +125,8 @@ if ($action == 'validatehistory') {
$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.= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'";
$sql1.= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
$sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")";
$sql1.=")";
@ -170,30 +179,12 @@ 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>';
$buttonreset = '';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $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 +194,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,6 +258,7 @@ if ($resql) {
print "</table>\n";
print '</div>';
print '<br>';
@ -272,22 +269,27 @@ 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 +321,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 +347,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 +399,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 {

View File

@ -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
*/
@ -112,8 +122,8 @@ if ($action == 'validatehistory') {
$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.= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'";
$sql1.= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'";
$sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")";
$sql1.=")";
@ -130,6 +140,7 @@ if ($action == 'validatehistory') {
}
}
/*
* View
*/
@ -141,10 +152,6 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("ExpenseReportsVentilation") . "&nbsp;" . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
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 +172,45 @@ 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>';
$buttonreset = '';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $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 +218,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')
@ -246,22 +261,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 +288,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 +299,7 @@ if ($resql) {
}
else print length_accountg($row[0]);
print '</td>';
print '<td align="left">';
if ($row[0] == 'tobind')
{
@ -303,7 +323,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 +334,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 +359,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>';

View File

@ -164,10 +164,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);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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');
/*
@ -141,10 +151,6 @@ $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur
print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . "&nbsp;" . $langs->trans("Year") . "&nbsp;" . $year_start . "&nbsp;" . $textnextyear, '', 'title_accountancy');
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 +171,15 @@ 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>';
$buttonreset = '';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $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 +189,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";
@ -245,22 +259,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 NOT NULL";
$sql .= " GROUP BY ffd.fk_code_ventilation,aa.account_number,aa.label";
@ -286,7 +304,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 +331,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 +356,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 +364,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

View File

@ -39,7 +39,7 @@ $langs->load("members");
if (! $user->admin) accessforbidden();
$type=array('yesno','texte','chaine');
$oldtypetonewone=array('texte'=>'text','chaine'=>'string'); // old type to new ones
$action = GETPOST('action','alpha');
@ -53,20 +53,7 @@ if ($action == 'updateall')
{
$db->begin();
$res1=$res2=$res3=$res4=$res5=$res6=0;
$res1=dolibarr_set_const($db, 'ADHERENT_LOGIN_NOT_REQUIRED', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res2=dolibarr_set_const($db, 'ADHERENT_MAIL_REQUIRED', GETPOST('ADHERENT_MAIL_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
$res3=dolibarr_set_const($db, 'ADHERENT_DEFAULT_SENDINFOBYMAIL', GETPOST('ADHERENT_DEFAULT_SENDINFOBYMAIL', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4=dolibarr_set_const($db, 'ADHERENT_BANK_USE', GETPOST('ADHERENT_BANK_USE', 'alpha'), 'chaine', 0, '', $conf->entity);
// Use vat for invoice creation
if ($conf->facture->enabled)
{
$res4=dolibarr_set_const($db, 'ADHERENT_VAT_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_VAT_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
$res5=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{
$res6=dolibarr_set_const($db, 'ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', GETPOST('ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS', 'alpha'), 'chaine', 0, '', $conf->entity);
}
}
$res1=dolibarr_set_const($db, 'XXXX', GETPOST('ADHERENT_LOGIN_NOT_REQUIRED', 'alpha'), 'chaine', 0, '', $conf->entity);
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0)
{
setEventMessages('ErrorFailedToSaveDate', null, 'errors');
@ -82,19 +69,16 @@ if ($action == 'updateall')
// Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add')
{
$constlineid = GETPOST('rowid','int');
$constname=GETPOST('constname','alpha');
$constvalue=(GETPOST('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname) : GETPOST('constvalue'));
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE' || $constname=='ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS') && $constvalue == -1) $constvalue='';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{
if ($constvalue) $constvalue=0;
else $constvalue=1;
}
$constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue'));
$consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype'));
$constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote'));
$consttype=GETPOST('consttype','alpha');
$constnote=GETPOST('constnote');
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
$typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype];
$res=dolibarr_set_const($db,$constname, $constvalue, $typetouse, 0, $constnote, $conf->entity);
if (! $res > 0) $error++;
@ -111,7 +95,7 @@ if ($action == 'update' || $action == 'add')
// Action activation d'un sous module du module adherent
if ($action == 'set')
{
$result=dolibarr_set_const($db, GETPOST('name','alpha'),GETPOST('value'),'',0,'',$conf->entity);
$result=dolibarr_set_const($db, GETPOST('name','alpha'), GETPOST('value'), '', 0, '', $conf->entity);
if ($result < 0)
{
print $db->error();
@ -157,23 +141,15 @@ print '<input type="hidden" name="action" value="updateall">';
* Editing global variables not related to a specific theme
*/
$constantes=array(
'ADHERENT_MAIL_FROM',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL',
'ADHERENT_AUTOREGISTER_MAIL_SUBJECT',
'ADHERENT_AUTOREGISTER_MAIL',
'ADHERENT_MAIL_VALID_SUBJECT',
'ADHERENT_MAIL_VALID',
'ADHERENT_MAIL_COTIS_SUBJECT',
'ADHERENT_MAIL_COTIS',
'ADHERENT_MAIL_RESIL_SUBJECT',
'ADHERENT_MAIL_RESIL',
);
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
$helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__, __BIRTH__, __PHOTO__, __TYPE__, ';
$helptext.='__YEAR__, __MONTH__, __DAY__';
'ADHERENT_MAIL_FROM'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
);
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';

View File

@ -238,21 +238,6 @@ if (empty($reshook))
}
}
/*
if ($action == 'confirm_sendinfo' && $confirm == 'yes')
{
if ($object->email)
{
$from=$conf->email_from;
if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM;
$result=$object->send_an_email($langs->transnoentitiesnoconv("ThisIsContentOfYourCard")."\n\n%INFOS%\n\n",$langs->transnoentitiesnoconv("CardContent"));
$langs->load("mails");
setEventMessages($langs->trans("MailSuccessfulySent", $from, $object->email), null, 'mesgs');
}
}*/
if ($action == 'update' && ! $cancel && $user->rights->adherent->creer)
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -630,7 +615,34 @@ if (empty($reshook))
// Send confirmation email (according to parameters of member type. Otherwise generic)
if ($object->email && GETPOST("send_mail"))
{
$result=$object->send_an_email($adht->getMailOnValid(),$conf->global->ADHERENT_MAIL_VALID_SUBJECT,array(),array(),array(),"","",0,2);
$subject = '';
$msg= '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2);
if ($result < 0)
{
$error++;
@ -674,7 +686,34 @@ if (empty($reshook))
{
if ($object->email && GETPOST("send_mail"))
{
$result=$object->send_an_email($adht->getMailOnResiliate(),$conf->global->ADHERENT_MAIL_RESIL_SUBJECT,array(),array(),array(),"","",0,-1);
$subject = '';
$msg= '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1);
}
if ($result < 0)
{
@ -1339,7 +1378,7 @@ else
array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"')
);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id,$langs->trans("CreateDolibarrThirdParty"),$langs->trans("ConfirmCreateThirdParty"),"confirm_create_thirdparty",$formquestion,1);
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrThirdParty"), $langs->trans("ConfirmCreateThirdParty"), "confirm_create_thirdparty", $formquestion, 'yes');
}
// Confirm validate member
@ -1350,10 +1389,34 @@ else
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_VALID_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnValid());
$subject = '';
$msg= '';
$tmp=$langs->trans("SendAnEMailToMember");
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$tmp=$langs->trans("SendingAnEMailToMember");
$tmp.='<br>'.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.='<br>'.$langs->trans("MailRecipient").': <b>'.$object->email.'</b>';
$helpcontent='';
@ -1375,15 +1438,9 @@ else
if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) {
$formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>'');
}
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ValidateMember"),$langs->trans("ConfirmValidateMember"),"confirm_valid",$formquestion,1,1);
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220);
}
// Confirm send card by mail
/*if ($action == 'sendinfo')
{
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
}*/
// Confirm terminate
if ($action == 'resign')
{
@ -1392,10 +1449,34 @@ else
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_RESIL_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnResiliate());
$subject = '';
$msg= '';
$tmp=$langs->trans("SendAnEMailToMember");
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs);
$tmp=$langs->trans("SendingAnEMailToMember");
$tmp.='<br>('.$langs->trans("MailFrom").': <b>'.$conf->global->ADHERENT_MAIL_FROM.'</b>, ';
$tmp.=$langs->trans("MailRecipient").': <b>'.$object->email.'</b>)';
$helpcontent='';
@ -1412,7 +1493,7 @@ else
$formquestion=array();
if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false'));
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("ResiliateMember"),$langs->trans("ConfirmResiliateMember"),"confirm_resign",$formquestion,'no',1);
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 220);
}
// Confirm remove member
@ -1420,7 +1501,7 @@ else
{
$formquestion=array();
if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"]));
print $form->formconfirm("card.php?rowid=".$id,$langs->trans("DeleteMember"),$langs->trans("ConfirmDeleteMember"),"confirm_delete",$formquestion,0,1);
print $form->formconfirm("card.php?rowid=".$id, $langs->trans("DeleteMember"), $langs->trans("ConfirmDeleteMember"), "confirm_delete", $formquestion, 'no', 1);
}
// Confirm add in spip
@ -1623,7 +1704,7 @@ else
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
if (empty($reshook)) {
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
if ($action != 'editlogin' && $action != 'editthirdparty')
{
// Send
if ($object->statut == 1) {

View File

@ -147,9 +147,11 @@ class Adherent extends CommonObject
if ($msgishtml == -1)
{
$msgishtml = 0;
if (dol_textishtml($text,1)) $msgishtml = 1;
if (dol_textishtml($text,0)) $msgishtml = 1;
}
dol_syslog('send_an_email msgishtml='.$msgishtml);
$texttosend=$this->makeSubstitution($text);
$subjecttosend=$this->makeSubstitution($subject);
if ($msgishtml) $texttosend=dol_htmlentitiesbr($texttosend);
@ -1331,7 +1333,7 @@ class Adherent extends CommonObject
* Do complementary actions after subscription recording.
*
* @param int $subscriptionid Id of created subscription
* @param string $option Which action ('bankdirect', 'invoiceonly', ...)
* @param string $option Which action ('bankdirect', 'bankviainvoice', 'invoiceonly', ...)
* @param int $accountid Id bank account
* @param int $datesubscription Date of subscription
* @param int $paymentdate Date of payment
@ -1341,7 +1343,7 @@ class Adherent extends CommonObject
* @param string $num_chq Numero cheque (if Id bank account provided)
* @param string $emetteur_nom Name of cheque writer
* @param string $emetteur_banque Name of bank of cheque
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty.
* @param string $autocreatethirdparty Auto create new thirdparty if member not linked to a thirdparty and we request an option that generate invoice.
* @return int <0 if KO, >0 if OK
*/
function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0)
@ -1352,6 +1354,8 @@ class Adherent extends CommonObject
$this->invoice = null; // This will contains invoice if an invoice is created
dol_syslog("subscriptionComplementaryActions subscriptionid=".$subscriptionid." option=".$option." accountid=".$accountid." datesubscription=".$datesubscription." paymentdate=".$paymentdate." label=".$label." amount=".$amount." num_chq=".$num_chq." autocreatethirdparty=".$autocreatethirdparty);
// Insert into bank account directlty (if option choosed for) + link to llx_subscription if option is 'bankdirect'
if ($option == 'bankdirect' && $accountid)
{
@ -1407,7 +1411,7 @@ class Adherent extends CommonObject
if (! $error)
{
if (! ($this->fk_soc > 0))
if (! ($this->fk_soc > 0)) // If not yet linked to a company
{
if ($autocreatethirdparty)
{
@ -1668,6 +1672,8 @@ class Adherent extends CommonObject
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
$this->datevalid = $now;
$this->db->commit();
return 1;
}
@ -1892,6 +1898,8 @@ class Adherent extends CommonObject
$label.= '<br><b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->firstname) || ! empty($this->lastname))
$label.= '<br><b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs);
if (! empty($this->societe))
$label.= '<br><b>' . $langs->trans('Company') . ':</b> ' . $this->societe;
$label.='</div>';
$url = DOL_URL_ROOT.'/adherents/card.php?rowid='.$this->id;
@ -2494,7 +2502,6 @@ class Adherent extends CommonObject
/**
* Send reminders by emails before subscription end
* CAN BE A CRON TASK
@ -2506,6 +2513,7 @@ class Adherent extends CommonObject
{
global $conf, $langs, $mysoc, $user;
$error = 0;
$this->output = '';
$this->error='';
@ -2555,16 +2563,16 @@ class Adherent extends CommonObject
$adherent->fetch_thirdparty();
// Send reminder email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
$arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, '(SendReminderForExpiredSubscriptionTitle)');
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION;
if (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($this->db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $adherent);
//if (is_array($adherent->thirdparty)) $substitutionarraycomp = ...
@ -2575,6 +2583,7 @@ class Adherent extends CommonObject
$from = $conf->global->ADHERENT_MAIL_FROM;
$to = $adherent->email;
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
$result = $cmail->sendfile();
if (! $result)
@ -2591,7 +2600,7 @@ class Adherent extends CommonObject
}
else
{
$blockingerrormsg="Can't find email template '(SendReminderForExpiredSubscriptionTitle)'";
$blockingerrormsg="Can't find email template, defined into member module setup, to use for reminding";
$nbko++;
break;
}

View File

@ -499,7 +499,7 @@ class AdherentType extends CommonObject
/**
* getMailOnValid
*
* @return string Return mail model
* @return string Return mail content of type or empty
*/
function getMailOnValid()
{
@ -509,16 +509,14 @@ class AdherentType extends CommonObject
{
return $this->mail_valid;
}
else
{
return $conf->global->ADHERENT_MAIL_VALID;
}
return '';
}
/**
* getMailOnSubscription
*
* @return string Return mail model
* @return string Return mail content of type or empty
*/
function getMailOnSubscription()
{
@ -529,16 +527,14 @@ class AdherentType extends CommonObject
{
return $this->mail_subscription;
}
else
{
return $conf->global->ADHERENT_MAIL_COTIS;
}
return '';
}
/**
* getMailOnResiliate
*
* @return string Return mail model
* @return string Return mail model content of type or empty
*/
function getMailOnResiliate()
{
@ -549,10 +545,8 @@ class AdherentType extends CommonObject
{
return $this->mail_resiliate;
}
else
{
return $conf->global->ADHERENT_MAIL_RESIL;
}
return '';
}
}

View File

@ -593,7 +593,6 @@ while ($i < min($num, $limit))
$memberstatic->ref=$obj->rowid;
$memberstatic->lastname=$obj->lastname;
$memberstatic->firstname=$obj->firstname;
$memberstatic->societe=$obj->company;
$memberstatic->statut=$obj->statut;
$memberstatic->datefin= $datefin;
$memberstatic->socid = $obj->fk_soc;
@ -605,6 +604,7 @@ while ($i < min($num, $limit))
} else {
$companyname=$obj->company;
}
$memberstatic->societe = $companyname;
print '<tr class="oddeven">';

View File

@ -349,8 +349,32 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && !
// Send confirmation Email
if ($object->email && $sendalsoemail)
{
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
$subject = '';
$msg= '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
// Attach a file ?
$file='';
@ -1018,8 +1042,33 @@ if ($rowid > 0)
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
$subjecttosend=$object->makeSubstitution($conf->global->ADHERENT_MAIL_COTIS_SUBJECT);
$texttosend=$object->makeSubstitution($adht->getMailOnSubscription());
// Send subscription email
$subject = '';
$msg= '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
$outputlangs->loadLangs(array("main", "members"));
// Get email content fro mtemplae
$arraydefaultmessage=null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION;
if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
{
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnSubscription()), $substitutionarray, $outputlangs);
$tmp='<input name="sendmail" type="checkbox"'.(GETPOST('sendmail','alpha')?' checked':(! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?' checked':'')).'>';
$helpcontent='';

View File

@ -91,17 +91,17 @@ $tabsqlsort[25]="label ASC, lang ASC, position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[25]= "label,type_template,lang,fk_user,private,position,topic,joinfiles,content";
$tabfield[25]= "label,lang,type_template,fk_user,private,position,topic,joinfiles,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
$tabfieldvalue[25]= "label,lang,type_template,fk_user,private,position,topic,joinfiles,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[25]= "label,type_template,fk_user,lang,private,position,topic,joinfiles,content";
$tabfieldinsert[25]= "label,lang,type_template,fk_user,private,position,topic,joinfiles,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
@ -233,8 +233,7 @@ if (empty($reshook))
$ok=0;
$fieldnamekey=$listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Code';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'type_template') $fieldnamekey = 'TypeOfTemplate';
@ -478,7 +477,7 @@ foreach ($fieldlist as $field => $value)
if ($fieldlist[$field]=='lang') { $valuetoshow=(empty($conf->global->MAIN_MULTILANGS) ? '&nbsp;' : $langs->trans("Language")); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; }
@ -695,7 +694,7 @@ if ($resql)
if ($fieldlist[$field]=='fk_user') { $valuetoshow=$langs->trans("Owner"); }
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='private') { $align='center'; }
if ($fieldlist[$field]=='position') { $align='center'; }
@ -990,7 +989,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
$selectedlang = $langs->defaultlang;
if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]};
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1);
print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150');
}
else
{

View File

@ -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">&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
print '<tr class="oddeven"><td class="titlefield">&nbsp;</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();

View File

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

View File

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

View File

@ -1654,7 +1654,8 @@ class ActionComm extends CommonObject
{
global $conf, $langs;
$this->output = '';
$error = 0;
$this->output = '';
$this->error='';
if (empty($conf->global->AGENDA_REMINDER_EMAIL))
@ -1668,6 +1669,8 @@ class ActionComm extends CommonObject
dol_syslog(__METHOD__, LOG_DEBUG);
$this->db->begin();
// TODO Scan events of type 'email' into table llx_actioncomm_reminder with status todo, send email, then set status to done
@ -1676,7 +1679,9 @@ class ActionComm extends CommonObject
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder WHERE dateremind < '".$this->db->jdate($now - (3600 * 24 * 32))."'";
$this->db->query($sql);
return 0;
$this->db->commit();
return $error;
}
}

View File

@ -660,8 +660,6 @@ if ($object->id > 0)
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$propal_static = new Propal($db);
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
$sql.= ", p.tva as total_tva";
$sql.= ", p.total as total_ttc";
@ -676,9 +674,9 @@ if ($object->id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$num = $db->num_rows($resql);
$propal_static = new Propal($db);
$num = $db->num_rows($resql);
if ($num > 0)
{
print '<table class="noborder" width="100%">';
@ -727,8 +725,6 @@ if ($object->id > 0)
*/
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$commande_static=new Commande($db);
$sql = "SELECT s.nom, s.rowid";
$sql.= ", c.rowid as cid, c.total_ht";
$sql.= ", c.tva as total_tva";
@ -744,9 +740,9 @@ if ($object->id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$num = $db->num_rows($resql);
$commande_static=new Commande($db);
$num = $db->num_rows($resql);
if ($num > 0)
{
// Check if there are orders billable
@ -808,9 +804,8 @@ if ($object->id > 0)
/*
* Last shipments
*/
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
$sendingstatic = new Expedition($db);
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire)
{
$sql = 'SELECT e.rowid as id';
$sql.= ', e.ref';
$sql.= ', e.date_creation';
@ -829,10 +824,11 @@ if ($object->id > 0)
$sql.= " ORDER BY e.date_creation DESC";
$resql = $db->query($sql);
if ($resql) {
$var = true;
$num = $db->num_rows($resql);
$i = 0;
if ($resql)
{
$sendingstatic = new Expedition($db);
$num = $db->num_rows($resql);
if ($num > 0) {
print '<table class="noborder" width="100%">';
@ -843,12 +839,16 @@ if ($object->id > 0)
print '</tr>';
}
while ($i < $num && $i < $MAXLIST) {
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$sendingstatic->id = $objp->id;
$sendingstatic->ref = $objp->ref;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $sendingstatic->getNomUrl(1);
print '</td>';
if ($objp->date_creation > 0) {
@ -875,9 +875,7 @@ if ($object->id > 0)
*/
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$contratstatic=new Contrat($db);
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_supplier as refsup";
$sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
$sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND s.rowid = ".$object->id;
@ -887,9 +885,10 @@ if ($object->id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$contrat=new Contrat($db);
$num = $db->num_rows($resql);
if ($num >0 )
if ($num >0)
{
print '<table class="noborder" width="100%">';
@ -900,17 +899,19 @@ if ($object->id > 0)
print '</tr></table></td>';
print '</tr>';
}
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
$contrat=new Contrat($db);
$objp = $db->fetch_object($resql);
$contrat->id=$objp->id;
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
$contrat->ref_customer=$objp->refcus;
$contrat->ref_supplier=$objp->refsup;
print '<tr class="oddeven">';
print '<td class="nowrap">';
$contrat->id=$objp->id;
$contrat->ref=$objp->ref?$objp->ref:$objp->id;
print $contrat->getNomUrl(1,12);
print "</td>\n";
print '<td class="nowrap">'.dol_trunc($objp->refsup,12)."</td>\n";
@ -946,12 +947,11 @@ if ($object->id > 0)
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " ORDER BY f.tms DESC";
$fichinter_static=new Fichinter($db);
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$fichinter_static=new Fichinter($db);
$num = $db->num_rows($resql);
if ($num > 0)
{
@ -962,8 +962,8 @@ if ($object->id > 0)
print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
print '</tr></table></td>';
print '</tr>';
}
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
@ -996,8 +996,6 @@ if ($object->id > 0)
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$invoicetemplate = new FactureRec($db);
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
@ -1020,9 +1018,9 @@ if ($object->id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$invoicetemplate = new FactureRec($db);
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<table class="noborder" width="100%">';
@ -1033,12 +1031,11 @@ if ($object->id > 0)
print '</tr>';
}
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$invoicetemplate->id = $objp->id;
$invoicetemplate->ref = $objp->ref;
$invoicetemplate->suspended = $objp->suspended;
@ -1047,6 +1044,9 @@ if ($object->id > 0)
$invoicetemplate->total_ht = $objp->total_ht;
$invoicetemplate->total_tva = $objp->total_tva;
$invoicetemplate->total_ttc = $objp->total_ttc;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $invoicetemplate->getNomUrl(1);
print '</td>';
if ($objp->frequency && $objp->date_last_gen > 0)
@ -1097,8 +1097,6 @@ if ($object->id > 0)
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$facturestatic = new Facture($db);
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
@ -1118,9 +1116,9 @@ if ($object->id > 0)
$resql=$db->query($sql);
if ($resql)
{
$var=true;
$facturestatic = new Facture($db);
$num = $db->num_rows($resql);
$i = 0;
if ($num > 0)
{
print '<table class="noborder" width="100%">';
@ -1132,18 +1130,20 @@ if ($object->id > 0)
print '</tr>';
}
$i = 0;
while ($i < $num && $i < $MAXLIST)
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td class="nowrap">';
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
print '<tr class="oddeven">';
print '<td class="nowrap">';
print $facturestatic->getNomUrl(1);
print '</td>';
if ($objp->df > 0)

View File

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

View File

@ -531,7 +531,7 @@ class Paiement extends CommonObject
{
if ($accountid <= 0)
{
$this->error='Bad value for parameter accountid';
$this->error='Bad value for parameter accountid='.$accountid;
dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR);
return -1;
}

View File

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

View File

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

View File

@ -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,6 +195,7 @@ 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');
@ -230,60 +204,63 @@ $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="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">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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>&nbsp;</td>';
print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0)
{
print '<td class="nowrap" align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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).'">&nbsp;</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>&nbsp;</td>';
print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0)
{
print '<td class="nowrap" align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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>&nbsp;</td>';
print '<td align="right">'.$langs->trans("Total").':</td>';
if ($modetax == 0)
{
print '<td class="nowrap" align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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();

View File

@ -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">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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).'">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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">&nbsp;</td>';
print '<td align="right">&nbsp;</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();

View File

@ -205,8 +205,6 @@ $formother = new FormOther($db);
$socstatic = new Societe($db);
$contracttmp = new Contrat($db);
llxHeader('', $langs->trans("Contracts"));
$sql = 'SELECT';
$sql.= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public,";
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
@ -309,489 +307,504 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->plimit($limit + 1, $offset);
$resql=$db->query($sql);
if ($resql)
if (! $resql)
{
$num = $db->num_rows($resql);
$i = 0;
dol_print_error($db);
exit;
}
$arrayofselected=is_array($toselect)?$toselect:array();
$num = $db->num_rows($resql);
if ($socid > 0)
// Direct jump if only one record found
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
{
$obj = $db->fetch_object($resql);
$id = $obj->rowid;
header("Location: ".DOL_URL_ROOT.'/contrat/card.php?id='.$id);
exit;
}
// Output page
// --------------------------------------------------------------------
llxHeader('', $langs->trans("Contracts"));
$i = 0;
$arrayofselected=is_array($toselect)?$toselect:array();
if ($socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_name)) $search_name = $soc->name;
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.urlencode($sall);
if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract);
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
if ($search_op2df != '') $param.='&search_op2df='.urlencode($search_op2df);
if ($search_dfyear != '') $param.='&search_dfyear='.urlencode($search_dfyear);
if ($search_dfmonth != '') $param.='&search_dfmonth='.urlencode($search_dfmonth);
if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
if ($search_user != '') $param.='&search_user=' .urlencode($search_user);
if ($search_product_category != '') $param.='&search_product_category=' .urlencode($search_product_category);
if ($show_files) $param.='&show_files=' .urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
$topicmail="SendContractRef";
$modelmail="contract";
$objecttmp=new Contrat($db);
$trackid='con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter='';
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user,0,1,'maxwidth200');
$moreforfilter.='</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire)
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>';
}
// If the user can view categories of products
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>';
}
if (! empty($arrayfields['c.ref_customer']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).'">';
print '</td>';
}
if (! empty($arrayfields['c.ref_supplier']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
}
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
}
if (! empty($arrayfields['s.email']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
print '</td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '</td>';
}
// Company type
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '</td>';
}
if (! empty($arrayfields['sale_representative']['checked']))
{
print '<td class="liste_titre"></td>';
}
if (! empty($arrayfields['c.date_contrat']['checked']))
{
// Date contract
print '<td class="liste_titre center nowraponall">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$syear = $year;
print $formother->selectyear($syear,'year',1, 20, 5, 0, 0, '', 'widthauto');
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['c.datec']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Date modification
if (! empty($arrayfields['c.tms']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// First end date
if (! empty($arrayfields['lower_planned_end_date']['checked']))
{
print '<td class="liste_titre" align="center">';
$arrayofoperators=array('0'=>'','='=>'=','<='=>'<=','>='=>'>=');
print $form->selectarray('search_op2df',$arrayofoperators,$search_op2df,0);
print '</br>';
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1);
print ' ';
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5);
print '</td>';
}
// Status
if (! empty($arrayfields['status']['checked']))
{
print '<td class="liste_titre" colspan="4" align="right"></td>';
}
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['lower_planned_end_date']['checked'])) print_liste_field_titre($arrayfields['lower_planned_end_date']['label'],$_SERVER["PHP_SELF"],"lower_planned_end_date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['status']['checked']))
{
print_liste_field_titre($staticcontratligne->LibStatut(0,3), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(4,3,0), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(4,3,1), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(5,3), '', '', '', '', 'width="16"');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
$contracttmp->ref=$obj->ref;
$contracttmp->id=$obj->rowid;
$contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier;
if ($obj->socid > 0)
{
$soc = new Societe($db);
$soc->fetch($socid);
if (empty($search_name)) $search_name = $soc->name;
$result=$socstatic->fetch($obj->socid);
}
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($sall != '') $param.='&sall='.urlencode($sall);
if ($search_contract != '') $param.='&search_contract='.urlencode($search_contract);
if ($search_name != '') $param.='&search_name='.urlencode($search_name);
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
if ($search_ref_customer != '') $param.='&search_ref_customer='.urlencode($search_ref_customer);
if ($search_ref_supplier != '') $param.='&search_ref_supplier='.urlencode($search_ref_supplier);
if ($search_op2df != '') $param.='&search_op2df='.urlencode($search_op2df);
if ($search_dfyear != '') $param.='&search_dfyear='.urlencode($search_dfyear);
if ($search_dfmonth != '') $param.='&search_dfmonth='.urlencode($search_dfmonth);
if ($search_sale != '') $param.='&search_sale=' .urlencode($search_sale);
if ($search_user != '') $param.='&search_user=' .urlencode($search_user);
if ($search_product_category != '') $param.='&search_product_category=' .urlencode($search_product_category);
if ($show_files) $param.='&show_files=' .urlencode($show_files);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// List of mass actions available
$arrayofmassactions = array(
'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge"),
);
if ($user->rights->contrat->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete");
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'title_commercial.png', 0, '', '', $limit);
$topicmail="SendContractRef";
$modelmail="contract";
$objecttmp=new Contrat($db);
$trackid='con'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall);
}
$moreforfilter='';
// If the user can view prospects other than his'
if ($user->rights->societe->client->voir || $socid)
{
$langs->load("commercial");
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user,0,1,'maxwidth200');
$moreforfilter.='</div>';
}
// If the user can view other users
if ($user->rights->user->user->lire)
{
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
$moreforfilter.=$form->select_dolusers($search_user, 'search_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
$moreforfilter.='</div>';
}
// If the user can view categories of products
if ($conf->categorie->enabled && ($user->rights->produit->lire || $user->rights->service->lire))
{
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.=$langs->trans('IncludingProductWithTag'). ': ';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
$moreforfilter.=$form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter.='</div>';
}
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
else $moreforfilter = $hookmanager->resPrint;
if (! empty($moreforfilter))
{
print '<div class="liste_titre liste_titre_bydiv centpercent">';
print $moreforfilter;
print '</div>';
}
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1);
print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
print '<tr class="oddeven">';
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '<td class="nowrap">';
print $contracttmp->getNomUrl(1);
if ($obj->nb_late) print img_warning($langs->trans("Late"));
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->contrat->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
print '</td>';
}
if (! empty($arrayfields['c.ref_customer']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).'">';
print '</td>';
print '<td>'.$obj->ref_customer.'</td>';
}
if (! empty($arrayfields['c.ref_supplier']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_ref_supplier" value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td>'.$obj->ref_supplier.'</td>';
}
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="8" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '<td>';
//print '<a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a>';
if ($obj->socid > 0)
{
print $socstatic->getNomUrl(1, '');
}
print '</td>';
}
if (! empty($arrayfields['s.email']['checked']))
{
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="6" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
print '</td>';
print '<td>'.$obj->email.'</td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
if (! empty($arrayfields['s.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
if (! empty($arrayfields['s.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
print '</td>';
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Company type
// Type ent
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT));
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['sale_representative']['checked']))
{
print '<td class="liste_titre"></td>';
}
if (! empty($arrayfields['c.date_contrat']['checked']))
{
// Date contract
print '<td class="liste_titre center nowraponall">';
//print $langs->trans('Month').': ';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="day" value="'.$day.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
//print '&nbsp;'.$langs->trans('Year').': ';
$syear = $year;
print $formother->selectyear($syear,'year',1, 20, 5, 0, 0, '', 'widthauto');
// Sales representatives
print '<td>';
if ($obj->socid > 0)
{
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
print $nbofsalesrepresentative;
print '</a>';
}
else if ($nbofsalesrepresentative > 0)
{
$userstatic=new User($db);
$j=0;
foreach($listsalesrepresentatives as $val)
{
$userstatic->id=$val['id'];
$userstatic->lastname=$val['lastname'];
$userstatic->firstname=$val['firstname'];
$userstatic->email=$val['email'];
$userstatic->statut=$val['statut'];
$userstatic->entity=$val['entity'];
$userstatic->photo=$val['photo'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
//print '</div>';
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
}
else
{
print '&nbsp';
}
print '</td>';
}
// Date
if (! empty($arrayfields['c.date_contrat']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzuser').'</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['c.datec']['checked']))
{
print '<td class="liste_titre">';
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['c.tms']['checked']))
{
print '<td class="liste_titre">';
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// First end date
// Date lower end date
if (! empty($arrayfields['lower_planned_end_date']['checked']))
{
print '<td class="liste_titre" align="center">';
$arrayofoperators=array('0'=>'','='=>'=','<='=>'<=','>='=>'>=');
print $form->selectarray('search_op2df',$arrayofoperators,$search_op2df,0);
print '</br>';
print $formother->select_month($search_dfmonth, 'search_dfmonth', 1);
print ' ';
$formother->select_year($search_dfyear, 'search_dfyear', 1, 20, 5);
print '</td>';
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['status']['checked']))
{
print '<td class="liste_titre" colspan="4" align="right"></td>';
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
print '<td align="center">'.($obj->nb_expired>0?$obj->nb_expired:'').'</td>';
print '<td align="center">'.($obj->nb_closed>0 ?$obj->nb_closed:'').'</td>';
}
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '<td class="liste_titre" align="middle">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['c.ref']['checked'])) print_liste_field_titre($arrayfields['c.ref']['label'], $_SERVER["PHP_SELF"], "c.ref","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_customer']['checked'])) print_liste_field_titre($arrayfields['c.ref_customer']['label'], $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['c.ref_supplier']['label'], $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],'s.town','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],'s.zip','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
if (! empty($arrayfields['c.date_contrat']['checked'])) print_liste_field_titre($arrayfields['c.date_contrat']['label'], $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'],$_SERVER["PHP_SELF"],"c.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['lower_planned_end_date']['checked'])) print_liste_field_titre($arrayfields['lower_planned_end_date']['label'],$_SERVER["PHP_SELF"],"lower_planned_end_date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['status']['checked']))
{
print_liste_field_titre($staticcontratligne->LibStatut(0,3), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(4,3,0), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(4,3,1), '', '', '', '', 'width="16"');
print_liste_field_titre($staticcontratligne->LibStatut(5,3), '', '', '', '', 'width="16"');
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($resql);
$contracttmp->ref=$obj->ref;
$contracttmp->id=$obj->rowid;
$contracttmp->ref_customer=$obj->ref_customer;
$contracttmp->ref_supplier=$obj->ref_supplier;
if ($obj->socid > 0)
{
$result=$socstatic->fetch($obj->socid);
}
print '<tr class="oddeven">';
if (! empty($arrayfields['c.ref']['checked']))
{
print '<td class="nowrap">';
print $contracttmp->getNomUrl(1);
if ($obj->nb_late) print img_warning($langs->trans("Late"));
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/contrat/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->contrat->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
print $formfile->getDocumentsLink($contracttmp->element, $filename, $filedir);
print '</td>';
print '</td>';
}
if (! empty($arrayfields['c.ref_customer']['checked']))
{
print '<td>'.$obj->ref_customer.'</td>';
}
if (! empty($arrayfields['c.ref_supplier']['checked']))
{
print '<td>'.$obj->ref_supplier.'</td>';
}
if (! empty($arrayfields['s.nom']['checked']))
{
print '<td>';
//print '<a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a>';
if ($obj->socid > 0)
{
print $socstatic->getNomUrl(1, '');
}
print '</td>';
}
if (! empty($arrayfields['s.email']['checked']))
{
print '<td>'.$obj->email.'</td>';
}
// Town
if (! empty($arrayfields['s.town']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->town;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Zip
if (! empty($arrayfields['s.zip']['checked']))
{
print '<td class="nocellnopadd">';
print $obj->zip;
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// State
if (! empty($arrayfields['state.nom']['checked']))
{
print "<td>".$obj->state_name."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Country
if (! empty($arrayfields['country.code_iso']['checked']))
{
print '<td align="center">';
$tmparray=getCountry($obj->fk_pays,'all');
print $tmparray['label'];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Type ent
if (! empty($arrayfields['typent.code']['checked']))
{
print '<td align="center">';
if (count($typenArray)==0) $typenArray = $formcompany->typent_array(1);
print $typenArray[$obj->typent_code];
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['sale_representative']['checked']))
{
// Sales representatives
print '<td>';
if ($obj->socid > 0)
{
$listsalesrepresentatives=$socstatic->getSalesRepresentatives($user);
if ($listsalesrepresentatives < 0) dol_print_error($db);
$nbofsalesrepresentative=count($listsalesrepresentatives);
if ($nbofsalesrepresentative > 3) // We print only number
{
print '<a href="'.DOL_URL_ROOT.'/societe/commerciaux.php?socid='.$socstatic->id.'">';
print $nbofsalesrepresentative;
print '</a>';
}
else if ($nbofsalesrepresentative > 0)
{
$userstatic=new User($db);
$j=0;
foreach($listsalesrepresentatives as $val)
{
$userstatic->id=$val['id'];
$userstatic->lastname=$val['lastname'];
$userstatic->firstname=$val['firstname'];
$userstatic->email=$val['email'];
$userstatic->statut=$val['statut'];
$userstatic->entity=$val['entity'];
$userstatic->photo=$val['photo'];
//print '<div class="float">':
print $userstatic->getNomUrl(-2);
$j++;
if ($j < $nbofsalesrepresentative) print ' ';
//print '</div>';
}
}
//else print $langs->trans("NoSalesRepresentativeAffected");
}
else
{
print '&nbsp';
}
print '</td>';
}
// Date
if (! empty($arrayfields['c.date_contrat']['checked']))
{
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat), 'day', 'tzuser').'</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
$reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Date creation
if (! empty($arrayfields['c.datec']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date modification
if (! empty($arrayfields['c.tms']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Date lower end date
if (! empty($arrayfields['lower_planned_end_date']['checked']))
{
print '<td align="center" class="nowrap">';
print dol_print_date($db->jdate($obj->lower_planned_end_date), 'day', 'tzuser');
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Status
if (! empty($arrayfields['status']['checked']))
{
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';
print '<td align="center">'.($obj->nb_running>0?$obj->nb_running:'').'</td>';
print '<td align="center">'.($obj->nb_expired>0?$obj->nb_expired:'').'</td>';
print '<td align="center">'.($obj->nb_closed>0 ?$obj->nb_closed:'').'</td>';
}
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
print "</tr>\n";
$i++;
}
$db->free($resql);
print '</table>';
print '</div>';
print '</form>';
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->contrat->lire;
$delallowed=$user->rights->contrat->lire;
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
}
else
{
dol_print_error($db);
$i++;
}
$db->free($resql);
print '</table>';
print '</div>';
print '</form>';
$hidegeneratedfilelistifempty=1;
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty=0;
// Show list of available documents
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
$urlsource.=str_replace('&amp;','&',$param);
$filedir=$diroutputmassaction;
$genallowed=$user->rights->contrat->lire;
$delallowed=$user->rights->contrat->lire;
print $formfile->showdocuments('massfilesarea_contract','',$filedir,$urlsource,0,$delallowed,'',1,1,0,48,1,$param,$title,'','','',null,$hidegeneratedfilelistifempty);
llxFooter();

View File

@ -385,7 +385,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

View File

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

View File

@ -6551,7 +6551,7 @@ abstract class CommonObject
*
* @return array
*/
private function set_save_query()
protected function set_save_query()
{
global $conf;
@ -6605,7 +6605,7 @@ abstract class CommonObject
*
* @param stdClass $obj Contain data of object from database
*/
private function setVarsFromFetchObj(&$obj)
protected function setVarsFromFetchObj(&$obj)
{
foreach ($this->fields as $field => $info)
{
@ -6650,7 +6650,7 @@ abstract class CommonObject
*
* @return string
*/
private function get_field_list()
protected function get_field_list()
{
$keys = array_keys($this->fields);
return implode(',', $keys);

View File

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

View File

@ -3597,7 +3597,7 @@ class Form
* @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"
* @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.
@ -5421,23 +5421,23 @@ class Form
* Return a HTML select string, built from an array of key+value.
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array (key => value)
* @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 to show key into label with format "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param int $translate 1=Translate and encode value
* @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
* @param string $morecss Add more class to css styles
* @param int $addjscombo Add js combo
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry
* @param int $nohtmlescape No html escaping.
* @return string HTML select string.
* @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array (key => value)
* @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (key is -1 and value is '' or '&nbsp;' if 1, key is -1 and value is text if string), <0 to add an empty value with key that is this value.
* @param int $key_in_label 1 to show key into label with format "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
* @param int $translate 1=Translate and encode value
* @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled
* @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order
* @param string $morecss Add more class to css styles
* @param int $addjscombo Add js combo
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry
* @param int $nohtmlescape No html escaping.
* @return string HTML select string.
* @see multiselectarray
*/
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='',$disablebademail=0, $nohtmlescape=0)
@ -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)
{
@ -6462,7 +6467,7 @@ class Form
else if ($object->element == 'member')
{
$fullname=$object->getFullName($langs);
if ($object->morphy == 'mor') {
if ($object->morphy == 'mor' && $object->societe) {
$ret.= dol_htmlentities($object->societe) . ((! empty($fullname) && $object->societe != $fullname)?' ('.dol_htmlentities($fullname).')':'');
} else {
$ret.= dol_htmlentities($fullname) . ((! empty($object->societe) && $object->societe != $fullname)?' ('.dol_htmlentities($object->societe).')':'');

View File

@ -24,6 +24,7 @@
* \ingroup Advanced accountancy
* \brief File of class with all html predefined components
*/
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
/**

View File

@ -877,12 +877,13 @@ class FormMail extends Form
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
$langs->load('paypal');
$typeforonlinepayment='free';
if ($this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template
if ($this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template
if ($this->param["models"]=='member_send') $typeforonlinepayment='member'; // TODO use detection on something else than template
if ($this->param["models"]=='order' || $this->param["models"]=='order_send') $typeforonlinepayment='order'; // TODO use detection on something else than template
if ($this->param["models"]=='invoice' || $this->param["models"]=='facture_send') $typeforonlinepayment='invoice'; // TODO use detection on something else than template
if ($this->param["models"]=='member') $typeforonlinepayment='member'; // TODO use detection on something else than template
$url=getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
$paymenturl=$url;
$paymenturl=$url;
}
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$langs->trans("PredefinedMailContentLink", $paymenturl):'');
$this->substit['__ONLINE_PAYMENT_URL__']=$paymenturl;
//Add lines substitution key from each line
@ -998,7 +999,7 @@ class FormMail extends Form
* @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
* @param int $active 1=Only active template, 0=Only disabled, -1=All
* @param string $label Label of template
* @return ModelMail
* @return ModelMail One instance of ModelMail
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1, $label='')
{
@ -1153,6 +1154,7 @@ class FormMail extends Form
$line->topic=$obj->topic;
$line->content=$obj->content;
$line->content_lines=$obj->content_lines;
$this->lines_model[]=$line;
}
$this->db->free($resql);

View File

@ -808,7 +808,7 @@ class FormTicketsup
// External users can't send message email
if ($user->rights->ticketsup->write && !$user->societe_id) {
if ($user->rights->ticketsup->write && !$user->socid) {
print '<tr><td width="30%"></td><td colspan="2">';
$checkbox_selected = ( GETPOST('send_email') == "1" ? ' checked' : '');
print '<input type="checkbox" name="send_email" value="1" id="send_msg_email" '.$checkbox_selected.'/> ';
@ -839,7 +839,7 @@ class FormTicketsup
print "</td></tr>";
}
if (!$user->societe_id) {
if (! $user->socid) {
print '<tr><td width="30%"></td><td>';
$checkbox_selected = ( GETPOST('private_message') == "1" ? ' checked' : '');
print '<input type="checkbox" name="private_message" value="1" id="private_message" '.$checkbox_selected.'/> ';
@ -902,7 +902,7 @@ class FormTicketsup
// Intro
// External users can't send message email
if ($user->rights->ticketsup->write && !$user->societe_id) {
if ($user->rights->ticketsup->write && !$user->socid) {
$mail_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKETS_MESSAGE_MAIL_INTRO;
print '<tr class="email_line"><td><label for="mail_intro">' . $langs->trans("TicketMessageMailIntro") . '</label>';
@ -945,7 +945,7 @@ class FormTicketsup
$doleditor = new DolEditor('message', $defaultmessage, '100%', 350, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70);
$doleditor->Create();
print '</td><td align="center">';
if ($user->rights->ticketsup->write && !$user->societe_id) {
if ($user->rights->ticketsup->write && !$user->socid) {
print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help');
}
@ -953,7 +953,7 @@ class FormTicketsup
// Signature
// External users can't send message email
if ($user->rights->ticketsup->write && !$user->societe_id) {
if ($user->rights->ticketsup->write && !$user->socid) {
$mail_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKETS_MESSAGE_MAIL_SIGNATURE;
print '<tr class="email_line"><td><label for="mail_intro">' . $langs->trans("TicketMessageMailSignature") . '</label>';

View File

@ -169,12 +169,12 @@ class Interfaces
if (method_exists($objMod, 'runTrigger')) // New method to implement
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_INFO);
//dol_syslog(get_class($this)."::run_triggers action=".$action." Launch runTrigger for file '".$files[$key]."'", LOG_DEBUG);
$result=$objMod->runTrigger($action,$object,$user,$langs,$conf);
}
elseif (method_exists($objMod, 'run_trigger')) // Deprecated method
{
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch run_trigger for file '".$files[$key]."'", LOG_INFO);
dol_syslog(get_class($this)."::run_triggers action=".$action." Launch old method run_trigger (rename your trigger into runTrigger) for file '".$files[$key]."'", LOG_WARNING);
$result=$objMod->run_trigger($action,$object,$user,$langs,$conf);
}
else

View File

@ -449,7 +449,6 @@ class Utils
}
}
return 0;
}

View File

@ -1321,14 +1321,15 @@ function complete_elementList_with_modules(&$elementList)
/**
* Show array with constants to edit
*
* @param array $tableau Array of constants
* @param array $tableau Array of constants array('key'=>type, ) where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all
* @param string $helptext Help
* @return void
*/
function form_constantes($tableau, $strictw3c=0, $helptext='')
{
global $db,$bc,$langs,$conf,$_Avery_Labels;
global $db,$bc,$langs,$conf,$user;
global $_Avery_Labels;
$form = new Form($db);
@ -1343,11 +1344,20 @@ function form_constantes($tableau, $strictw3c=0, $helptext='')
print '</td>';
if (empty($strictw3c)) print '<td align="center" width="80">'.$langs->trans("Action").'</td>';
print "</tr>\n";
$var=true;
$listofparam=array();
foreach($tableau as $const) // Loop on each param
foreach($tableau as $key => $const) // Loop on each param
{
// $const is a const key like 'MYMODULE_ABC'
if (is_numeric($key)) {
$type = 'string';
}
else
{
$type = $const;
$const = $key;
}
$sql = "SELECT ";
$sql.= "rowid";
$sql.= ", ".$db->decrypt('name')." as name";
@ -1355,7 +1365,7 @@ function form_constantes($tableau, $strictw3c=0, $helptext='')
$sql.= ", type";
$sql.= ", note";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
$sql.= " WHERE ".$db->decrypt('name')." = '".$const."'";
$sql.= " WHERE ".$db->decrypt('name')." = '".$db->escape($const)."'";
$sql.= " AND entity IN (0, ".$conf->entity.")";
$sql.= " ORDER BY name ASC, entity DESC";
$result = $db->query($sql);
@ -1365,23 +1375,26 @@ function form_constantes($tableau, $strictw3c=0, $helptext='')
{
$obj = $db->fetch_object($result); // Take first result of select
// For avoid warning in strict mode
if (empty($obj)) {
$obj = (object) array('rowid'=>'','name'=>'','value'=>'','type'=>'','note'=>'');
if (empty($obj)) // If not yet into table
{
$obj = (object) array('rowid'=>'','name'=>$const,'value'=>'','type'=>$type,'note'=>'');
}
if (empty($strictw3c)) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
if (empty($strictw3c))
{
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
print '<tr class="oddeven">';
// Show constant
print '<td>';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
if (empty($strictw3c)) print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="rowid'.(empty($strictw3c)?'':'[]').'" value="'.$obj->rowid.'">';
print '<input type="hidden" name="constname'.(empty($strictw3c)?'':'[]').'" value="'.$const.'">';
print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
print '<input type="hidden" name="constnote_'.$obj->name.'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
print '<input type="hidden" name="consttype_'.$obj->name.'" value="'.($obj->type?$obj->type:'string').'">';
print $langs->trans('Desc'.$const);
@ -1428,34 +1441,57 @@ function form_constantes($tableau, $strictw3c=0, $helptext='')
}
print $form->selectarray('constvalue'.(empty($strictw3c)?'':'[]'),$arrayoflabels,($obj->value?$obj->value:'CARD'),1,0,0);
print '<input type="hidden" name="consttype" value="yesno">';
print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
print '</td>';
}
else
{
print '<td>';
if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT')))
print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="'.($obj->type?$obj->type:'string').'">';
print '<input type="hidden" name="constnote'.(empty($strictw3c)?'':'[]').'" value="'.nl2br(dol_escape_htmltag($obj->note)).'">';
if ($obj->type == 'textarea' || in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT')))
{
print '<textarea class="flat" name="constvalue'.(empty($strictw3c)?'':'[]').'" cols="50" rows="5" wrap="soft">'."\n";
print $obj->value;
print "</textarea>\n";
print '<input type="hidden" name="consttype" value="texte">';
}
else if (in_array($const,array('ADHERENT_AUTOREGISTER_NOTIF_MAIL','ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL')))
elseif ($obj->type == 'html')
{
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%');
$doleditor->Create();
print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="texte">';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('constvalue_'.$const.(empty($strictw3c)?'':'[]'),$obj->value,'',160,'dolibarr_notes','',false,false,$conf->fckeditor->enabled,ROWS_5,'90%');
$doleditor->Create();
}
else if ($obj->type == 'yesno')
elseif ($obj->type == 'yesno')
{
print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1);
print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="yesno">';
print $form->selectyesno('constvalue'.(empty($strictw3c)?'':'[]'),$obj->value,1);
}
else
elseif (preg_match('/emailtemplate/', $obj->type))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$tmp=explode(':', $obj->type);
$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, -1); // We set lang=null to get in priority record with no lang
//$arraydefaultmessage = $formmail->getEMailTemplate($db, $tmp[1], $user, null, 0, 1, '');
$arrayofmessagename=array();
if (is_array($formmail->lines_model))
{
foreach($formmail->lines_model as $modelmail)
{
//var_dump($modelmail);
$moreonlabel='';
if (! empty($arrayofmessagename[$modelmail->label])) $moreonlabel=' <span class="opacitymedium">('.$langs->trans("SeveralLangugeVariatFound").')</span>';
$arrayofmessagename[$modelmail->label]=$langs->trans(preg_replace('/\(|\)/','',$modelmail->label)).$moreonlabel;
}
}
//var_dump($arraydefaultmessage);
//var_dump($arrayofmessagename);
print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value, 'None', 1, 0, '', 0, 0, 0, '', '', 1);
}
else // type = 'string' ou 'chaine'
{
print '<input type="text" class="flat" size="48" name="constvalue'.(empty($strictw3c)?'':'[]').'" value="'.dol_escape_htmltag($obj->value).'">';
print '<input type="hidden" name="consttype'.(empty($strictw3c)?'':'[]').'" value="chaine">';
}
print '</td>';
}

View File

@ -168,7 +168,7 @@ function societe_prepare_head(Societe $object)
}
// Related items
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled))
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Referers");

View File

@ -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
@ -5686,6 +5687,7 @@ function dol_textishtml($msg,$option=0)
elseif (preg_match('/<h[0-9]>/i',$msg)) return true;
elseif (preg_match('/&[A-Z0-9]{1,6};/i',$msg)) return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
elseif (preg_match('/&#[0-9]{2,3};/i',$msg)) return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
return false;
}
}
@ -5775,6 +5777,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
'__MYCOMPANY_COUNTRY_ID__' => $mysoc->country_id
));
}
if (($onlykey || is_object($object)) && (empty($exclude) || ! in_array('object', $exclude)))
{
if ($onlykey)
@ -5789,8 +5792,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__THIRDPARTY_NAME__'] = '__THIRDPARTY_NAME__';
$substitutionarray['__THIRDPARTY_EMAIL__'] = '__THIRDPARTY_EMAIL__';
if (is_object($object) && $object->element == 'shipping')
if (is_object($object) && $object->element == 'member')
{
$substitutionarray['__MEMBER_ID__'] = '__MEMBER_ID__';
$substitutionarray['__MEMBER_CIVILITY__'] = '__MEMBER_CIVILITY__';
$substitutionarray['__MEMBER_FIRSTNAME__'] = '__MEMBER_FIRSTNAME__';
$substitutionarray['__MEMBER_LASTNAME__'] = '__MEMBER_LASTNAME__';
@ -5804,7 +5808,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = 'Lowest data for planned expiration of service';
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = 'Lowest date and hour for planned expiration of service';
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'LinkToPayOnlineIfApplicable';
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'UrlToPayOnlineIfApplicable';
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = 'TextAndUrlToPayOnlineIfApplicable';
$substitutionarray['__SECUREKEYPAYMENT__'] = 'Security key (if key is not unique per record)';
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = 'Security key for payment on a member subscription (one key per member)';
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = 'Security key for payment on an order';
@ -5829,6 +5834,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$birthday = dol_print_date($object->birth,'day');
$substitutionarray['__MEMBER_ID__']=$object->id;
if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel();
$substitutionarray['__MEMBER_FIRSTNAME__']=$msgishtml?dol_htmlentitiesbr($object->firstname):$object->firstname;
$substitutionarray['__MEMBER_LASTNAME__']=$msgishtml?dol_htmlentitiesbr($object->lastname):$object->lastname;
@ -5920,6 +5926,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
$paymenturl=$url;
}
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__']=($paymenturl?$outputlangs->trans("PredefinedMailContentLink", $paymenturl):'');
$substitutionarray['__ONLINE_PAYMENT_URL__']=$paymenturl;
}
}
@ -5985,8 +5992,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
}
/**
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
* Texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced.
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval),
* and texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced.
* Example of usage:
* $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $thirdparty);
* complete_substitutions_array($substitutionarray, $langs, $thirdparty);

View File

@ -55,9 +55,11 @@ function member_prepare_head(Adherent $object)
if (! empty($user->rights->adherent->cotisation->lire))
{
$nbSubscription = is_array($object->subscriptions)?count($object->subscriptions):0;
$head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Subscriptions");
$head[$h][2] = 'subscription';
if ($nbSubscription > 0) $head[$h][1].= ' <span class="badge">'.$nbSubscription.'</span>';
$h++;
}

View File

@ -210,7 +210,7 @@ function getOnlinePaymentUrl($mode, $type, $ref='', $amount='9.99', $freetag='yo
}
// For multicompany
if (! empty($out)) $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
if (! empty($out) && ! empty($conf->multicompany->enabled)) $out.="&entity=".$conf->entity; // Check the entity because we may have the same reference in several entities
return $out;
}
@ -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;

View File

@ -236,12 +236,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 +274,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>';
@ -342,7 +347,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 +387,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 +421,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 +431,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,7 +459,7 @@ 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";
}
@ -487,7 +495,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,7 +559,7 @@ 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";

View File

@ -237,9 +237,16 @@ class MenuManager
{
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
$relurl2=dol_buildpath($val2['url'],1);
if (! preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
{
$relurl2=dol_buildpath($val2['url'],1);
}
else
{
$relurl2=$val2['url'];
}
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';

View File

@ -185,6 +185,7 @@ class MenuManager
$tmpleftmenu='all';
$submenu=new Menu();
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
// Note: $submenu contains menu entry with substitution not yet done
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
@ -247,9 +248,16 @@ class MenuManager
{
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val2['url'] = make_substitutions($val2['url'], $substitarray);
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
$relurl2=dol_buildpath($val2['url'],1);
if (! preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
{
$relurl2=dol_buildpath($val2['url'],1);
}
else
{
$relurl2=$val2['url'];
}
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';

View File

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

View File

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

View File

@ -83,34 +83,7 @@ class modAdherent extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_RESIL";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Votre adhésion vient d'être résiliée.\r\nNous espérons vous revoir très bientôt";
$this->const[$r][3] = "Mail de résiliation";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_VALID";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n__INFOS__\r\n\r\n";
$this->const[$r][3] = "Mail de validation";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_VALID_SUBJECT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "Votre adhésion a été validée";
$this->const[$r][3] = "Sujet du mail de validation";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_RESIL_SUBJECT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "Résiliation de votre adhésion";
$this->const[$r][3] = "Sujet du mail de résiliation";
$this->const[$r][4] = 0;
$r++;
// For emails
$this->const[$r][0] = "ADHERENT_MAIL_FROM";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
@ -118,20 +91,35 @@ class modAdherent extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_COTIS";
$this->const[$r][1] = "texte";
$this->const[$r][2] = "Bonjour __FIRSTNAME__,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée";
$this->const[$r][3] = "Mail de validation de cotisation";
$this->const[$r][0] = "ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER";
$this->const[$r][1] = "emailtemplate:member";
$this->const[$r][2] = "(SendingEmailOnAutoSubscription)";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_MAIL_COTIS_SUBJECT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "Reçu de votre cotisation";
$this->const[$r][3] = "Sujet du mail de validation de cotisation";
$this->const[$r][0] = "ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION";
$this->const[$r][1] = "emailtemplate:member";
$this->const[$r][2] = "(SendingEmailOnNewSubscription)";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION";
$this->const[$r][1] = "emailtemplate:member";
$this->const[$r][2] = "(SendingReminderForExpiredSubscription)";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_EMAIL_TEMPLATE_CANCELATION";
$this->const[$r][1] = "emailtemplate:member";
$this->const[$r][2] = "(SendingEmailOnCancelation)";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
// For cards
$this->const[$r][0] = "ADHERENT_CARD_HEADER_TEXT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "__YEAR__";
@ -160,20 +148,6 @@ class modAdherent extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_BANK_ACCOUNT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][3] = "ID du Compte banquaire utilise";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_BANK_CATEGORIE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][3] = "ID de la catégorie bancaire des cotisations";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_ETIQUETTE_TYPE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "L7163";
@ -188,6 +162,22 @@ class modAdherent extends DolibarrModules
$this->const[$r][4] = 0;
$r++;
// For subscriptions
$this->const[$r][0] = "ADHERENT_BANK_ACCOUNT";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][3] = "ID of bank account to use";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "ADHERENT_BANK_CATEGORIE";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "";
$this->const[$r][3] = "ID of bank transaction category to use";
$this->const[$r][4] = 0;
$r++;
// Boxes
//-------
$this->boxes = array(0=>array('file'=>'box_members.php','enabledbydefaulton'=>'Home'));

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

View File

@ -228,7 +228,7 @@ class modResource extends DolibarrModules
'langs'=> 'resource',
'position'=> 101,
'enabled'=> '1',
'perms'=> '$user->rights->resource->read',
'perms'=> '$user->rights->resource->write',
'target'=> '',
'user'=> 0
);

View File

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

View File

@ -108,6 +108,7 @@ if ($action == 'presend')
// Create form for email
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
$formmail->fromtype = (GETPOST('fromtype')?GETPOST('fromtype'):(!empty($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE)?$conf->global->MAIN_MAIL_DEFAULT_FROMTYPE:'user'));
@ -178,13 +179,7 @@ if ($action == 'presend')
$formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
$formmail->param['fileinit'] = array($file);
// Init list of files
/*if (GETPOST('mode','alpha') == 'init')
{
$formmail->clear_attached_files();
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
}*/
$formmail->withsubstit = 1;
// Show form
print $formmail->get_form();

View File

@ -79,7 +79,7 @@ print '<div class="tagtable border table-border centpercent">'."\n";
if ($module != 'product') {
// No public note yet on products
print '<div class="tagtr pair table-border-row">'."\n";
print '<div class="tagtd tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
print '</div>'."\n";
print '<div class="tagtd table-val-border-col">'."\n";
@ -89,7 +89,7 @@ if ($module != 'product') {
}
if (empty($user->societe_id)) {
print '<div class="tagtr '.($module != 'product'?'impair':'pair').' table-border-row">'."\n";
print '<div class="tagtd tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print '<div class="tagtd tagtdnote tdtop table-key-border-col'.(empty($cssclass)?'':' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
print '</div>'."\n";
print '<div class="tagtd table-val-border-col">'."\n";

View File

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

View File

@ -93,7 +93,7 @@ class InterfaceTicketEmail extends DolibarrTriggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object

294
htdocs/dav/dav.class.php Normal file
View File

@ -0,0 +1,294 @@
<?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 calendar user id
* @param int actioncomm object id
* @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 row object
* @return string
*/
public function toVCalendar($calid, $obj)
{
$categ = [];
/*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;
}
public function getFullCalendarObjects($calendarId, $bCalendarData)
{
$calid = ($calendarId*1);
$calevents = [] ;
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[] = [
'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[] = [
// '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
View 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
View 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();

View File

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

View File

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

View File

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

View File

@ -124,7 +124,7 @@ class Interventions extends DolibarrApi
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE t.entity IN ('.getEntity('fichinter').')';
$sql.= ' WHERE t.entity IN ('.getEntity('intervention').')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc";
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale

View File

@ -128,7 +128,7 @@ class Fichinter extends CommonObject
$sql.= " WHERE sc.fk_user = " .$user->id;
$clause = "AND";
}
$sql.= " ".$clause." fi.entity IN (".getEntity($this->element).")";
$sql.= " ".$clause." fi.entity IN (".getEntity('intervention').")";
$resql=$this->db->query($sql);
if ($resql)
@ -348,7 +348,10 @@ class Fichinter extends CommonObject
$sql.= " f.tms as datem,";
$sql.= " f.duree, f.fk_projet, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) $sql.= " WHERE f.ref='".$this->db->escape($ref)."'";
if ($ref) {
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.ref='".$this->db->escape($ref)."'";
}
else $sql.= " WHERE f.rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -782,7 +785,6 @@ class Fichinter extends CommonObject
$sql.= " f.fk_user_valid";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql.= " WHERE f.rowid = ".$id;
$sql.= " AND f.entity = ".$conf->entity;
$resql = $this->db->query($sql);
if ($resql)
@ -886,7 +888,6 @@ class Fichinter extends CommonObject
// Delete object
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinter";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
dol_syslog("Fichinter::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
@ -950,7 +951,6 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
$sql.= " SET datei = '".$this->db->idate($date_delivery)."'";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
$sql.= " AND fk_statut = 0";
if ($this->db->query($sql))
@ -984,7 +984,6 @@ class Fichinter extends CommonObject
$sql.= " SET description = '".$this->db->escape($description)."',";
$sql.= " fk_user_modif = ".$user->id;
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
if ($this->db->query($sql))
{
@ -1017,7 +1016,6 @@ class Fichinter extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."fichinter ";
$sql.= " SET fk_contrat = '".$contractid."'";
$sql.= " WHERE rowid = ".$this->id;
$sql.= " AND entity = ".$conf->entity;
if ($this->db->query($sql))
{
@ -1395,7 +1393,7 @@ class FichinterLigne extends CommonObjectLine
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
$this->id=$this->id;
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -1457,7 +1455,7 @@ class FichinterLigne extends CommonObjectLine
$sql.= ",date='".$this->db->idate($this->datei)."'";
$sql.= ",duree=".$this->duration;
$sql.= ",rang='".$this->db->escape($this->rang)."'";
$sql.= " WHERE rowid = ".$this->rowid;
$sql.= " WHERE rowid = ".$this->id;
dol_syslog("FichinterLigne::update", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -1466,7 +1464,7 @@ class FichinterLigne extends CommonObjectLine
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$this->id=$this->rowid;
$this->id=$this->id;
$result=$this->insertExtraFields();
if ($result < 0)
{
@ -1535,7 +1533,6 @@ class FichinterLigne extends CommonObjectLine
$sql.= " , dateo = ".(! empty($obj->dateo)?"'".$this->db->idate($obj->dateo)."'":"null");
$sql.= " , datee = ".(! empty($obj->datee)?"'".$this->db->idate($obj->datee)."'":"null");
$sql.= " WHERE rowid = ".$this->fk_fichinter;
$sql.= " AND entity = ".$conf->entity;
dol_syslog("FichinterLigne::update_total", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -1574,10 +1571,10 @@ class FichinterLigne extends CommonObjectLine
if ($this->statut == 0)
{
dol_syslog(get_class($this)."::deleteline lineid=".$this->rowid);
dol_syslog(get_class($this)."::deleteline lineid=".$this->id);
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->rowid;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id;
$resql = $this->db->query($sql);
if ($resql)

View File

@ -81,8 +81,8 @@ $sql = "SELECT count(f.rowid), f.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."fichinter as f";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('societe').")";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
if ($user->societe_id) $sql.=' AND f.fk_soc = '.$user->societe_id;
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
$sql.= " GROUP BY f.fk_statut";
@ -180,8 +180,8 @@ if (! empty($conf->ficheinter->enabled))
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('intervention').")";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut = 0";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -228,8 +228,8 @@ $sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('commande').")";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
//$sql.= " AND c.fk_statut > 2";
if ($socid) $sql .= " AND f.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
@ -299,8 +299,8 @@ if (! empty($conf->ficheinter->enabled))
$sql.=" FROM ".MAIN_DB_PREFIX."fichinter as f";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.fk_soc = s.rowid";
$sql.= " AND f.entity IN (".getEntity('intervention').")";
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND f.fk_statut = 1";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;

View File

@ -194,8 +194,8 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as fd ON fd.fk_fichinter = f.rowid";
if (! $user->rights->societe->client->voir && empty($socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE f.fk_soc = s.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " WHERE f.entity IN (".getEntity('intervention').")";
$sql.= " AND f.fk_soc = s.rowid";
if ($search_ref) {
$sql .= natural_search('f.ref', $search_ref);
}

View File

@ -50,7 +50,7 @@ $cancelbutton = GETPOST('cancel','alpha');
// Security check
$id = (GETPOST('socid','int') ? GETPOST('socid','int') : GETPOST('id','int'));
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe');
$result = restrictedArea($user, 'societe&fournisseur', $id, '&societe', '', 'rowid');
$object = new Fournisseur($db);
$extrafields = new ExtraFields($db);

View File

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

View File

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

View File

@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit60b9ac98a8448ede6c445b0fd4bd31e0::getLoader();

View 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;
}

View 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.

View File

@ -0,0 +1,9 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View 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',
);

View File

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View 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'),
);

View 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;
}
}

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

View File

@ -0,0 +1,470 @@
[
{
"name": "sabre/uri",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-uri.git",
"reference": "8545a3335f741d4b7700bb14efb41b4c03775dcd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-uri/zipball/8545a3335f741d4b7700bb14efb41b4c03775dcd",
"reference": "8545a3335f741d4b7700bb14efb41b4c03775dcd",
"shasum": ""
},
"require": {
"php": ">=5.4.7"
},
"require-dev": {
"phpunit/phpunit": "*",
"sabre/cs": "~1.0.0"
},
"time": "2016-12-07T01:17:59+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/functions.php"
],
"psr-4": {
"Sabre\\Uri\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"description": "Functions for making sense out of URIs.",
"homepage": "http://sabre.io/uri/",
"keywords": [
"rfc3986",
"uri",
"url"
]
},
{
"name": "sabre/xml",
"version": "1.5.0",
"version_normalized": "1.5.0.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-xml.git",
"reference": "59b20e5bbace9912607481634f97d05a776ffca7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-xml/zipball/59b20e5bbace9912607481634f97d05a776ffca7",
"reference": "59b20e5bbace9912607481634f97d05a776ffca7",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"lib-libxml": ">=2.6.20",
"php": ">=5.5.5",
"sabre/uri": ">=1.0,<3.0.0"
},
"require-dev": {
"phpunit/phpunit": "*",
"sabre/cs": "~1.0.0"
},
"time": "2016-10-09T22:57:52+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Sabre\\Xml\\": "lib/"
},
"files": [
"lib/Deserializer/functions.php",
"lib/Serializer/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
},
{
"name": "Markus Staab",
"email": "markus.staab@redaxo.de",
"role": "Developer"
}
],
"description": "sabre/xml is an XML library that you may not hate.",
"homepage": "https://sabre.io/xml/",
"keywords": [
"XMLReader",
"XMLWriter",
"dom",
"xml"
]
},
{
"name": "sabre/vobject",
"version": "4.1.2",
"version_normalized": "4.1.2.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-vobject.git",
"reference": "d0fde2fafa2a3dad1f559c2d1c2591d4fd75ae3c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-vobject/zipball/d0fde2fafa2a3dad1f559c2d1c2591d4fd75ae3c",
"reference": "d0fde2fafa2a3dad1f559c2d1c2591d4fd75ae3c",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"php": ">=5.5",
"sabre/xml": ">=1.5 <3.0"
},
"require-dev": {
"phpunit/phpunit": "*",
"sabre/cs": "^1.0.0"
},
"suggest": {
"hoa/bench": "If you would like to run the benchmark scripts"
},
"time": "2016-12-06T04:14:09+00:00",
"bin": [
"bin/vobject",
"bin/generate_vcards"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Sabre\\VObject\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
},
{
"name": "Dominik Tobschall",
"email": "dominik@fruux.com",
"homepage": "http://tobschall.de/",
"role": "Developer"
},
{
"name": "Ivan Enderlin",
"email": "ivan.enderlin@hoa-project.net",
"homepage": "http://mnt.io/",
"role": "Developer"
}
],
"description": "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects",
"homepage": "http://sabre.io/vobject/",
"keywords": [
"availability",
"freebusy",
"iCalendar",
"ical",
"ics",
"jCal",
"jCard",
"recurrence",
"rfc2425",
"rfc2426",
"rfc2739",
"rfc4770",
"rfc5545",
"rfc5546",
"rfc6321",
"rfc6350",
"rfc6351",
"rfc6474",
"rfc6638",
"rfc6715",
"rfc6868",
"vCalendar",
"vCard",
"vcf",
"xCal",
"xCard"
]
},
{
"name": "sabre/event",
"version": "3.0.0",
"version_normalized": "3.0.0.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-event.git",
"reference": "831d586f5a442dceacdcf5e9c4c36a4db99a3534"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-event/zipball/831d586f5a442dceacdcf5e9c4c36a4db99a3534",
"reference": "831d586f5a442dceacdcf5e9c4c36a4db99a3534",
"shasum": ""
},
"require": {
"php": ">=5.5"
},
"require-dev": {
"phpunit/phpunit": "*",
"sabre/cs": "~0.0.4"
},
"time": "2015-11-05T20:14:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Sabre\\Event\\": "lib/"
},
"files": [
"lib/coroutine.php",
"lib/Loop/functions.php",
"lib/Promise/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"description": "sabre/event is a library for lightweight event-based programming",
"homepage": "http://sabre.io/event/",
"keywords": [
"EventEmitter",
"async",
"events",
"hooks",
"plugin",
"promise",
"signal"
]
},
{
"name": "sabre/http",
"version": "4.2.2",
"version_normalized": "4.2.2.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-http.git",
"reference": "dd50e7260356f4599d40270826f9548b23efa204"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-http/zipball/dd50e7260356f4599d40270826f9548b23efa204",
"reference": "dd50e7260356f4599d40270826f9548b23efa204",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-mbstring": "*",
"php": ">=5.4",
"sabre/event": ">=1.0.0,<4.0.0",
"sabre/uri": "~1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.3",
"sabre/cs": "~0.0.1"
},
"suggest": {
"ext-curl": " to make http requests with the Client class"
},
"time": "2017-01-02T19:38:42+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"files": [
"lib/functions.php"
],
"psr-4": {
"Sabre\\HTTP\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"description": "The sabre/http library provides utilities for dealing with http requests and responses. ",
"homepage": "https://github.com/fruux/sabre-http",
"keywords": [
"http"
]
},
{
"name": "psr/log",
"version": "1.0.2",
"version_normalized": "1.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"time": "2016-10-10T12:19:37+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for logging libraries",
"homepage": "https://github.com/php-fig/log",
"keywords": [
"log",
"psr",
"psr-3"
]
},
{
"name": "sabre/dav",
"version": "3.2.2",
"version_normalized": "3.2.2.0",
"source": {
"type": "git",
"url": "https://github.com/fruux/sabre-dav.git",
"reference": "e987775e619728f12205606c9cc3ee565ffb1516"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fruux/sabre-dav/zipball/e987775e619728f12205606c9cc3ee565ffb1516",
"reference": "e987775e619728f12205606c9cc3ee565ffb1516",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-date": "*",
"ext-dom": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
"ext-pcre": "*",
"ext-simplexml": "*",
"ext-spl": "*",
"lib-libxml": ">=2.7.0",
"php": ">=5.5.0",
"psr/log": "^1.0",
"sabre/event": ">=2.0.0, <4.0.0",
"sabre/http": "^4.2.1",
"sabre/uri": "^1.0.1",
"sabre/vobject": "^4.1.0",
"sabre/xml": "^1.4.0"
},
"require-dev": {
"evert/phpdoc-md": "~0.1.0",
"monolog/monolog": "^1.18",
"phpunit/phpunit": "> 4.8, <6.0.0",
"sabre/cs": "^1.0.0"
},
"suggest": {
"ext-curl": "*",
"ext-pdo": "*"
},
"time": "2017-02-15T03:06:08+00:00",
"bin": [
"bin/sabredav",
"bin/naturalselection"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1.0-dev"
}
},
"installation-source": "dist",
"autoload": {
"psr-4": {
"Sabre\\DAV\\": "lib/DAV/",
"Sabre\\DAVACL\\": "lib/DAVACL/",
"Sabre\\CalDAV\\": "lib/CalDAV/",
"Sabre\\CardDAV\\": "lib/CardDAV/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Evert Pot",
"email": "me@evertpot.com",
"homepage": "http://evertpot.com/",
"role": "Developer"
}
],
"description": "WebDAV Framework for PHP",
"homepage": "http://sabre.io/",
"keywords": [
"CalDAV",
"CardDAV",
"WebDAV",
"framework",
"iCalendar"
]
}
]

View File

@ -0,0 +1 @@
vendor

View File

@ -0,0 +1,19 @@
Copyright (c) 2012 PHP Framework Interoperability Group
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.

View File

@ -0,0 +1,128 @@
<?php
namespace Psr\Log;
/**
* This is a simple Logger implementation that other Loggers can inherit from.
*
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
abstract class AbstractLogger implements LoggerInterface
{
/**
* System is unusable.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}
/**
* Normal but significant events.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}
/**
* Detailed debug information.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}
}

View File

@ -0,0 +1,7 @@
<?php
namespace Psr\Log;
class InvalidArgumentException extends \InvalidArgumentException
{
}

View File

@ -0,0 +1,18 @@
<?php
namespace Psr\Log;
/**
* Describes log levels.
*/
class LogLevel
{
const EMERGENCY = 'emergency';
const ALERT = 'alert';
const CRITICAL = 'critical';
const ERROR = 'error';
const WARNING = 'warning';
const NOTICE = 'notice';
const INFO = 'info';
const DEBUG = 'debug';
}

View File

@ -0,0 +1,18 @@
<?php
namespace Psr\Log;
/**
* Describes a logger-aware instance.
*/
interface LoggerAwareInterface
{
/**
* Sets a logger instance on the object.
*
* @param LoggerInterface $logger
*
* @return void
*/
public function setLogger(LoggerInterface $logger);
}

View File

@ -0,0 +1,26 @@
<?php
namespace Psr\Log;
/**
* Basic Implementation of LoggerAwareInterface.
*/
trait LoggerAwareTrait
{
/**
* The logger instance.
*
* @var LoggerInterface
*/
protected $logger;
/**
* Sets a logger.
*
* @param LoggerInterface $logger
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
}

View File

@ -0,0 +1,123 @@
<?php
namespace Psr\Log;
/**
* Describes a logger instance.
*
* The message MUST be a string or object implementing __toString().
*
* The message MAY contain placeholders in the form: {foo} where foo
* will be replaced by the context data in key "foo".
*
* The context array can contain arbitrary data. The only assumption that
* can be made by implementors is that if an Exception instance is given
* to produce a stack trace, it MUST be in a key named "exception".
*
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
* for the full interface specification.
*/
interface LoggerInterface
{
/**
* System is unusable.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array());
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array());
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array());
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function error($message, array $context = array());
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array());
/**
* Normal but significant events.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array());
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function info($message, array $context = array());
/**
* Detailed debug information.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array());
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
*
* @return void
*/
public function log($level, $message, array $context = array());
}

View File

@ -0,0 +1,140 @@
<?php
namespace Psr\Log;
/**
* This is a simple Logger trait that classes unable to extend AbstractLogger
* (because they extend another class, etc) can include.
*
* It simply delegates all log-level-specific methods to the `log` method to
* reduce boilerplate code that a simple Logger that does the same thing with
* messages regardless of the error level has to implement.
*/
trait LoggerTrait
{
/**
* System is unusable.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function emergency($message, array $context = array())
{
$this->log(LogLevel::EMERGENCY, $message, $context);
}
/**
* Action must be taken immediately.
*
* Example: Entire website down, database unavailable, etc. This should
* trigger the SMS alerts and wake you up.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function alert($message, array $context = array())
{
$this->log(LogLevel::ALERT, $message, $context);
}
/**
* Critical conditions.
*
* Example: Application component unavailable, unexpected exception.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function critical($message, array $context = array())
{
$this->log(LogLevel::CRITICAL, $message, $context);
}
/**
* Runtime errors that do not require immediate action but should typically
* be logged and monitored.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function error($message, array $context = array())
{
$this->log(LogLevel::ERROR, $message, $context);
}
/**
* Exceptional occurrences that are not errors.
*
* Example: Use of deprecated APIs, poor use of an API, undesirable things
* that are not necessarily wrong.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function warning($message, array $context = array())
{
$this->log(LogLevel::WARNING, $message, $context);
}
/**
* Normal but significant events.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function notice($message, array $context = array())
{
$this->log(LogLevel::NOTICE, $message, $context);
}
/**
* Interesting events.
*
* Example: User logs in, SQL logs.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function info($message, array $context = array())
{
$this->log(LogLevel::INFO, $message, $context);
}
/**
* Detailed debug information.
*
* @param string $message
* @param array $context
*
* @return void
*/
public function debug($message, array $context = array())
{
$this->log(LogLevel::DEBUG, $message, $context);
}
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
*
* @return void
*/
abstract public function log($level, $message, array $context = array());
}

View File

@ -0,0 +1,28 @@
<?php
namespace Psr\Log;
/**
* This Logger can be used to avoid conditional log calls.
*
* Logging should always be optional, and if no logger is provided to your
* library creating a NullLogger instance to have something to throw logs at
* is a good way to avoid littering your code with `if ($this->logger) { }`
* blocks.
*/
class NullLogger extends AbstractLogger
{
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
*
* @return void
*/
public function log($level, $message, array $context = array())
{
// noop
}
}

View File

@ -0,0 +1,140 @@
<?php
namespace Psr\Log\Test;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
/**
* Provides a base test class for ensuring compliance with the LoggerInterface.
*
* Implementors can extend the class and implement abstract methods to run this
* as part of their test suite.
*/
abstract class LoggerInterfaceTest extends \PHPUnit_Framework_TestCase
{
/**
* @return LoggerInterface
*/
abstract public function getLogger();
/**
* This must return the log messages in order.
*
* The simple formatting of the messages is: "<LOG LEVEL> <MESSAGE>".
*
* Example ->error('Foo') would yield "error Foo".
*
* @return string[]
*/
abstract public function getLogs();
public function testImplements()
{
$this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
}
/**
* @dataProvider provideLevelsAndMessages
*/
public function testLogsAtAllLevels($level, $message)
{
$logger = $this->getLogger();
$logger->{$level}($message, array('user' => 'Bob'));
$logger->log($level, $message, array('user' => 'Bob'));
$expected = array(
$level.' message of level '.$level.' with context: Bob',
$level.' message of level '.$level.' with context: Bob',
);
$this->assertEquals($expected, $this->getLogs());
}
public function provideLevelsAndMessages()
{
return array(
LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
);
}
/**
* @expectedException \Psr\Log\InvalidArgumentException
*/
public function testThrowsOnInvalidLevel()
{
$logger = $this->getLogger();
$logger->log('invalid level', 'Foo');
}
public function testContextReplacement()
{
$logger = $this->getLogger();
$logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
$expected = array('info {Message {nothing} Bob Bar a}');
$this->assertEquals($expected, $this->getLogs());
}
public function testObjectCastToString()
{
if (method_exists($this, 'createPartialMock')) {
$dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
} else {
$dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
}
$dummy->expects($this->once())
->method('__toString')
->will($this->returnValue('DUMMY'));
$this->getLogger()->warning($dummy);
$expected = array('warning DUMMY');
$this->assertEquals($expected, $this->getLogs());
}
public function testContextCanContainAnything()
{
$context = array(
'bool' => true,
'null' => null,
'string' => 'Foo',
'int' => 0,
'float' => 0.5,
'nested' => array('with object' => new DummyTest),
'object' => new \DateTime,
'resource' => fopen('php://memory', 'r'),
);
$this->getLogger()->warning('Crazy context data', $context);
$expected = array('warning Crazy context data');
$this->assertEquals($expected, $this->getLogs());
}
public function testContextExceptionKeyCanBeExceptionOrOtherValues()
{
$logger = $this->getLogger();
$logger->warning('Random message', array('exception' => 'oops'));
$logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
$expected = array(
'warning Random message',
'critical Uncaught Exception!'
);
$this->assertEquals($expected, $this->getLogs());
}
}
class DummyTest
{
public function __toString()
{
}
}

View File

@ -0,0 +1,45 @@
PSR Log
=======
This repository holds all interfaces/classes/traits related to
[PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
Note that this is not a logger of its own. It is merely an interface that
describes a logger. See the specification for more details.
Usage
-----
If you need a logger, you can use the interface like this:
```php
<?php
use Psr\Log\LoggerInterface;
class Foo
{
private $logger;
public function __construct(LoggerInterface $logger = null)
{
$this->logger = $logger;
}
public function doSomething()
{
if ($this->logger) {
$this->logger->info('Doing work');
}
// do something useful
}
}
```
You can then pick one of the implementations of the interface to get a logger.
If you want to implement the interface, you can require this package and
implement `Psr\Log\LoggerInterface` in your code. Please read the
[specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
for details.

View File

@ -0,0 +1,26 @@
{
"name": "psr/log",
"description": "Common interface for logging libraries",
"keywords": ["psr", "psr-3", "log"],
"homepage": "https://github.com/php-fig/log",
"license": "MIT",
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
}
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}

View File

@ -0,0 +1,43 @@
# Unit tests
tests/temp
tests/.sabredav
tests/cov
# Custom settings for tests
tests/config.user.php
# ViM
*.swp
# Composer
composer.lock
vendor
# Composer binaries
bin/phing
bin/phpunit
bin/vobject
bin/generate_vcards
bin/phpdocmd
bin/phpunit
bin/php-cs-fixer
bin/sabre-cs-fixer
# Assuming every .php file in the root is for testing
/*.php
# Other testing stuff
/tmpdata
/data
/public
# Build
build
build.properties
# Docs
docs/api
docs/wikidocs
# Mac
.DS_Store

View File

@ -0,0 +1,36 @@
language: php
php:
- 5.5
- 5.6
- 7.0
- 7.1
env:
matrix:
- LOWEST_DEPS="" TEST_DEPS=""
- LOWEST_DEPS="--prefer-lowest" TEST_DEPS="tests/Sabre/"
services:
- mysql
- postgresql
sudo: false
before_script:
- mysql -e 'create database sabredav_test'
- psql -c "create database sabredav_test" -U postgres
- psql -c "create user sabredav with PASSWORD 'sabredav';GRANT ALL PRIVILEGES ON DATABASE sabredav_test TO sabredav" -U postgres
# - composer self-update
- composer update --prefer-dist $LOWEST_DEPS
# addons:
# postgresql: "9.5"
script:
- ./bin/phpunit --configuration tests/phpunit.xml.dist $TEST_DEPS
- ./bin/sabre-cs-fixer fix . --dry-run --diff
cache:
directories:
- $HOME/.composer/cache

View File

@ -0,0 +1,87 @@
Contributing to sabre projects
==============================
Want to contribute to sabre/dav? Here are some guidelines to ensure your patch
gets accepted.
Building a new feature? Contact us first
----------------------------------------
We may not want to accept every feature that comes our way. Sometimes
features are out of scope for our projects.
We don't want to waste your time, so by having a quick chat with us first,
you may find out quickly if the feature makes sense to us, and we can give
some tips on how to best build the feature.
If we don't accept the feature, it could be for a number of reasons. For
instance, we've rejected features in the past because we felt uncomfortable
assuming responsibility for maintaining the feature.
In those cases, it's often possible to keep the feature separate from the
sabre projects. sabre/dav for instance has a plugin system, and there's no
reason the feature can't live in a project you own.
In that case, definitely let us know about your plugin as well, so we can
feature it on [sabre.io][4].
We are often on [IRC][5], in the #sabredav channel on freenode. If there's
no one there, post a message on the [mailing list][6].
Coding standards
----------------
sabre projects follow:
1. [PSR-1][1]
2. [PSR-4][2]
sabre projects don't follow [PSR-2][3].
In addition to that, here's a list of basic rules:
1. PHP 5.4 array syntax must be used every where. This means you use `[` and
`]` instead of `array(` and `)`.
2. Use PHP namespaces everywhere.
3. Use 4 spaces for indentation.
4. Try to keep your lines under 80 characters. This is not a hard rule, as
there are many places in the source where it felt more sensibile to not
do so. In particular, function declarations are never split over multiple
lines.
5. Opening braces (`{`) are _always_ on the same line as the `class`, `if`,
`function`, etc. they belong to.
6. `public` must be omitted from method declarations. It must also be omitted
for static properties.
7. All files should use unix-line endings (`\n`).
8. Files must omit the closing php tag (`?>`).
9. `true`, `false` and `null` are always lower-case.
10. Constants are always upper-case.
11. Any of the rules stated before may be broken where this is the pragmatic
thing to do.
Unit test requirements
----------------------
Any new feature or change requires unittests. We use [PHPUnit][7] for all our
tests.
Adding unittests will greatly increase the likelyhood of us quickly accepting
your pull request. If unittests are not included though for whatever reason,
we'd still _love_ your pull request.
We may have to write the tests ourselves, which can increase the time it takes
to accept the patch, but we'd still really like your contribution!
To run the testsuite jump into the directory `cd tests` and trigger `phpunit`.
Make sure you did a `composer install` beforehand.
[1]: http://www.php-fig.org/psr/psr-1/
[2]: http://www.php-fig.org/psr/psr-4/
[3]: http://www.php-fig.org/psr/psr-2/
[4]: http://sabre.io/
[5]: irc://freenode.net/#sabredav
[6]: http://groups.google.com/group/sabredav-discuss
[7]: http://phpunit.de/

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