Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
florian HENRY 2017-01-09 16:51:54 +01:00
commit 232cacab80
54 changed files with 1237 additions and 669 deletions

View File

@ -0,0 +1,8 @@
#!/bin/sh
FROM=2016-01-01
TO=2016-12-31
echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l

View File

@ -0,0 +1,15 @@
#/bin/bash
Releases=("3.8" "3.9" "4.0" "5.0", "develop")
Dates=("2010-01-01", "2011-01-01", "2012-01-01", "2013-01-01", "2014-01-01", "2015-01-01", "2016-07-01")
let "counter = 1"
for i in "${Releases[@]}"
do
git shortlog -s -n --after=${Dates[counter-1]} --before=${Dates[counter]}
echo -n "Total $i: "
git log --pretty=oneline --after=${Dates[counter-1]} --before=${Dates[counter]} | wc -l
echo "======================="
echo
let "counter +=1"
done

View File

@ -888,18 +888,18 @@ if ($id)
{ {
if ($value == 'country') if ($value == 'country')
{ {
print '<td>'; print '<td class="liste_titre">';
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>'; print '</td>';
} }
else else
{ {
print '<td></td>'; print '<td class="liste_titre"></td>';
} }
} }
} }
if ($id == 4) print '<td></td>'; if ($id == 4) print '<td></td>';
print '<td></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" colspan="2" align="right">'; print '<td class="liste_titre" colspan="2" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;

View File

@ -235,9 +235,8 @@ print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60"
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">'; print '<td class="liste_titre">' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
print '<td>' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>'; print '<td class="liste_titre"></td>';
print '<td></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $langs->trans('From') . ': '; print $langs->trans('From') . ': ';
print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print $form->select_date($search_date_start, 'date_start', 0, 0, 1);
@ -247,10 +246,10 @@ print $form->select_date($search_date_end, 'date_end', 0, 0, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_mvt_label" value="' . $search_mvt_label . '"/></td>';
print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>'; print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_account" value="' . $search_label_account . '"/></td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
print '<td align="right" colspan="2" class="liste_titre">'; print '<td class="liste_titre" align="right" colspan="2">';
$searchpitco=$form->showFilterAndCheckAddButtons(0); $searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco; print $searchpitco;
print '</td>'; print '</td>';

View File

@ -29,6 +29,7 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.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 . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
// Langs // Langs
$langs->load("compta"); $langs->load("compta");
@ -179,7 +180,14 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 1) print '<a class="butActionDelete" hr
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " , " . MAIN_DB_PREFIX . "facture as f"; $sql .= " , " . MAIN_DB_PREFIX . "facture as f";
$sql .= " WHERE fd.fk_code_ventilation = 0"; $sql .= " WHERE fd.fk_code_ventilation = 0";
$sql .= " AND f.rowid = fd.fk_facture AND f.fk_statut = 1;"; $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 sql=" . $sql, LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -222,6 +230,11 @@ $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 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
$sql .= " AND aa.account_number IS NULL"; $sql .= " AND aa.account_number IS NULL";
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 .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
@ -273,6 +286,11 @@ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $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 .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
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 aa.account_number IS NOT NULL"; $sql .= " AND aa.account_number IS NOT NULL";
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label"; $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
@ -301,97 +319,105 @@ print "</table>\n";
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 ?
{
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print '<table class="noborder" width="100%">';
print "<br>\n"; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
print '<table class="noborder" width="100%">'; for($i = 1; $i <= 12; $i ++) {
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>'; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</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>'; 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) . ",";
}
$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 .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
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 . ")";
}
dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
$i ++;
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
if (! empty($conf->margin->enabled)) {
print "<br>\n";
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>';
}
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) . ",";
}
$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 .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
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 . ")";
}
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
}
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
}
} }
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) . ",";
}
$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 .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql);
if ($resql) {
$i = 0;
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
$i ++;
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
if (! empty($conf->margin->enabled)) {
print "<br>\n";
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>';
}
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) . ",";
}
$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 .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) {
print '<td align="right">' . price(price2num($row[$i])) . '</td>';
}
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
}
print "</table>\n";
print '</td></tr></table>';
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -210,6 +210,11 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx",$search_vat,1); $sql .= natural_search("l.tva_tx",$search_vat,1);
} }
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_STANDARD . "," . 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 $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);

View File

@ -290,55 +290,55 @@ print "</table>\n";
print '<br>'; 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 ?
print '<br>'; {
print '<br>';
print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
print "<br>\n"; print '<table class="noborder" width="100%">';
print '<table class="noborder" width="100%">'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; for($i = 1; $i <= 12; $i ++) {
for($i = 1; $i <= 12; $i ++) { print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 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) . ",";
}
$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 .= " 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 .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
} }
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) . ",";
}
$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 .= " 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 .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don't share object for accountancy
dol_syslog('/accountancy/expensereport/index.php:: sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -289,58 +289,56 @@ print "</table>\n";
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 ?
print '<br>'; {
print '<br>'; print '<br>';
print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n";
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 "<br>\n"; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
print '<table class="noborder" width="100%">'; }
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>'; $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) . ",";
}
$sql .= " ROUND(SUM(ffd.total_ht),2) 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 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
} }
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) . ",";
}
$sql .= " ROUND(SUM(ffd.total_ht),2) 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 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't share object for accountancy
dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($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>';
}
print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>';
}
$db->free($resql);
} else {
print $db->lasterror(); // Show last sql error
}
print "</table>\n";
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -104,6 +104,11 @@ if ($action == 'setvalue' && $user->admin)
* View * View
*/ */
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$form = new Form($db); $form = new Form($db);
llxHeader('',$langs->trans("PrintingSetup")); llxHeader('',$langs->trans("PrintingSetup"));
@ -127,70 +132,179 @@ if ($mode == 'setup' && $user->admin)
if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1; if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1;
if (! $supported) continue; // show only supported if (! $supported) continue; // show only supported
$OAUTH_SERVICENAME='Unknown';
if ($key[0] == 'OAUTH_GITHUB_NAME')
{
$OAUTH_SERVICENAME='GitHub';
$urltorenew=$urlwithroot.'/core/modules/oauth/github_oauthcallback.php?state=user,public_repo&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete=$urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms='https://github.com/settings/applications/';
}
if ($key[0] == 'OAUTH_GOOGLE_NAME')
{
$OAUTH_SERVICENAME='Google';
$urltorenew=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltodelete=$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
$urltocheckperms='https://security.google.com/settings/security/permissions';
}
// Show value of token
$tokenobj=null;
// Token
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
try
{
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
}
catch(Exception $e)
{
// Return an error if token not found
}
// Set other properties
$refreshtoken=false;
$expiredat='';
$expire = false;
// Is token expired or will token expire in the next 30 seconds
if (is_object($tokenobj)) {
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
}
if ($key[1] != '' && $key[2] != '') {
if (is_object($tokenobj)) {
$refreshtoken = $tokenobj->getRefreshToken();
$endoflife = $tokenobj->getEndOfLife();
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
{
$expiredat = $langs->trans("Never");
}
elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
{
$expiredat = $langs->trans("Unknown");
}
else
{
$expiredat=dol_print_date($endoflife, "dayhour");
}
}
}
$submit_enabled=0;
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&amp;driver='.$driver.'" autocomplete="off">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&amp;driver='.$driver.'" autocomplete="off">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setconst">'; print '<input type="hidden" name="action" value="setconst">';
print '<table class="noborder" width="100%">'."\n"; print '<table class="noborder" width="100%">'."\n";
$var=true;
$var=false;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Parameters").'</th>'; print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
print '<th>'.$langs->trans("Value").'</th>'; print '<th></th>';
print '<th>&nbsp;</th>'; print '<th></th>';
print "</tr>\n"; print "</tr>\n";
$submit_enabled=0;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class=required':'').'>'.$langs->trans($key['varname']).'</td>'; print '<td'.($key['required']?' class="required"':'').'>';
print '<td>'.$langs->trans($key['info']).'</td>'; //var_dump($key);
print $langs->trans("OAuthIDSecret").'</td>';
print '<td>';
print $langs->trans("SeePreviousTab");
print '</td>';
print '<td>'; print '<td>';
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
{
// Delete remote tokens
if (! empty($key['delete'])) print '<a class="button" href="'.$key['delete'].'">'.$langs->trans('DeleteAccess').'</a><br><br>';
// Request remote token
print '<a class="button" href="'.$key['renew'].'">'.$langs->trans('RequestAccess').'</a><br><br>';
// Check remote access
print $langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME_GOOGLE).': <a href="https://security.google.com/settings/security/permissions" target="_google">https://security.google.com/settings/security/permissions</a>';
}
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Show value of token $var = ! $var;
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
print $langs->trans("IsTokenGenerated");
print '</td>';
print '<td>';
if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
else print $langs->trans("NoAccessToken");
print '</td>';
print '<td>';
// Links to delete/checks token
if (is_object($tokenobj))
{ {
// Token //test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
print '<tr '.$bc[$var].'>'; print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br><br>';
print '<td>'.$langs->trans("Token").'</td>';
print '<td>';
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
try
{
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME_GOOGLE);
}
catch(Exception $e)
{
// Return an error if token not found
}
if (is_object($tokenobj))
{
//var_dump($tokenobj);
print $tokenobj->getAccessToken().'<br>';
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
//var_dump($tokenobj->getExtraParams());
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
print ''.join(',',$tokenobj->getExtraParams());
print '</textarea>';*/
}
print '</td>';
print '<td>';
print '</td>';
print '</tr>'."\n";
} }
// Request remote token
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br><br>';
// Check remote access
if ($urltocheckperms)
{
print $langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
}
print '</td>';
print '</tr>';
$var = ! $var;
print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
print $langs->trans("Token").'</td>';
print '<td colspan="2">';
if (is_object($tokenobj))
{
//var_dump($tokenobj);
print $tokenobj->getAccessToken().'<br>';
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
//var_dump($tokenobj->getExtraParams());
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
print ''.join(',',$tokenobj->getExtraParams());
print '</textarea>';*/
}
print '</td>';
print '</tr>'."\n";
if (is_object($tokenobj))
{
// Token refresh
$var = ! $var;
print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
print $langs->trans("TOKEN_REFRESH").'</td>';
print '<td colspan="2">';
print yn($refreshtoken);
print '</td>';
print '</tr>';
// Token expired
$var = ! $var;
print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
print $langs->trans("TOKEN_EXPIRED").'</td>';
print '<td colspan="2">';
print yn($expire);
print '</td>';
print '</tr>';
// Token expired at
$var = ! $var;
print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class="required"':'').'>';
//var_dump($key);
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
print '<td colspan="2">';
print $expiredat;
print '</td>';
print '</tr>';
}
print '</table>'; print '</table>';
if (! empty($driver)) if (! empty($driver))
@ -199,7 +313,8 @@ if ($mode == 'setup' && $user->admin)
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>'; print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>';
} }
} }
print '</form>'; print '</form>';
} }

View File

@ -82,8 +82,8 @@ $xmlremote = GETPOST('xmlremote')?GETPOST('xmlremote'):'https://www.dolibarr.org
// Test if remote test is ok // Test if remote test is ok
$enableremotecheck = True; $enableremotecheck = True;
if (preg_match('/beta|alpha/i', DOL_VERSION)) $enableremotecheck=False; if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || ! empty($conf->global->MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE)) $enableremotecheck=False;
$enableremotecheck = true;
print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("MakeIntegrityAnalysisFrom").':<br>'; print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
@ -101,7 +101,8 @@ else
print '<!-- for a remote target=remote&xmlremote=... -->'."\n"; print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
if ($enableremotecheck) if ($enableremotecheck)
{ {
print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = '.$xmlremote.'<br>'; print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = ';
print '<input name="xmlremote" class="flat quatrevingtpercent" value="'.$xmlremote.'"><br>';
} }
else else
{ {
@ -156,19 +157,25 @@ if ($xml)
$file_list = array(); $file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
print_fiche_titre($langs->trans("FilesMissing"));
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>' . $langs->trans("FilesMissing") . '</td>'; print '<td>#</td>';
print '<td>' . $langs->trans("Filename") . '</td>';
print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>'; print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
$var = true; $var = true;
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename'); $tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
if (is_array($tmpfilelist) && count($tmpfilelist)) if (is_array($tmpfilelist) && count($tmpfilelist))
{ {
$i = 0;
foreach ($tmpfilelist as $file) foreach ($tmpfilelist as $file)
{ {
$i++;
$var = !$var; $var = !$var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td>'.$i.'</td>' . "\n";
print '<td>'.$file['filename'].'</td>' . "\n"; print '<td>'.$file['filename'].'</td>' . "\n";
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n"; print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
print "</tr>\n"; print "</tr>\n";
@ -176,15 +183,18 @@ if ($xml)
} }
else else
{ {
print '<tr ' . $bc[false] . '><td colspan="2" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; print '<tr ' . $bc[false] . '><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
} }
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("FilesUpdated"));
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>' . $langs->trans("FilesUpdated") . '</td>'; print '<td>#</td>';
print '<td>' . $langs->trans("Filename") . '</td>';
print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>'; print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
print '<td align="center">' . $langs->trans("CurrentChecksum") . '</td>'; print '<td align="center">' . $langs->trans("CurrentChecksum") . '</td>';
print '<td align="right">' . $langs->trans("Size") . '</td>'; print '<td align="right">' . $langs->trans("Size") . '</td>';
@ -194,10 +204,13 @@ if ($xml)
$tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename'); $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
if (is_array($tmpfilelist2) && count($tmpfilelist2)) if (is_array($tmpfilelist2) && count($tmpfilelist2))
{ {
$i = 0;
foreach ($tmpfilelist2 as $file) foreach ($tmpfilelist2 as $file)
{ {
$i++;
$var = !$var; $var = !$var;
print '<tr ' . $bc[$var] . '>'; print '<tr ' . $bc[$var] . '>';
print '<td>'.$i.'</td>' . "\n";
print '<td>'.$file['filename'].'</td>' . "\n"; print '<td>'.$file['filename'].'</td>' . "\n";
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n"; print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
print '<td align="center">'.$file['md5'].'</td>' . "\n"; print '<td align="center">'.$file['md5'].'</td>' . "\n";
@ -241,14 +254,12 @@ if ($xml)
//var_dump($checksumconcat); //var_dump($checksumconcat);
$checksumget = md5(join(',',$checksumconcat)); $checksumget = md5(join(',',$checksumconcat));
$checksumtoget = $xml->dolibarr_htdocs_dir_checksum; $checksumtoget = $xml->dolibarr_htdocs_dir_checksum;
if ($checksumtoget)
{ print '<br>';
print '<br>';
print '<strong>'.$langs->trans("GlobalChecksum").'</strong><br>'; print_fiche_titre($langs->trans("GlobalChecksum")).'<br>';
print $langs->trans("ExpectedChecksum").' = '.$checksumtoget.'<br>'; print $langs->trans("ExpectedChecksum").' = '. ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")) .'<br>';
print $langs->trans("CurrentChecksum").' = '.$checksumget; print $langs->trans("CurrentChecksum").' = '.$checksumget;
}
} }

View File

@ -39,7 +39,7 @@ if (GETPOST('msg','alpha')) {
} }
$urldolibarr='http://www.dolibarr.org/downloads/'; $urldolibarr='https://www.dolibarr.org/downloads/';
$urldolibarrmodules='https://www.dolistore.com/'; $urldolibarrmodules='https://www.dolistore.com/';
$urldolibarrthemes='https://www.dolistore.com/'; $urldolibarrthemes='https://www.dolistore.com/';
$dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT); $dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);

View File

@ -106,23 +106,23 @@ $langs->load("cashdesk");
<th><?php echo $langs->trans("VATRate"); ?></th> <th><?php echo $langs->trans("VATRate"); ?></th>
</tr> </tr>
<tr> <tr>
<td><input class="texte1" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" /> <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtQte" name="txtQte" value="1" onkeyup="javascript: modif();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtQte", "frmQte");?> <?php print genkeypad("txtQte", "frmQte");?>
</td> </td>
<!-- Affichage du stock pour l'article courant --> <!-- Affichage du stock pour l'article courant -->
<td> <td>
<input class="texte1_off" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled /> <input class="texte1_off maxwidth50onsmartphone" type="text" name="txtStock" value="<?php echo $obj_facturation->stock() ?>" disabled />
</td> </td>
<!-- Show unit price --> <!-- Show unit price -->
<?php // TODO Remove the disabled and use this value when adding product into cart ?> <?php // TODO Remove the disabled and use this value when adding product into cart ?>
<td><input class="texte1_off" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td> <td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtPrixUnit" value="<?php echo price2num($obj_facturation->prix(), 'MU'); ?>" onchange="javascript: modif();" disabled /></td>
<td></td> <td></td>
<!-- Choix de la remise --> <!-- Choix de la remise -->
<td><input class="texte1" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/> <td><input class="texte1 maxwidth50onsmartphone" type="text" id="txtRemise" name="txtRemise" value="0" onkeyup="javascript: modif();" onfocus="javascript: this.select();"/>
<?php print genkeypad("txtRemise", "frmQte");?> <?php print genkeypad("txtRemise", "frmQte");?>
</td> </td>
<!-- Affichage du total HT --> <!-- Affichage du total HT -->
<td><input class="texte1_off" type="text" name="txtTotal" value="" disabled /></td><td></td> <td><input class="texte1_off maxwidth50onsmartphone" type="text" name="txtTotal" value="" disabled /></td><td></td>
<!-- Choix du taux de TVA --> <!-- Choix du taux de TVA -->
<td class="select_tva"> <td class="select_tva">
<?php //var_dump($tab_tva); ?> <?php //var_dump($tab_tva); ?>
@ -155,17 +155,17 @@ $langs->load("cashdesk");
<input type="hidden" name="hdnChoix" value="" /> <input type="hidden" name="hdnChoix" value="" />
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend> <fieldset class="cadre_facturation"><legend class="titre1"><?php echo $langs->trans("Amount"); ?></legend>
<table> <table class="centpercent">
<tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr> <tr><th class="label1"><?php echo $langs->trans("TotalTicket"); ?></th><th class="label1"><?php echo $langs->trans("Received"); ?></th><th class="label1"><?php echo $langs->trans("Change"); ?></th></tr>
<tr> <tr>
<!-- Affichage du montant du --> <!-- Affichage du montant du -->
<td><input class="texte2_off" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td> <td><input class="texte2_off maxwidthonsmartphone" type="text" name="txtDu" value="<?php echo price2num($obj_facturation->prixTotalTtc(), 'MT'); ?>" disabled /></td>
<!-- Choix du montant encaisse --> <!-- Choix du montant encaisse -->
<td><input class="texte2" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" /> <td><input class="texte2 maxwidthonsmartphone" type="text" id="txtEncaisse" name="txtEncaisse" value="" onkeyup="javascript: verifDifference();" onfocus="javascript: this.select();" />
<?php print genkeypad("txtEncaisse", "frmDifference");?> <?php print genkeypad("txtEncaisse", "frmDifference");?>
</td> </td>
<!-- Affichage du montant rendu --> <!-- Affichage du montant rendu -->
<td><input class="texte2_off" type="text" name="txtRendu" value="0" disabled /></td> <td><input class="texte2_off maxwidthonsmartphone" type="text" name="txtRendu" value="0" disabled /></td>
</tr> </tr>
<tr> <tr>
</table> </table>

View File

@ -223,7 +223,7 @@ if (empty($reshook))
} }
} }
// Categorisation dans projet // Link to a project
else if ($action == 'classin' && $user->rights->commande->creer) else if ($action == 'classin' && $user->rights->commande->creer)
{ {
$object->setProject(GETPOST('projectid')); $object->setProject(GETPOST('projectid'));

View File

@ -3299,84 +3299,90 @@ abstract class CommonObject
$usemargins=0; $usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1; if (! empty($conf->margin->enabled) && ! empty($this->element) && in_array($this->element,array('facture','propal','commande'))) $usemargins=1;
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>';
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
if ($this->element == 'supplier_proposal')
{
print '<td class="linerefsupplier" align="right"><span id="title_fourn_ref">'.$langs->trans("SupplierProposalRefFourn").'</span></td>';
}
// VAT
print '<td class="linecolvat" align="right" width="80">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td class="linecolqty" align="right">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit" align="left">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td class="linecoldiscount" align="right">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
if (!empty($user->rights->margins->creer))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('CostPrice').'</td>';
}
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
// Total HT
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if ($outputalsopricetotalwithtax) print '<td align="right" width="80">'.$langs->trans('TotalTTCShort').'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td class="linecoldelete" width="10"></td>';
print '<td class="linecolmove" width="10"></td>';
print "</tr>\n";
$num = count($this->lines); $num = count($this->lines);
$var = true;
$i = 0;
//Line extrafield //Line extrafield
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline = new ExtraFields($this->db); $extrafieldsline = new ExtraFields($this->db);
$extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line); $extralabelslines=$extrafieldsline->fetch_name_optionals_label($this->table_element_line);
$parameters = array('num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline);
$reshook = $hookmanager->executeHooks('printObjectLineTitle', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>';
// Description
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
if ($this->element == 'supplier_proposal')
{
print '<td class="linerefsupplier" align="right"><span id="title_fourn_ref">'.$langs->trans("SupplierProposalRefFourn").'</span></td>';
}
// VAT
print '<td class="linecolvat" align="right" width="80">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoluht_currency" align="right" width="80">'.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td class="linecolqty" align="right">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td class="linecoluseunit" align="left">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td class="linecoldiscount" align="right">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) {
print '<td class="linecolcycleref" align="right">' . $langs->trans('Progress') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
if (!empty($user->rights->margins->creer))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('CostPrice').'</td>';
}
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
// Total HT
print '<td class="linecolht" align="right">'.$langs->trans('TotalHTShort').'</td>';
// Multicurrency
if (!empty($conf->multicurrency->enabled)) print '<td class="linecoltotalht_currency" align="right">'.$langs->trans('TotalHTShortCurrency', $this->multicurrency_code).'</td>';
if ($outputalsopricetotalwithtax) print '<td align="right" width="80">'.$langs->trans('TotalTTCShort').'</td>';
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td class="linecoldelete" width="10"></td>';
print '<td class="linecolmove" width="10"></td>';
print "</tr>\n";
}
$var = true;
$i = 0;
foreach ($this->lines as $line) foreach ($this->lines as $line)
{ {
@ -3395,7 +3401,7 @@ abstract class CommonObject
} }
else else
{ {
$parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline); $parameters = array('line'=>$line,'var'=>$var,'num'=>$num,'i'=>$i,'dateSelector'=>$dateSelector,'seller'=>$seller,'buyer'=>$buyer,'selected'=>$selected, 'extrafieldsline'=>$extrafieldsline, 'fk_parent_line'=>$line->fk_parent_line);
$reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('printObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} }
} }

View File

@ -79,7 +79,7 @@ class FormProjets
$project->fetch($selected); $project->fetch($selected);
$selected_input_value=$project->ref; $selected_input_value=$project->ref;
} }
$urloption='socid='.$socid.'&htmlname='.$htmlname; $urloption='socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed;
$out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( $out.=ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array(
// 'update' => array( // 'update' => array(
// 'projectid' => 'id' // 'projectid' => 'id'
@ -458,13 +458,16 @@ class FormProjets
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done) if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$linkedtothirdparty=false; $linkedtothirdparty=false;
if (! in_array($table_element, array('don','expensereport_det','expensereport'))) $linkedtothirdparty=true; if (! in_array($table_element, array('don','expensereport_det','expensereport','loan'))) $linkedtothirdparty=true;
$sqlfilter=''; $sqlfilter='';
$projectkey="fk_projet"; $projectkey="fk_projet";
//print $table_element; //print $table_element;
switch ($table_element) switch ($table_element)
{ {
case "loan":
$sql = "SELECT t.rowid, t.label as ref";
break;
case "facture": case "facture":
$sql = "SELECT t.rowid, t.facnumber as ref"; $sql = "SELECT t.rowid, t.facnumber as ref";
break; break;

View File

@ -203,7 +203,7 @@ function getBrowserInfo($user_agent)
elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { $name='opera'; $version=$reg[2]; }
elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];\srv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { $name='ie'; $version=end($reg); } // MS products at end
elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { $name='lynxlinks'; $version=$reg[4]; }
if ($tablet) { if ($tablet) {
$layout = 'tablet'; $layout = 'tablet';
} elseif ($phone) { } elseif ($phone) {
@ -268,14 +268,14 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
{ {
$tmp=dol_getdate(dol_now(), true); $tmp=dol_getdate(dol_now(), true);
$out = $tmp['mon']; $out = $tmp['mon'];
} }
elseif ($reg[1] == 'YEAR') elseif ($reg[1] == 'YEAR')
{ {
$tmp=dol_getdate(dol_now(), true); $tmp=dol_getdate(dol_now(), true);
$out = $tmp['year']; $out = $tmp['year'];
} }
} }
switch ($check) switch ($check)
{ {
case 'int': case 'int':
@ -409,15 +409,15 @@ function dol_buildpath($path, $type=0)
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
if ($type == 3) $res = DOL_URL_ROOT.'/'.$path; if ($type == 3) $res = DOL_URL_ROOT.'/'.$path;
foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) foreach ($conf->file->dol_document_root as $key => $dirroot) // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
{ {
if ($key == 'main') if ($key == 'main')
{ {
if ($type == 3) if ($type == 3)
{ {
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
@ -444,12 +444,12 @@ function dol_buildpath($path, $type=0)
if ($type == 3) if ($type == 3)
{ {
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
// Define $urlwithroot // Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax $res=(preg_match('/^http/i',$conf->file->dol_url_root[$key])?'':$urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
} }
break; break;
@ -716,13 +716,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
throw new Exception('Incorrect log level'); throw new Exception('Incorrect log level');
} }
if ($level > $conf->global->SYSLOG_LEVEL) return; if ($level > $conf->global->SYSLOG_LEVEL) return;
// If adding log inside HTML page is required // If adding log inside HTML page is required
if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility if (! empty($_REQUEST['logtohtml']) && (! empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || ! empty($conf->global->MAIN_LOGTOHTML))) // MAIN_LOGTOHTML kept for backward compatibility
{ {
$conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message; $conf->logbuffer[] = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".$message;
} }
//TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output
// If enable html log tag enabled and url parameter log defined, we show output log on HTML comments // If enable html log tag enabled and url parameter log defined, we show output log on HTML comments
if (! empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && ! empty($_GET["log"])) if (! empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && ! empty($_GET["log"]))
@ -731,7 +731,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
print $message."\n"; print $message."\n";
print "Log end -->\n"; print "Log end -->\n";
} }
$data = array( $data = array(
'message' => $message, 'message' => $message,
'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false), 'script' => (isset($_SERVER['PHP_SELF'])? basename($_SERVER['PHP_SELF'],'.php') : false),
@ -739,7 +739,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
'user' => ((is_object($user) && $user->id) ? $user->login : false), 'user' => ((is_object($user) && $user->id) ? $user->login : false),
'ip' => false 'ip' => false
); );
if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR']; if (! empty($_SERVER["REMOTE_ADDR"])) $data['ip'] = $_SERVER['REMOTE_ADDR'];
// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache)
else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR']; else if (! empty($_SERVER['SERVER_ADDR'])) $data['ip'] = $_SERVER['SERVER_ADDR'];
@ -926,7 +926,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
{ {
$out = $hookmanager->resPrint; $out = $hookmanager->resPrint;
} }
return $out; return $out;
} }
@ -985,7 +985,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'member') $modulepart='memberphoto'; if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto'; if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product'; if ($object->element == 'product') $modulepart='product';
if ($object->element == 'product') if ($object->element == 'product')
{ {
$width=80; $cssclass='photoref'; $width=80; $cssclass='photoref';
@ -993,7 +993,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5); $maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
if ($conf->browser->phone) $maxvisiblephotos=1; if ($conf->browser->phone) $maxvisiblephotos=1;
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos($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($conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
else else
{ {
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
$nophoto=''; $nophoto='';
@ -1003,14 +1003,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$nophoto='/public/theme/common/nophoto.png'; $nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>'; $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
} }
} }
} }
else else
{ {
if ($showimage) if ($showimage)
{ {
if ($modulepart != 'unknown') if ($modulepart != 'unknown')
{ {
$phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos); $phototoshow = $form->showphoto($modulepart,$object,0,0,0,'photoref','small',1,0,$maxvisiblephotos);
if ($phototoshow) if ($phototoshow)
@ -1023,7 +1023,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
elseif ($conf->browser->layout != 'phone') // Show no photo link elseif ($conf->browser->layout != 'phone') // Show no photo link
{ {
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'; $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
if ($object->element == 'action') if ($object->element == 'action')
{ {
$cssclass='photorefcenter'; $cssclass='photorefcenter';
$nophoto=img_picto('', 'title_agenda', '', false, 1); $nophoto=img_picto('', 'title_agenda', '', false, 1);
@ -1042,7 +1042,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>'; if ($showbarcode) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
} }
elseif ($object->element == 'product') elseif ($object->element == 'product')
{ {
//$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') '; //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Sell").') ';
@ -1062,7 +1062,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
elseif ($object->element == 'facture' || $object->element == 'invoice' || $object->element == 'invoice_supplier') elseif ($object->element == 'facture' || $object->element == 'invoice' || $object->element == 'invoice_supplier')
{ {
$tmptxt=$object->getLibStatut(6, $object->totalpaye); $tmptxt=$object->getLibStatut(6, $object->totalpaye);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5, $object->totalpaye);
$morehtmlstatus.=$tmptxt; $morehtmlstatus.=$tmptxt;
} }
elseif ($object->element == 'chargesociales') elseif ($object->element == 'chargesociales')
@ -1084,7 +1084,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
} }
else { // Generic case else { // Generic case
$tmptxt=$object->getLibStatut(6); $tmptxt=$object->getLibStatut(6);
if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || $conf->browser->layout=='phone') $tmptxt=$object->getLibStatut(5);
$morehtmlstatus.=$tmptxt; $morehtmlstatus.=$tmptxt;
} }
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
@ -1278,9 +1278,9 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
$reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0; $reduceformat=(! empty($conf->dol_optimize_smallscreen) && in_array($format,array('day','dayhour')))?1:0;
$formatwithoutreduce = preg_replace('/reduceformat/','',$format); $formatwithoutreduce = preg_replace('/reduceformat/','',$format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat=1; } // so format 'dayreduceformat' is processed like day
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
// TODO Add format daysmallyear and dayhoursmallyear // TODO Add format daysmallyear and dayhoursmallyear
if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short); if ($format == 'day') $format=($outputlangs->trans("FormatDateShort")!="FormatDateShort"?$outputlangs->trans("FormatDateShort"):$conf->format_date_short);
else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short); else if ($format == 'hour') $format=($outputlangs->trans("FormatHourShort")!="FormatHourShort"?$outputlangs->trans("FormatHourShort"):$conf->format_hour_short);
else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration); else if ($format == 'hourduration') $format=($outputlangs->trans("FormatHourShortDuration")!="FormatHourShortDuration"?$outputlangs->trans("FormatHourShortDuration"):$conf->format_hour_short_duration);
@ -1782,7 +1782,7 @@ function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$sep
$newphone=($separ!=''?'(':'').substr($newphone,0,3).($separ!=''?')':'').$separ.substr($newphone,3,3).($separ!=''?'-':'').substr($newphone,6,4); $newphone=($separ!=''?'(':'').substr($newphone,0,3).($separ!=''?')':'').$separ.substr($newphone,3,3).($separ!=''?'-':'').substr($newphone,6,4);
} }
} }
if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) if (! empty($addlink)) // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
{ {
if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone if (! empty($conf->browser->phone) || (! empty($conf->clicktodial->enabled) && ! empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) // If phone or option for, we use link of phone
@ -1912,7 +1912,7 @@ function dol_user_country()
* @param int $mode thirdparty|contact|member|other * @param int $mode thirdparty|contact|member|other
* @param int $id Id of object * @param int $id Id of object
* @param int $noprint No output. Result is the function return * @param int $noprint No output. Result is the function return
* @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br. * @param string $charfornl Char to use instead of nl2br. '' means we use a standad nl2br.
* @return string|void Nothing if noprint is 0, formatted address if noprint is 1 * @return string|void Nothing if noprint is 0, formatted address if noprint is 1
* @see dol_format_address * @see dol_format_address
*/ */
@ -1933,7 +1933,7 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0, $charfornl
{ {
if (empty($charfornl)) $out.=nl2br($address); if (empty($charfornl)) $out.=nl2br($address);
else $out.=preg_replace('/[\r\n]+/', $charfornl, $address); else $out.=preg_replace('/[\r\n]+/', $charfornl, $address);
$showgmap=$showomap=0; $showgmap=$showomap=0;
// TODO Add a hook here // TODO Add a hook here
@ -2061,7 +2061,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>'; print '<div class="nographyettext">'.$langs->trans("NotEnoughDataYet").'</div>';
return; return;
} }
if (empty($conf->use_javascript_ajax)) return; if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot'; $jsgraphlib='flot';
$datacolor=array(); $datacolor=array();
@ -2230,7 +2230,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
global $conf; global $conf;
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string; if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
if (empty($stringencoding)) $stringencoding='UTF-8'; if (empty($stringencoding)) $stringencoding='UTF-8';
// reduce for small screen // reduce for small screen
if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3); if ($conf->dol_optimize_smallscreen==1 && $display==1) $size = round($size/3);
@ -3196,11 +3196,11 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=-1, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=-1, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0)
{ {
global $conf,$langs; global $conf,$langs;
$savlimit = $limit; $savlimit = $limit;
$savtotalnboflines = $totalnboflines; $savtotalnboflines = $totalnboflines;
$totalnboflines=abs($totalnboflines); $totalnboflines=abs($totalnboflines);
if ($picto == 'setup') $picto='title_setup.png'; if ($picto == 'setup') $picto='title_setup.png';
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif'; if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
if ($limit < 0) $limit = $conf->liste_limit; if ($limit < 0) $limit = $conf->liste_limit;
@ -3213,7 +3213,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
$nextpage = 0; $nextpage = 0;
} }
//print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage; //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
print "\n"; print "\n";
print "<!-- Begin title '".$titre."' -->\n"; print "<!-- Begin title '".$titre."' -->\n";
print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>'; print '<table width="100%" border="0" class="notopnoleftnoright'.($morecss?' '.$morecss:'').'" style="margin-bottom: 6px;"><tr>';
@ -3314,7 +3314,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
//$pagesizechoices.=',2:2'; //$pagesizechoices.=',2:2';
if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES; if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES;
print '<li class="pagination">'; print '<li class="pagination">';
print '<select class="flat selectlimit" name="limit">'; print '<select class="flat selectlimit" name="limit">';
$tmpchoice=explode(',',$pagesizechoices); $tmpchoice=explode(',',$pagesizechoices);
@ -3354,7 +3354,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
</script> </script>
'; ';
} }
print '</li>'; print '</li>';
} }
if ($page > 0) if ($page > 0)
{ {
@ -3393,7 +3393,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0) function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
{ {
$morelabel=''; $morelabel='';
if (preg_match('/%/',$rate)) if (preg_match('/%/',$rate))
{ {
$rate=str_replace('%','',$rate); $rate=str_replace('%','',$rate);
@ -3596,7 +3596,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
/** /**
* Output a dimension with best unit * Output a dimension with best unit
* *
* @param float $dimension Dimension * @param float $dimension Dimension
* @param int $unit Unit of dimension (0, -3, ...) * @param int $unit Unit of dimension (0, -3, ...)
* @param string $type 'weight', 'volume', ... * @param string $type 'weight', 'volume', ...
@ -3608,16 +3608,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no') function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) if (($forceunitoutput == 'no' && $dimension < 1/10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6))
{ {
$dimension = $dimension * 1000000; $dimension = $dimension * 1000000;
$unit = $unit - 6; $unit = $unit - 6;
} }
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3)) elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
{ {
$dimension = $dimension * 1000; $dimension = $dimension * 1000;
$unit = $unit - 3; $unit = $unit - 3;
} }
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6)) elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
{ {
@ -3629,9 +3629,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
$dimension = $dimension / 1000; $dimension = $dimension / 1000;
$unit = $unit + 3; $unit = $unit + 3;
} }
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); $ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
return $ret; return $ret;
} }
@ -3662,12 +3662,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
$vatratecleaned = trim($reg[1]); $vatratecleaned = trim($reg[1]);
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code) /*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
{ {
return 0; return 0;
}*/ }*/
// Some test to guess with no need to make database access // Some test to guess with no need to make database access
if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe if ($mysoc->country_code == 'ES') // For spain localtaxes 1 and 2, tax is qualified if buyer use local taxe
{ {
@ -3765,7 +3765,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local==1) return $obj->localtax1; if ($local==1) return $obj->localtax1;
elseif ($local==2) return $obj->localtax2; elseif ($local==2) return $obj->localtax2;
} }
return 0; return 0;
} }
@ -3825,7 +3825,7 @@ function get_localtax_by_third($local)
/** /**
* Get vat rate and npr from id. * Get vat rate and npr from id.
* You can call getLocalTaxesFromRate after to get other fields * You can call getLocalTaxesFromRate after to get other fields
* *
* @param int $vatrowid Line ID into vat rate table. * @param int $vatrowid Line ID into vat rate table.
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
@ -3879,7 +3879,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$vatratecleaned = $reg[1]; $vatratecleaned = $reg[1];
$vatratecode = $reg[2]; $vatratecode = $reg[2];
} }
// Search local taxes // Search local taxes
$sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
$sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
@ -3892,7 +3892,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; $sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'"; if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
} }
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
@ -4299,7 +4299,7 @@ function yn($yesno, $case=1, $color=0)
/** /**
* Return a path to have a directory according to object. * Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') * New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/" * Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
* *
* @param string $num Id of object (deprecated, $object will be used in future) * @param string $num Id of object (deprecated, $object will be used in future)
* @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future) * @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
@ -4316,7 +4316,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
$path = ''; $path = '';
$arrayforoldpath=array('cheque','user','category','holiday','shipment','supplier_invoice','invoice_supplier','mailing'); $arrayforoldpath=array('cheque','user','category','holiday','shipment','supplier_invoice','invoice_supplier','mailing');
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product'; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath)) if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{ {
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
@ -4469,7 +4469,7 @@ function dolGetFirstLineOfText($text)
{ {
$firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters $firstline=preg_replace('/<br[^>]*>.*$/s','',$text); // The s pattern modifier means the . can match newline characters
$firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters $firstline=preg_replace('/<div[^>]*>.*$/s','',$firstline); // The s pattern modifier means the . can match newline characters
} }
else else
{ {
@ -5375,7 +5375,7 @@ function picto_from_langcode($codelang)
} }
/** /**
* Complete or removed entries into a head array (used to build tabs). * Complete or removed entries into a head array (used to build tabs).
* For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab']. * For example, with value added by external modules. Such values are declared into $conf->modules_parts['tab'].
* Or by change using hook completeTabsHead * Or by change using hook completeTabsHead
* *
@ -5405,7 +5405,7 @@ function picto_from_langcode($codelang)
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add') function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{ {
global $hookmanager; global $hookmanager;
if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type])) if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type]))
{ {
foreach ($conf->modules_parts['tabs'][$type] as $value) foreach ($conf->modules_parts['tabs'][$type] as $value)
@ -5471,7 +5471,7 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
} }
} }
} }
// No need to make a return $head. Var is modified as a reference // No need to make a return $head. Var is modified as a reference
if (! empty($hookmanager)) if (! empty($hookmanager))
{ {
@ -5509,11 +5509,11 @@ function printCommonFooter($zone='private')
{ {
print '<!-- Reposition management (does not work if a redirect is done after action of submission) -->'."\n"; print '<!-- Reposition management (does not work if a redirect is done after action of submission) -->'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n"; print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() {'."\n";
print '<!-- If page_y set, we set scollbar with it -->'."\n"; print '<!-- If page_y set, we set scollbar with it -->'."\n";
print "page_y=getParameterByName('page_y', 0);"; print "page_y=getParameterByName('page_y', 0);";
print "if (page_y > 0) $('html, body').scrollTop(page_y);\n"; print "if (page_y > 0) $('html, body').scrollTop(page_y);\n";
print '<!-- Set handler to add page_y param on some a href links -->'."\n"; print '<!-- Set handler to add page_y param on some a href links -->'."\n";
print 'jQuery(".reposition").click(function() { print 'jQuery(".reposition").click(function() {
var page_y = $(document).scrollTop(); var page_y = $(document).scrollTop();
@ -5533,7 +5533,7 @@ function printCommonFooter($zone='private')
print '</script>'."\n"; print '</script>'."\n";
} }
// Google Analytics (need Google module) // Google Analytics (need Google module)
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
{ {
@ -5677,7 +5677,7 @@ function dol_getmypid()
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000" * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4" * If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4') * @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
* @param integer $nofirstand 1=Do now output the first 'AND' * @param integer $nofirstand 1=Do not output the first 'AND'
* @return string $res The statement to append to the SQL query * @return string $res The statement to append to the SQL query
*/ */
function natural_search($fields, $value, $mode=0, $nofirstand=0) function natural_search($fields, $value, $mode=0, $nofirstand=0)
@ -5692,6 +5692,9 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
{ {
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do $value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
} }
$value = preg_replace('/\s*\|\s*/','|', $value);
$crits = explode(' ', $value); $crits = explode(' ', $value);
$res = ''; $res = '';
if (! is_array($fields)) $fields = array($fields); if (! is_array($fields)) $fields = array($fields);
@ -5746,15 +5749,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
$tmpcrit=trim($tmpcrit); $tmpcrit=trim($tmpcrit);
$tmpcrit2=$tmpcrit; $tmpcrit2=$tmpcrit;
$tmpbefore='%'; $tmpafter='%'; $tmpbefore='%'; $tmpafter='%';
if (preg_match('/^[\^\$]/', $tmpcrit)) if (preg_match('/^[\^\$]/', $tmpcrit))
{ {
$tmpbefore=''; $tmpbefore='';
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2); $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
} }
if (preg_match('/[\^\$]$/', $tmpcrit)) if (preg_match('/[\^\$]$/', $tmpcrit))
{ {
$tmpafter=''; $tmpafter='';
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2); $tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
} }
$newres .= $tmpbefore; $newres .= $tmpbefore;
$newres .= $db->escape($tmpcrit2); $newres .= $db->escape($tmpcrit2);
@ -5819,7 +5822,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
function getAdvancedPreviewUrl($modulepart, $relativepath) function getAdvancedPreviewUrl($modulepart, $relativepath)
{ {
global $conf; global $conf;
if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->use_javascript_ajax)) return '';
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css'); $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');

View File

@ -26,9 +26,13 @@
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
$supportedoauth2array=array( $supportedoauth2array=array(
'OAUTH_GOOGLE_NAME'=>'google', 'OAUTH_GOOGLE_NAME'=>'google',
'OAUTH_GITHUB_NAME'=>'github'
); );
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
{
$supportedoauth2array['OAUTH_GITHUB_NAME']='github';
}
$supportedoauth2array['OAUTH_GITHUB_NAME']='github';
// API access parameters OAUTH // API access parameters OAUTH
$list = array ( $list = array (
array( array(
@ -264,7 +268,7 @@ function oauthadmin_prepare_head()
$h++; $h++;
$head[$h][0] = dol_buildpath('/admin/oauthlogintokens.php', 1); $head[$h][0] = dol_buildpath('/admin/oauthlogintokens.php', 1);
$head[$h][1] = $langs->trans("ManualTokenGeneration"); $head[$h][1] = $langs->trans("TokenManager");
$head[$h][2] = 'tokengeneration'; $head[$h][2] = 'tokengeneration';
$h++; $h++;

View File

@ -111,13 +111,13 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$chaine=""; $chaine="";
if (! empty($conf->product->enabled)) { if (! empty($conf->product->enabled)) {
$chaine.=$langs->trans("Products"); $chaine.=$langs->trans("TMenuProducts");
} }
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) {
$chaine.="/"; $chaine.=" | ";
} }
if (! empty($conf->service->enabled)) { if (! empty($conf->service->enabled)) {
$chaine.=$langs->trans("Services"); $chaine.=$langs->trans("TMenuServices");
} }
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
@ -261,7 +261,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$idsel='tools'; $idsel='tools';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode);
if (empty($noout)) print_text_menu_entry($langs->trans("Tools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget); if (empty($noout)) print_text_menu_entry($langs->trans("TMenuTools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode); if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", ''); $menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
} }

View File

@ -189,7 +189,7 @@ class modAgenda extends DolibarrModules
// $r++; // $r++;
$this->menu[$r]=array('fk_menu'=>0, $this->menu[$r]=array('fk_menu'=>0,
'type'=>'top', 'type'=>'top',
'titre'=>'Agenda', 'titre'=>'TMenuAgenda',
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php', 'url'=>'/comm/action/index.php',
'langs'=>'agenda', 'langs'=>'agenda',

View File

@ -0,0 +1,171 @@
<?php
/*
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/modules/oauth/github_oauthcallback.php
* \ingroup oauth
* \brief Page to get oauth callback
*/
require '../../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
use OAuth\Common\Storage\DoliStorage;
use OAuth\Common\Consumer\Credentials;
use OAuth\OAuth2\Service\GitHub;
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$action = GETPOST('action', 'alpha');
$backtourl = GETPOST('backtourl', 'alpha');
/**
* Create a new instance of the URI class with the current URI, stripping the query string
*/
$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
//$currentUri->setQuery('');
$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/github_oauthcallback.php');
/**
* Load the credential for the service
*/
/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */
$serviceFactory = new \OAuth\ServiceFactory();
$httpClient = new \OAuth\Common\Http\Client\CurlClient();
// TODO Set options for proxy and timeout
// $params=array('CURLXXX'=>value, ...)
//$httpClient->setCurlParameters($params);
$serviceFactory->setHttpClient($httpClient);
// Dolibarr storage
$storage = new DoliStorage($db, $conf);
// Setup the credentials for the requests
$credentials = new Credentials(
$conf->global->OAUTH_GITHUB_ID,
$conf->global->OAUTH_GITHUB_SECRET,
$currentUri->getAbsoluteUri()
);
$requestedpermissionsarray=array();
if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back
if ($action != 'delete' && empty($requestedpermissionsarray))
{
print 'Error, parameter state is not defined';
exit;
}
//var_dump($requestedpermissionsarray);exit;
// Instantiate the Api service using the credentials, http client and storage mechanism for the token
/** @var $apiService Service */
$apiService = $serviceFactory->createService('GitHub', $credentials, $storage, $requestedpermissionsarray);
// access type needed to have oauth provider refreshing token
//$apiService->setAccessType('offline');
$langs->load("oauth");
/*
* Actions
*/
if ($action == 'delete')
{
$storage->clearToken('GitHub');
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
header('Location: ' . $backtourl);
exit();
}
if (! empty($_GET['code'])) // We are coming from oauth provider page
{
//llxHeader('',$langs->trans("OAuthSetup"));
//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
//print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
//dol_fiche_head();
// retrieve the CSRF state parameter
$state = isset($_GET['state']) ? $_GET['state'] : null;
//print '<table>';
// This was a callback request from service, get the token
try {
//var_dump($_GET['code']);
//var_dump($state);
//var_dump($apiService); // OAuth\OAuth2\Service\GitHub
//$token = $apiService->requestAccessToken($_GET['code'], $state);
$token = $apiService->requestAccessToken($_GET['code']);
// Github is a service that does not need state yo be stored.
// Into constructor of GitHub, the call
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
// has not the ending parameter to true like the Google class constructor.
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
} catch (Exception $e) {
print $e->getMessage();
}
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
header('Location: ' . $backtourl);
exit();
}
else // If entry on page with no parameter, we arrive here
{
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state'))
{
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
}
else
{
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
}
// we go on oauth provider authorization page
header('Location: ' . $url);
exit();
}
/*
* View
*/
// No view at all, just actions
$db->close();

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/core/modules/oauth/getoauthcallback.php * \file htdocs/core/modules/oauth/google_oauthcallback.php
* \ingroup oauth * \ingroup oauth
* \brief Page to get oauth callback * \brief Page to get oauth callback
*/ */
@ -83,7 +83,7 @@ if ($action != 'delete' && empty($requestedpermissionsarray))
/** @var $apiService Service */ /** @var $apiService Service */
$apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray); $apiService = $serviceFactory->createService('Google', $credentials, $storage, $requestedpermissionsarray);
// access type needed for google refresh token // access type needed to have oauth provider refreshing token
$apiService->setAccessType('offline'); $apiService->setAccessType('offline');
$langs->load("oauth"); $langs->load("oauth");
@ -104,7 +104,7 @@ if ($action == 'delete')
exit(); exit();
} }
if (! empty($_GET['code'])) // We are coming from Google oauth page if (! empty($_GET['code'])) // We are coming from oauth provider page
{ {
//llxHeader('',$langs->trans("OAuthSetup")); //llxHeader('',$langs->trans("OAuthSetup"));
@ -121,6 +121,7 @@ if (! empty($_GET['code'])) // We are coming from Google oauth page
//var_dump($_GET['code']); //var_dump($_GET['code']);
//var_dump($state); //var_dump($state);
//var_dump($apiService); // OAuth\OAuth2\Service\Google //var_dump($apiService); // OAuth\OAuth2\Service\Google
$token = $apiService->requestAccessToken($_GET['code'], $state); $token = $apiService->requestAccessToken($_GET['code'], $state);
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
@ -138,6 +139,8 @@ else // If entry on page with no parameter, we arrive here
{ {
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl; $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
// This may create record into oauth_state before the header redirect.
// Creation of record with state in this tables depend on the Provider used (see its constructor).
if (GETPOST('state')) if (GETPOST('state'))
{ {
$url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
@ -146,7 +149,8 @@ else // If entry on page with no parameter, we arrive here
{ {
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
} }
// we go on google authorization page
// we go on oauth provider authorization page
header('Location: ' . $url); header('Location: ' . $url);
exit(); exit();
} }

View File

@ -66,6 +66,7 @@ class printing_printgcp extends PrintingDriver
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$this->db = $db; $this->db = $db;
if (!$conf->oauth->enabled) { if (!$conf->oauth->enabled) {
@ -117,10 +118,28 @@ class printing_printgcp extends PrintingDriver
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info'); $this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
$this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):'')); $this->conf[] = array('varname'=>'PRINTGCP_TOKEN_ACCESS', 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)?$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'):''));
if ($token_ok) { if ($token_ok) {
$expiredat='';
$refreshtoken = $token->getRefreshToken(); $refreshtoken = $token->getRefreshToken();
$endoflife=$token->getEndOfLife();
if ($endoflife == $token::EOL_NEVER_EXPIRES)
{
$expiredat = $langs->trans("Never");
}
elseif ($endoflife == $token::EOL_UNKNOWN)
{
$expiredat = $langs->trans("Unknown");
}
else
{
$expiredat=dol_print_date($endoflife, "dayhour");
}
$this->conf[] = array('varname'=>'TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info'); $this->conf[] = array('varname'=>'TOKEN_REFRESH', 'info'=>((! empty($refreshtoken))?'Yes':'No'), 'type'=>'info');
$this->conf[] = array('varname'=>'TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info'); $this->conf[] = array('varname'=>'TOKEN_EXPIRED', 'info'=>($expire?'Yes':'No'), 'type'=>'info');
$this->conf[] = array('varname'=>'TOKEN_EXPIRE_AT', 'info'=>(dol_print_date($token->getEndOfLife(), "dayhour")), 'type'=>'info'); $this->conf[] = array('varname'=>'TOKEN_EXPIRE_AT', 'info'=>($expiredat), 'type'=>'info');
} }
/* /*
if ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)) { if ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)) {

View File

@ -102,9 +102,9 @@ $(document).ready(function () {
<!-- Password --> <!-- Password -->
<tr> <tr>
<td class="nowrap center valignmiddle"> <td class="nowrap center valignmiddle">
<?php if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?><label for="password" hidden><?php echo $langs->trans("Password"); ?></label><?php } ?> <?php if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { ?><label for="password" class="hidden"><?php echo $langs->trans("Password"); ?></label><?php } ?>
<span class="span-icon-password"> <span class="span-icon-password">
<input id="password" placeholder="<?php echo $langs->trans("Password"); ?>" name="password" class="flat input-icon-password" type="password" size="20" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="off" /> <input id="password" placeholder="<?php echo $langs->trans("Password"); ?>" name="password" class="flat input-icon-password" type="password" size="20" value="<?php echo dol_escape_htmltag($password); ?>" tabindex="2" autocomplete="<?php echo empty($conf->global->MAIN_LOGIN_ENABLE_PASSWORD_AUTOCOMPLETE)?'off':'on'; ?>" />
</span> </span>
</td></tr> </td></tr>
<?php <?php

View File

@ -97,7 +97,7 @@ class DoliStorage implements TokenStorageInterface
$this->tokens = array(); $this->tokens = array();
} }
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_token"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service='".$service."' AND entity=1"; $sql.= " WHERE service='".$this->db->escape($service)."' AND entity=1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
{ {
@ -113,7 +113,7 @@ class DoliStorage implements TokenStorageInterface
} else { } else {
// save // save
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, token, entity)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, token, entity)";
$sql.= " VALUES ('".$service."', '".$this->db->escape($serializedToken)."', 1)"; $sql.= " VALUES ('".$this->db->escape($service)."', '".$this->db->escape($serializedToken)."', 1)";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
} }
//print $sql; //print $sql;
@ -130,7 +130,7 @@ class DoliStorage implements TokenStorageInterface
// get from db // get from db
dol_syslog("hasAccessToken service=".$service); dol_syslog("hasAccessToken service=".$service);
$sql = "SELECT token FROM ".MAIN_DB_PREFIX."oauth_token"; $sql = "SELECT token FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service='".$service."'"; $sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
{ {
@ -159,7 +159,7 @@ class DoliStorage implements TokenStorageInterface
// unset($tokens[$service]); // unset($tokens[$service]);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token";
$sql.= " WHERE service='".$service."'"; $sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
//} //}
@ -189,7 +189,7 @@ class DoliStorage implements TokenStorageInterface
} }
throw new AuthorizationStateNotFoundException('State not found in conf, are you sure you stored it?'); throw new AuthorizationStateNotFoundException('State not found in db, are you sure you stored it?');
} }
/** /**
@ -207,7 +207,7 @@ class DoliStorage implements TokenStorageInterface
$this->states[$service] = $state; $this->states[$service] = $state;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_state"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."oauth_state";
$sql.= " WHERE service='".$service."' AND entity=1"; $sql.= " WHERE service='".$this->db->escape($service)."' AND entity=1";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if (! $resql) if (! $resql)
{ {
@ -223,7 +223,7 @@ class DoliStorage implements TokenStorageInterface
} else { } else {
// save // save
$sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_state (service, state, entity)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_state (service, state, entity)";
$sql.= " VALUES ('".$service."', '".$state."', 1)"; $sql.= " VALUES ('".$this->db->escape($service)."', '".$this->db->escape($state)."', 1)";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
} }
@ -236,9 +236,10 @@ class DoliStorage implements TokenStorageInterface
*/ */
public function hasAuthorizationState($service) public function hasAuthorizationState($service)
{ {
// get from db // get state from db
dol_syslog("get state from db");
$sql = "SELECT state FROM ".MAIN_DB_PREFIX."oauth_state"; $sql = "SELECT state FROM ".MAIN_DB_PREFIX."oauth_state";
$sql.= " WHERE service='".$service."'"; $sql.= " WHERE service='".$this->db->escape($service)."'";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
$result = $this->db->fetch_array($resql); $result = $this->db->fetch_array($resql);
$states[$service] = $result[state]; $states[$service] = $result[state];

View File

@ -343,8 +343,8 @@ ul {
.button { .button {
background: #eee; background: #fcfcfc;
/*border: 1px solid #C0C0C0;*/ border: 1px solid #d0d0d0;
padding: 0.3em 0.7em; padding: 0.3em 0.7em;
margin: 0 0.5em; margin: 0 0.5em;
-moz-border-radius:0 5px 0 5px; -moz-border-radius:0 5px 0 5px;

View File

@ -43,3 +43,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30);
ALTER TABLE llx_loan ADD COLUMN fk_projet integer DEFAULT NULL;

View File

@ -45,7 +45,9 @@ create table llx_loan
accountancy_account_insurance varchar(32), accountancy_account_insurance varchar(32),
accountancy_account_interest varchar(32), accountancy_account_interest varchar(32),
fk_projet integer DEFAULT NULL,
fk_user_author integer DEFAULT NULL, fk_user_author integer DEFAULT NULL,
fk_user_modif integer DEFAULT NULL, fk_user_modif integer DEFAULT NULL
active tinyint DEFAULT 1 NOT NULL active tinyint DEFAULT 1 NOT NULL
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -251,10 +251,34 @@ if ($ok)
if (! in_array($code,array_keys($arrayoffieldsfound))) if (! in_array($code,array_keys($arrayoffieldsfound)))
{ {
print 'Found field '.$code.' declared into '.MAIN_DB_PREFIX.'extrafields table but not found into desc of table '.$tableextra." -> "; print 'Found field '.$code.' declared into '.MAIN_DB_PREFIX.'extrafields table but not found into desc of table '.$tableextra." -> ";
$type=$extrafields->attribute_type[$code]; $value=$extrafields->attribute_size[$code]; $attribute=''; $default=''; $extra=''; $null='null'; $type=$extrafields->attribute_type[$code]; $length=$extrafields->attribute_size[$code]; $attribute=''; $default=''; $extra=''; $null='null';
if ($type=='boolean') {
$typedb='int';
$lengthdb='1';
} elseif($type=='price') {
$typedb='double';
$lengthdb='24,8';
} elseif($type=='phone') {
$typedb='varchar';
$lengthdb='20';
}elseif($type=='mail') {
$typedb='varchar';
$lengthdb='128';
} elseif (($type=='select') || ($type=='sellist') || ($type=='radio') ||($type=='checkbox') ||($type=='chkbxlst')){
$typedb='text';
$lengthdb='';
} elseif ($type=='link') {
$typedb='int';
$lengthdb='11';
} else {
$typedb=$type;
$lengthdb=$length;
}
$field_desc=array( $field_desc=array(
'type'=>$type, 'type'=>$typedb,
'value'=>$value, 'value'=>$lengthdb,
'attribute'=>$attribute, 'attribute'=>$attribute,
'default'=>$default, 'default'=>$default,
'extra'=>$extra, 'extra'=>$extra,

View File

@ -279,7 +279,7 @@ ModuleFamilyInterface=Interfaces with external systems
MenuHandlers=Menu handlers MenuHandlers=Menu handlers
MenuAdmin=Menu editor MenuAdmin=Menu editor
DoNotUseInProduction=Do not use in production DoNotUseInProduction=Do not use in production
ThisIsProcessToFollow=This is setup to process: ThisIsProcessToFollow=This is steps to process:
ThisIsAlternativeProcessToFollow=This is an alternative setup to process: ThisIsAlternativeProcessToFollow=This is an alternative setup to process:
StepNb=Step %s StepNb=Step %s
FindPackageFromWebSite=Find a package that provides feature you want (for example on official web site %s). FindPackageFromWebSite=Find a package that provides feature you want (for example on official web site %s).
@ -998,7 +998,7 @@ TriggerAlwaysActive=Triggers in this file are always active, whatever are the ac
TriggerActiveAsModuleActive=Triggers in this file are active as module <b>%s</b> is enabled. TriggerActiveAsModuleActive=Triggers in this file are active as module <b>%s</b> is enabled.
GeneratedPasswordDesc=Define here which rule you want to use to generate new password if you ask to have auto generated password GeneratedPasswordDesc=Define here which rule you want to use to generate new password if you ask to have auto generated password
DictionaryDesc=Insert all reference data. You can add your values to the default. DictionaryDesc=Insert all reference data. You can add your values to the default.
ConstDesc=This page allows you to edit all other parameters not available in previous pages. These are mostly reserved parameters for developers or advanced troubleshooting. ConstDesc=This page allows you to edit all other parameters not available in previous pages. These are mostly reserved parameters for developers or advanced troubleshooting. For a list of options <a href="https://wiki.dolibarr.org/index.php/Setup_Other#List_of_known_hidden_options" title="External Site - opens in a new window" target="_blank">check here</a>.
MiscellaneousDesc=All other security related parameters are defined here. MiscellaneousDesc=All other security related parameters are defined here.
LimitsSetup=Limits/Precision setup LimitsSetup=Limits/Precision setup
LimitsDesc=You can define limits, precisions and optimisations used by Dolibarr here LimitsDesc=You can define limits, precisions and optimisations used by Dolibarr here
@ -1575,7 +1575,7 @@ BackupDumpWizard=Wizard to build database backup dump file
SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason: SomethingMakeInstallFromWebNotPossible=Installation of external module is not possible from the web interface for the following reason:
SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do. SomethingMakeInstallFromWebNotPossible2=For this reason, process to upgrade described here is only manual steps a privileged user can do.
InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file <strong>%s</strong> to allow this feature. InstallModuleFromWebHasBeenDisabledByFile=Install of external module from application has been disabled by your administrator. You must ask him to remove the file <strong>%s</strong> to allow this feature.
ConfFileMuseContainCustom=Installing an external module from application save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br><strong>$dolibarr_main_url_root_alt='/custom';</strong><br><strong>$dolibarr_main_document_root_alt='%s/custom';</strong> ConfFileMuseContainCustom=Installing an external module from application need to save the module files into directory <strong>%s</strong>. To have this directory processed by Dolibarr, you must setup your <strong>conf/conf.php</strong> to have option<br><strong>$dolibarr_main_url_root_alt='/custom';</strong><br><strong>$dolibarr_main_document_root_alt='%s/custom';</strong>
HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over
HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight) HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight)
TextTitleColor=Color of page title TextTitleColor=Color of page title
@ -1618,8 +1618,8 @@ ByDefaultInList=Show by default on list view
YouUseLastStableVersion=You use the last stable version YouUseLastStableVersion=You use the last stable version
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites) TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)
TitleExampleForMaintenanceRelease=Example of message you can use to announce this maintenance release (feel free to use it on your web sites) TitleExampleForMaintenanceRelease=Example of message you can use to announce this maintenance release (feel free to use it on your web sites)
ExampleOfNewsMessageForMajorRelease=Dolibarr ERP & CRM %s is available. Version %s is a major release with a lot of new features for both users and developers. You can download it from the download area of http://www.dolibarr.org portal (subdirectory Stable versions). You can read <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> for complete list of changes. ExampleOfNewsMessageForMajorRelease=Dolibarr ERP & CRM %s is available. Version %s is a major release with a lot of new features for both users and developers. You can download it from the download area of https://www.dolibarr.org portal (subdirectory Stable versions). You can read <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> for complete list of changes.
ExampleOfNewsMessageForMaintenanceRelease=Dolibarr ERP & CRM %s is available. Version %s is a maintenance version, so it contains only fixes of bugs. We recommend everybody using an older version to upgrade to this one. As any maintenance release, no new features, nor data structure change is present into this version. You can download it from the download area of http://www.dolibarr.org portal (subdirectory Stable versions). You can read <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> for complete list of changes. ExampleOfNewsMessageForMaintenanceRelease=Dolibarr ERP & CRM %s is available. Version %s is a maintenance version, so it contains only fixes of bugs. We recommend everybody using an older version to upgrade to this one. As any maintenance release, no new features, nor data structure change is present into this version. You can download it from the download area of https://www.dolibarr.org portal (subdirectory Stable versions). You can read <a href="https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog">ChangeLog</a> for complete list of changes.
MultiPriceRuleDesc=When option "Several level of prices per product/service" is on, you can define different prices (one per price level) for each product. To save you time, you can enter here rule to have price for each level autocalculated according to price of first level, so you will have to enter only price for first level on each product. This page is here to save you time and can be usefull only if your prices for each leve are relative to first level. You can ignore this page in most cases. MultiPriceRuleDesc=When option "Several level of prices per product/service" is on, you can define different prices (one per price level) for each product. To save you time, you can enter here rule to have price for each level autocalculated according to price of first level, so you will have to enter only price for first level on each product. This page is here to save you time and can be usefull only if your prices for each leve are relative to first level. You can ignore this page in most cases.
ModelModulesProduct=Templates for product documents ModelModulesProduct=Templates for product documents
ToGenerateCodeDefineAutomaticRuleFirst=To be able to generate automatically codes, you must first define a manager to auto define barcode number. ToGenerateCodeDefineAutomaticRuleFirst=To be able to generate automatically codes, you must first define a manager to auto define barcode number.

View File

@ -2,6 +2,7 @@
IdAgenda=ID event IdAgenda=ID event
Actions=Events Actions=Events
Agenda=Agenda Agenda=Agenda
TMenuAgenda=Agenda
Agendas=Agendas Agendas=Agendas
LocalAgenda=Internal calendar LocalAgenda=Internal calendar
ActionsOwnedBy=Event owned by ActionsOwnedBy=Event owned by

View File

@ -43,6 +43,7 @@ LoanCalcDesc=This <b>mortgage calculator</b> can be used to figure out monthly p
GoToInterest=%s will go towards INTEREST GoToInterest=%s will go towards INTEREST
GoToPrincipal=%s will go towards PRINCIPAL GoToPrincipal=%s will go towards PRINCIPAL
YouWillSpend=You will spend %s in year %s YouWillSpend=You will spend %s in year %s
ListLoanAssociatedProject=List of loan associated with the project
# Admin # Admin
ConfigLoan=Configuration of the module loan ConfigLoan=Configuration of the module loan
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default

View File

@ -788,8 +788,8 @@ SetRef=Set ref
Select2ResultFoundUseArrows=Some results found. Use arrows to select. Select2ResultFoundUseArrows=Some results found. Use arrows to select.
Select2NotFound=No result found Select2NotFound=No result found
Select2Enter=Enter Select2Enter=Enter
Select2MoreCharacter=or more character Select2MoreCharacter=or more characters<br /><br /><strong>Search syntax:</strong><br /><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br /><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br />
Select2MoreCharacters=or more characters Select2MoreCharacters=or more characters<br /><br /><strong>Search syntax:</strong><br /><kbd><strong> |</strong></kbd><kbd> OR</kbd> (a|b)<br /><kbd><strong>*</strong></kbd><kbd> Any character</kbd> (a*b)<br /><kbd><strong>^</strong></kbd><kbd> Start with</kbd> (^ab)<br /><kbd><strong>$</strong></kbd><kbd> End with</kbd> (ab$)<br />
Select2LoadingMoreResults=Loading more results... Select2LoadingMoreResults=Loading more results...
Select2SearchInProgress=Search in progress... Select2SearchInProgress=Search in progress...
SearchIntoThirdparties=Thirdparties SearchIntoThirdparties=Thirdparties

View File

@ -2,15 +2,20 @@
ConfigOAuth=Oauth Configuration ConfigOAuth=Oauth Configuration
OAuthServices=OAuth services OAuthServices=OAuth services
ManualTokenGeneration=Manual token generation ManualTokenGeneration=Manual token generation
TokenManager=Token manager
IsTokenGenerated=Is token generated ?
NoAccessToken=No access token saved into local database NoAccessToken=No access token saved into local database
HasAccessToken=A token was generated and saved into local database HasAccessToken=A token was generated and saved into local database
NewTokenStored=Token received ans saved NewTokenStored=Token received and saved
ToCheckDeleteTokenOnProvider=To check/delete authorization saved by %s OAuth provider ToCheckDeleteTokenOnProvider=Click here to check/delete authorization saved by %s OAuth provider
TokenDeleted=Token deleted TokenDeleted=Token deleted
RequestAccess=Click here to request/renew access and receive a new token to save RequestAccess=Click here to request/renew access and receive a new token to save
DeleteAccess=Click here to delete token DeleteAccess=Click here to delete token
UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URI when creating your credential on your OAuth provider: UseTheFollowingUrlAsRedirectURI=Use the following URL as the Redirect URI when creating your credential on your OAuth provider:
ListOfSupportedOauthProviders=Enter here credential provided by your OAuth2 provider. Only supported OAuth2 providers are visible here. This setup may be used by other modules that need OAuth2 authentication. ListOfSupportedOauthProviders=Enter here credential provided by your OAuth2 provider. Only supported OAuth2 providers are visible here. This setup may be used by other modules that need OAuth2 authentication.
OAuthSetupForLogin=Page to generate an OAuth token
SeePreviousTab=See previous tab
OAuthIDSecret=OAuth ID and Secret
TOKEN_REFRESH=Token Refresh Present TOKEN_REFRESH=Token Refresh Present
TOKEN_EXPIRED=Token expired TOKEN_EXPIRED=Token expired
TOKEN_EXPIRE_AT=Token expire at TOKEN_EXPIRE_AT=Token expire at

View File

@ -2,6 +2,7 @@
SecurityCode=Security code SecurityCode=Security code
NumberingShort=N° NumberingShort=N°
Tools=Tools Tools=Tools
TMenuTools=Tools
ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br /><br />All the tools can be reached in the left menu. ToolsDesc=All miscellaneous tools not included in other menu entries are collected here.<br /><br />All the tools can be reached in the left menu.
Birthday=Birthday Birthday=Birthday
BirthdayDate=Birthday date BirthdayDate=Birthday date

View File

@ -46,6 +46,6 @@ IPP_Media=Printer media
IPP_Supported=Type of media IPP_Supported=Type of media
DirectPrintingJobsDesc=This page lists printing jobs found for available printers. DirectPrintingJobsDesc=This page lists printing jobs found for available printers.
GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret. GoogleAuthNotConfigured=Google OAuth setup not done. Enable module OAuth and set a Google ID/Secret.
GoogleAuthConfigured=Google OAuth credentials found into setup of module OAuth. GoogleAuthConfigured=Google OAuth credentials were found into setup of module OAuth.
PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print. PrintingDriverDescprintgcp=Configuration variables for printing driver Google Cloud Print.
PrintTestDescprintgcp=List of Printers for Google Cloud Print. PrintTestDescprintgcp=List of Printers for Google Cloud Print.

View File

@ -5,6 +5,8 @@ ProductLabelTranslated=Translated product label
ProductDescriptionTranslated=Translated product description ProductDescriptionTranslated=Translated product description
ProductNoteTranslated=Translated product note ProductNoteTranslated=Translated product note
ProductServiceCard=Products/Services card ProductServiceCard=Products/Services card
TMenuProducts=Products
TMenuServices=Services
Products=Products Products=Products
Services=Services Services=Services
Product=Product Product=Product

View File

@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$langs->load("compta"); $langs->load("compta");
$langs->load("bills"); $langs->load("bills");
@ -45,148 +47,167 @@ $result = restrictedArea($user, 'loan', $id, '','');
$object = new Loan($db); $object = new Loan($db);
$hookmanager->initHooks(array('loancard','globalcard'));
/* /*
* Actions * Actions
*/ */
// Classify paid $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($action == 'confirm_paid' && $confirm == 'yes') if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{ {
$object->fetch($id); // Classify paid
$result = $object->set_paid($user); if ($action == 'confirm_paid' && $confirm == 'yes')
if ($result > 0)
{ {
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs'); $object->fetch($id);
} $result = $object->set_paid($user);
else
{
setEventMessages($loan->error, null, 'errors');
}
}
// Delete loan
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$object->fetch($id);
$result=$object->delete($user);
if ($result > 0)
{
setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
header("Location: index.php");
exit;
}
else
{
setEventMessages($loan->error, null, 'errors');
}
}
// Add loan
if ($action == 'add' && $user->rights->loan->write)
{
if (! $cancel)
{
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$capital = price2num(GETPOST('capital'));
if (! $datestart)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
$action = 'create';
}
elseif (! $dateend)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
$action = 'create';
}
elseif (! $capital)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
$action = 'create';
}
else
{
$object->label = GETPOST('label');
$object->fk_bank = GETPOST('accountid');
$object->capital = $capital;
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->nbterm = GETPOST('nbterm');
$object->rate = GETPOST('rate');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
$accountancy_account_interest = GETPOST('accountancy_account_interest');
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
$id=$object->create($user);
if ($id <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
else
{
header("Location: index.php");
exit();
}
}
// Update record
else if ($action == 'update' && $user->rights->loan->write)
{
if (! $cancel)
{
$result = $object->fetch($id);
if ($object->fetch($id))
{
$object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$object->capital = price2num(GETPOST("capital"));
$object->nbterm = GETPOST("nbterm");
$object->rate = GETPOST("rate");
}
$result = $object->update($user);
if ($result > 0) if ($result > 0)
{
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');
}
else
{
setEventMessages($loan->error, null, 'errors');
}
}
// Delete loan
if ($action == 'confirm_delete' && $confirm == 'yes')
{
$object->fetch($id);
$result=$object->delete($user);
if ($result > 0)
{
setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs');
header("Location: index.php");
exit;
}
else
{
setEventMessages($loan->error, null, 'errors');
}
}
// Add loan
if ($action == 'add' && $user->rights->loan->write)
{
if (! $cancel)
{
$datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$capital = price2num(GETPOST('capital'));
if (! $datestart)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors');
$action = 'create';
}
elseif (! $dateend)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors');
$action = 'create';
}
elseif (! $capital)
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors');
$action = 'create';
}
else
{
$object->label = GETPOST('label');
$object->fk_bank = GETPOST('accountid');
$object->capital = $capital;
$object->datestart = $datestart;
$object->dateend = $dateend;
$object->nbterm = GETPOST('nbterm');
$object->rate = GETPOST('rate');
$object->note_private = GETPOST('note_private');
$object->note_public = GETPOST('note_public');
$object->fk_project = GETPOST('fk_project');
$accountancy_account_capital = GETPOST('accountancy_account_capital');
$accountancy_account_insurance = GETPOST('accountancy_account_insurance');
$accountancy_account_interest = GETPOST('accountancy_account_interest');
if ($accountancy_account_capital <= 0) { $object->account_capital = ''; } else { $object->account_capital = $accountancy_account_capital; }
if ($accountancy_account_insurance <= 0) { $object->account_insurance = ''; } else { $object->account_insurance = $accountancy_account_insurance; }
if ($accountancy_account_interest <= 0) { $object->account_interest = ''; } else { $object->account_interest = $accountancy_account_interest; }
$id=$object->create($user);
if ($id <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
}
else
{
header("Location: index.php");
exit();
}
}
// Update record
else if ($action == 'update' && $user->rights->loan->write)
{
if (! $cancel)
{
$result = $object->fetch($id);
if ($result > 0)
{
$object->datestart = dol_mktime(12, 0, 0, GETPOST('startmonth','int'), GETPOST('startday','int'), GETPOST('startyear','int'));
$object->dateend = dol_mktime(12, 0, 0, GETPOST('endmonth','int'), GETPOST('endday','int'), GETPOST('endyear','int'));
$object->capital = price2num(GETPOST("capital"));
$object->nbterm = GETPOST("nbterm");
$object->rate = GETPOST("rate");
}
$result = $object->update($user);
if ($result > 0)
{
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit;
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
else
{ {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit; exit;
} }
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
} }
else
// Link to a project
if ($action == 'classin' && $user->rights->loan->write)
{
$object->fetch($id);
$result = $object->setProject(GETPOST('projectid'));
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
if ($action == 'setlabel' && $user->rights->loan->write)
{ {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id); $object->fetch($id);
exit; $result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
} }
} }
if ($action == 'setlabel' && $user->rights->loan->write)
{
$object->fetch($id);
$result = $object->setValueFrom('label', GETPOST('label'), '', '', 'text', '', $user, 'LOAN_MODIFY');
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
/* /*
* View * View
*/ */
$form = new Form($db); $form = new Form($db);
$formproject = new FormProjets($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db); if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
$title = $langs->trans("Loan") . ' - ' . $langs->trans("Card"); $title = $langs->trans("Loan") . ' - ' . $langs->trans("Card");
@ -250,6 +271,21 @@ if ($action == 'create')
// Rate // Rate
print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Rate").'</td><td><input name="rate" size="5" value="' . GETPOST("rate") . '"> %</td></tr>';
// Project
if (! empty($conf->projet->enabled))
{
$formproject=new FormProjets($db);
// Projet associe
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects(-1,GETPOST("fk_project"),'fk_project',16,0,1,1);
print '</td></tr>';
}
// Note Private // Note Private
print '<tr>'; print '<tr>';
print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>'; print '<td class="border" valign="top">'.$langs->trans('NotePrivate').'</td>';
@ -354,14 +390,48 @@ if ($id > 0)
dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill'); dol_fiche_head($head, 'card', $langs->trans("Loan"), 0, 'bill');
// Loan card
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref loan // Ref loan
$morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', 0, 1);
$morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1); $morehtmlref.=$form->editfieldval("Label", 'label', $object->label, $object, $user->rights->loan->write, 'string', '', null, null, '', 1);
$morehtmlref.='</div>'; // Project
if (! empty($conf->projet->enabled))
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>'; {
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($user->rights->commande->creer)
{
if ($action != 'classify')
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
if ($action == 'classify') {
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
$morehtmlref.='<input type="hidden" name="action" value="classin">';
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref.='</form>';
} else {
$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
}
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id=' . $object->fk_project . '" title="' . $langs->trans('ShowProject') . '">';
$morehtmlref.=$proj->ref;
$morehtmlref.='</a>';
} else {
$morehtmlref.='';
}
}
}
$morehtmlref.='</div>';
$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
@ -468,6 +538,7 @@ if ($id > 0)
} }
print '</td></tr>'; print '</td></tr>';
// Status // Status
// print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>'; // print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
@ -572,33 +643,37 @@ if ($id > 0)
*/ */
if ($action != 'edit') if ($action != 'edit')
{ {
print '<div class="tabsAction">'; $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
// Edit {
if ($user->rights->loan->write) print '<div class="tabsAction">';
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'; // Edit
} if ($user->rights->loan->write)
{
// Emit payment print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write) }
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&amp;action=create">'.$langs->trans("DoPayment").'</a>'; // Emit payment
} if ($object->paid == 0 && ((price2num($object->capital) > 0 && round($staytopay) < 0) || (price2num($object->capital) > 0 && round($staytopay) > 0)) && $user->rights->loan->write)
{
// Classify 'paid' print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&amp;action=create">'.$langs->trans("DoPayment").'</a>';
if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write) }
{
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=paid">'.$langs->trans("ClassifyPaid").'</a>'; // Classify 'paid'
} if ($object->paid == 0 && round($staytopay) <=0 && $user->rights->loan->write)
{
// Delete print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=paid">'.$langs->trans("ClassifyPaid").'</a>';
if ($user->rights->loan->delete) }
{
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>'; // Delete
} if ($user->rights->loan->delete)
{
print "</div>"; print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans("Delete").'</a>';
}
print "</div>";
}
} }
} }
else else

View File

@ -24,14 +24,15 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
/** \class Loan /**
* \brief Class to manage loan * Loan
*/ */
class Loan extends CommonObject class Loan extends CommonObject
{ {
public $element='loan'; public $element='loan';
public $table='loan'; public $table='loan';
public $table_element='loan'; public $table_element='loan';
public $picto = 'bill'; public $picto = 'bill';
public $rowid; public $rowid;
@ -51,6 +52,7 @@ class Loan extends CommonObject
public $fk_bank; public $fk_bank;
public $fk_user_creat; public $fk_user_creat;
public $fk_user_modif; public $fk_user_modif;
public $fk_project;
/** /**
@ -73,7 +75,7 @@ class Loan extends CommonObject
function fetch($id) function fetch($id)
{ {
$sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,"; $sql = "SELECT l.rowid, l.label, l.capital, l.datestart, l.dateend, l.nbterm, l.rate, l.note_private, l.note_public,";
$sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest"; $sql.= " l.paid, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest, l.fk_projet as fk_project";
$sql.= " FROM ".MAIN_DB_PREFIX."loan as l"; $sql.= " FROM ".MAIN_DB_PREFIX."loan as l";
$sql.= " WHERE l.rowid = ".$id; $sql.= " WHERE l.rowid = ".$id;
@ -100,6 +102,7 @@ class Loan extends CommonObject
$this->account_capital = $obj->accountancy_account_capital; $this->account_capital = $obj->accountancy_account_capital;
$this->account_insurance = $obj->accountancy_account_insurance; $this->account_insurance = $obj->accountancy_account_insurance;
$this->account_interest = $obj->accountancy_account_interest; $this->account_interest = $obj->accountancy_account_interest;
$this->fk_project = $obj->fk_project;
$this->db->free($resql); $this->db->free($resql);
return 1; return 1;
@ -127,7 +130,7 @@ class Loan extends CommonObject
function create($user) function create($user)
{ {
global $conf; global $conf;
$error=0; $error=0;
$now=dol_now(); $now=dol_now();
@ -142,6 +145,7 @@ class Loan extends CommonObject
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank); 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_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 (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project);
// Check parameters // Check parameters
if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend)) if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend))
@ -157,9 +161,9 @@ class Loan extends CommonObject
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."loan (label, fk_bank, capital, datestart, dateend, nbterm, rate, note_private, note_public,";
$sql.= " ,accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity"; $sql.= " accountancy_account_capital, accountancy_account_insurance, accountancy_account_interest, entity,";
$sql.= " ,datec, fk_user_author)"; $sql.= " datec, fk_projet, fk_user_author)";
$sql.= " VALUES ('".$this->db->escape($this->label)."',"; $sql.= " VALUES ('".$this->db->escape($this->label)."',";
$sql.= " '".$this->db->escape($this->fk_bank)."',"; $sql.= " '".$this->db->escape($this->fk_bank)."',";
$sql.= " '".price2num($newcapital)."',"; $sql.= " '".price2num($newcapital)."',";
@ -174,6 +178,7 @@ class Loan extends CommonObject
$sql.= " '".$this->db->escape($this->account_interest)."',"; $sql.= " '".$this->db->escape($this->account_interest)."',";
$sql.= " ".$conf->entity.","; $sql.= " ".$conf->entity.",";
$sql.= " '".$this->db->idate($now)."',"; $sql.= " '".$this->db->idate($now)."',";
$sql.= " ".(empty($this->fk_project)?'NULL':$this->fk_project).",";
$sql.= " ".$user->id; $sql.= " ".$user->id;
$sql.= ")"; $sql.= ")";
@ -282,6 +287,7 @@ class Loan extends CommonObject
$sql.= " capital='".price2num($this->db->escape($this->capital))."',"; $sql.= " capital='".price2num($this->db->escape($this->capital))."',";
$sql.= " datestart='".$this->db->idate($this->datestart)."',"; $sql.= " datestart='".$this->db->idate($this->datestart)."',";
$sql.= " dateend='".$this->db->idate($this->dateend)."',"; $sql.= " dateend='".$this->db->idate($this->dateend)."',";
$sql.= " fk_projet=".(empty($this->fk_project)?'NULL':$this->fk_project).",";
$sql.= " fk_user_modif = ".$user->id; $sql.= " fk_user_modif = ".$user->id;
$sql.= " WHERE rowid=".$this->id; $sql.= " WHERE rowid=".$this->id;
@ -345,7 +351,7 @@ class Loan extends CommonObject
global $langs; global $langs;
$langs->load('customers'); $langs->load('customers');
$langs->load('bills'); $langs->load('bills');
if ($mode == 0) if ($mode == 0)
{ {
if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 0) return $langs->trans("Unpaid");
@ -398,7 +404,7 @@ class Loan extends CommonObject
* @param int $maxlen Label max length * @param int $maxlen Label max length
* @return string Chaine with URL * @return string Chaine with URL
*/ */
function getLinkUrl($withpicto=0,$maxlen=0) function getNomUrl($withpicto=0,$maxlen=0)
{ {
global $langs; global $langs;

View File

@ -139,7 +139,7 @@ if ($resql)
print '<td class="liste_titre"><input class="flat" size="12" type="text" name="search_label" value="'.$search_label.'"></td>'; print '<td class="liste_titre"><input class="flat" size="12" type="text" name="search_label" value="'.$search_label.'"></td>';
print '<td class="liste_titre" align="right" ><input class="flat" size="8" type="text" name="search_amount" value="'.$search_amount.'"></td>'; print '<td class="liste_titre" align="right" ><input class="flat" size="8" type="text" name="search_amount" value="'.$search_amount.'"></td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
print '<td></td>'; print '<td class="liste_titre"></td>';
print '<td align="right" class="liste_titre">'; print '<td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" name="button_search" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="image" class="liste_titre" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" name="button_removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
@ -157,7 +157,7 @@ if ($resql)
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
// Ref // Ref
print '<td>'.$loan_static->getLinkUrl(1, 42).'</td>'; print '<td>'.$loan_static->getNomUrl(1, 42).'</td>';
// Label // Label
print '<td>'.dol_trunc($obj->label,42).'</td>'; print '<td>'.dol_trunc($obj->label,42).'</td>';

View File

@ -231,7 +231,7 @@ if ($resql)
// Ref // Ref
print '<td>'; print '<td>';
$loan->fetch($objp->id); $loan->fetch($objp->id);
print $loan->getLinkUrl(1); print $loan->getNomUrl(1);
print "</td>\n"; print "</td>\n";
// Label // Label
print '<td>'.$objp->label.'</td>'; print '<td>'.$objp->label.'</td>';

View File

@ -1025,7 +1025,7 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs
print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="top" title="'.$langs->trans("Home").'" href="'.(DOL_URL_ROOT?DOL_URL_ROOT:'/').'">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="author" title="Dolibarr Development Team" href="http://www.dolibarr.org">'."\n"; if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && ! GETPOST('textbrowser')) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
// Displays title // Displays title
$appli=constant('DOL_APPLICATION_TITLE'); $appli=constant('DOL_APPLICATION_TITLE');

View File

@ -161,9 +161,19 @@ if ($mode == 'setup' && $user->admin)
break; break;
case "info": // Google Api setup or Google OAuth Token case "info": // Google Api setup or Google OAuth Token
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td'.($key['required']?' class=required':'').'>'.$langs->trans($key['varname']).'</td>'; print '<td'.($key['required']?' class=required':'').'>';
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
{
print $langs->trans("IsTokenGenerated");
}
else
{
print $langs->trans($key['varname']);
}
print '</td>';
print '<td>'.$langs->trans($key['info']).'</td>'; print '<td>'.$langs->trans($key['info']).'</td>';
print '<td>'; print '<td>';
//var_dump($key);
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
{ {
// Delete remote tokens // Delete remote tokens
@ -187,7 +197,8 @@ if ($mode == 'setup' && $user->admin)
// Token // Token
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("Token").'</td>'; print '<td>'.$langs->trans("Token").'</td>';
print '<td>'; print '<td colspan="2">';
$tokenobj=null;
// Dolibarr storage // Dolibarr storage
$storage = new DoliStorage($db, $conf); $storage = new DoliStorage($db, $conf);
try try
@ -210,8 +221,6 @@ if ($mode == 'setup' && $user->admin)
print '</textarea>';*/ print '</textarea>';*/
} }
print '</td>'; print '</td>';
print '<td>';
print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
} }

View File

@ -37,6 +37,7 @@ $htmlname=GETPOST('htmlname','alpha');
$socid=GETPOST('socid','int'); $socid=GETPOST('socid','int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$id=GETPOST('id', 'int'); $id=GETPOST('id', 'int');
$discard_closed =GETPOST('discardclosed','int');
/* /*
@ -63,7 +64,7 @@ if (! GETPOST($htmlname) && ! GETPOST($idprod)) return;
$searchkey=(GETPOST($idprod)?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):'')); $searchkey=(GETPOST($idprod)?GETPOST($idprod):(GETPOST($htmlname)?GETPOST($htmlname):''));
$form = new FormProjets($db); $form = new FormProjets($db);
$arrayresult=$form->select_projects_list($socid, '', $htmlname, 0, 0, 1, 0, 0, 0, 1, $searchkey); $arrayresult=$form->select_projects_list($socid, '', $htmlname, 0, 0, 1, $discard_closed, 0, 0, 1, $searchkey);
$db->close(); $db->close();

View File

@ -47,6 +47,7 @@ if (! empty($conf->deplacement->enabled)) require_once DOL_DOCUMENT_ROOT.'/compt
if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; if (! empty($conf->expensereport->enabled)) require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; if (! empty($conf->don->enabled)) require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
if (! empty($conf->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
$langs->load("projects"); $langs->load("projects");
$langs->load("companies"); $langs->load("companies");
@ -58,6 +59,7 @@ if (! empty($conf->ficheinter->enabled)) $langs->load("interventions");
if (! empty($conf->deplacement->enabled)) $langs->load("trips"); if (! empty($conf->deplacement->enabled)) $langs->load("trips");
if (! empty($conf->expensereport->enabled)) $langs->load("trips"); if (! empty($conf->expensereport->enabled)) $langs->load("trips");
if (! empty($conf->don->enabled)) $langs->load("donations"); if (! empty($conf->don->enabled)) $langs->load("donations");
if (! empty($conf->loan->enabled)) $langs->load("loan");
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$ref=GETPOST('ref','alpha'); $ref=GETPOST('ref','alpha');
@ -370,6 +372,19 @@ $listofreferent=array(
'buttonnew'=>'AddDonation', 'buttonnew'=>'AddDonation',
'testnew'=>$user->rights->don->creer, 'testnew'=>$user->rights->don->creer,
'test'=>$conf->don->enabled && $user->rights->don->lire), 'test'=>$conf->don->enabled && $user->rights->don->lire),
'loan'=>array(
'name'=>"Loan",
'title'=>"ListLoanAssociatedProject",
'class'=>'Loan',
'margin'=>'add',
'table'=>'loan',
'datefieldname'=>'datestart',
'disableamount'=>0,
'urlnew'=>DOL_URL_ROOT.'/loan/card.php?action=create&projectid='.$id.'&socid='.$socid,
'lang'=>'loan',
'buttonnew'=>'AddLoan',
'testnew'=>$user->rights->loan->write,
'test'=>$conf->loan->enabled && $user->rights->loan->read),
'project_task'=>array( 'project_task'=>array(
'name'=>"TaskTimeValorised", 'name'=>"TaskTimeValorised",
'title'=>"ListTaskTimeUserProject", 'title'=>"ListTaskTimeUserProject",
@ -402,9 +417,9 @@ $parameters=array('listofreferent'=>$listofreferent);
$resHook = $hookmanager->executeHooks('completeListOfReferent',$parameters,$object,$action); $resHook = $hookmanager->executeHooks('completeListOfReferent',$parameters,$object,$action);
if(!empty($hookmanager->resArray)) { if(!empty($hookmanager->resArray)) {
$listofreferent = array_merge($listofreferent, $hookmanager->resArray); $listofreferent = array_merge($listofreferent, $hookmanager->resArray);
} }
if ($action=="addelement") if ($action=="addelement")
@ -495,7 +510,7 @@ foreach ($listofreferent as $key => $value)
$element = new $classname($db); $element = new $classname($db);
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee); $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
if (count($elementarray)>0 && is_array($elementarray)) if (count($elementarray)>0 && is_array($elementarray))
{ {
$total_ht = 0; $total_ht = 0;
@ -511,7 +526,7 @@ foreach ($listofreferent as $key => $value)
$element->fetch($idofelement); $element->fetch($idofelement);
if ($idofelementuser) $elementuser->fetch($idofelementuser); if ($idofelementuser) $elementuser->fetch($idofelementuser);
// Special cases // Special cases
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
if ($tablename == 'don') $total_ht_by_line=$element->amount; if ($tablename == 'don') $total_ht_by_line=$element->amount;
elseif ($tablename == 'projet_task') elseif ($tablename == 'projet_task')
@ -534,7 +549,7 @@ foreach ($listofreferent as $key => $value)
{ {
if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total if (! empty($element->close_code) && $element->close_code == 'replaced') $qualifiedfortotal=false; // Replacement invoice, do not include into total
} }
if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line; if ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
if ($tablename == 'don') $total_ttc_by_line=$element->amount; if ($tablename == 'don') $total_ttc_by_line=$element->amount;
@ -806,7 +821,7 @@ foreach ($listofreferent as $key => $value)
print ' - '.dol_trunc($element->label, 48); print ' - '.dol_trunc($element->label, 48);
} }
else print $element->getNomUrl(1); else print $element->getNomUrl(1);
$element_doc = $element->element; $element_doc = $element->element;
$filename=dol_sanitizeFileName($element->ref); $filename=dol_sanitizeFileName($element->ref);
$filedir=$conf->{$element_doc}->dir_output . '/' . dol_sanitizeFileName($element->ref); $filedir=$conf->{$element_doc}->dir_output . '/' . dol_sanitizeFileName($element->ref);
@ -822,7 +837,7 @@ foreach ($listofreferent as $key => $value)
} }
print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>'; print '<div class="inline-block valignmiddle">'.$formfile->getDocumentsLink($element_doc, $filename, $filedir).'</div>';
// Show supplier ref // Show supplier ref
if (! empty($element->ref_supplier)) print ' - '.$element->ref_supplier; if (! empty($element->ref_supplier)) print ' - '.$element->ref_supplier;
// Show customer ref // Show customer ref
@ -836,7 +851,7 @@ foreach ($listofreferent as $key => $value)
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status)) elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
{ {
if ($tablename=='don') $date = $element->datedon; if ($tablename=='don') $date = $element->datedon;
if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order')
{ {
$date=($element->date_commande?$element->date_commande:$element->date_valid); $date=($element->date_commande?$element->date_commande:$element->date_valid);
} }

View File

@ -208,7 +208,7 @@ if ($id > 0 || ! empty($ref))
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }

View File

@ -151,7 +151,7 @@ if ($object->id > 0)
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }

View File

@ -130,7 +130,7 @@ if ($object->id > 0)
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }

View File

@ -242,7 +242,7 @@ if ($id > 0 || ! empty($ref))
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }

View File

@ -318,7 +318,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
// Define a complementary filter for search of next/prev ref. // Define a complementary filter for search of next/prev ref.
if (! $user->rights->projet->all->lire) if (! $user->rights->projet->all->lire)
{ {
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,0);
$projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; $projectstatic->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
} }

View File

@ -226,7 +226,7 @@ if (empty($reshook))
$search_idprof6=''; $search_idprof6='';
$search_type=''; $search_type='';
$search_type_thirdparty=''; $search_type_thirdparty='';
$search_status=''; $search_status=-1;
$search_stcomm=''; $search_stcomm='';
$search_level_from=''; $search_level_from='';
$search_level_to=''; $search_level_to='';
@ -413,7 +413,7 @@ if ($search_idprof6) $sql.= natural_search("s.idprof6",$search_idprof6);
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status);
if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'"; if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= " AND s.barcode LIKE '%".$db->escape($search_barcode)."%'";
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
@ -878,7 +878,7 @@ if (! empty($arrayfields['s.tms']['checked']))
if (! empty($arrayfields['s.status']['checked'])) if (! empty($arrayfields['s.status']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="center">'; print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1);
print '</td>'; print '</td>';
} }
// Action column // Action column

View File

@ -290,9 +290,8 @@ if (empty($reshook))
else else
{ {
$object->name = GETPOST('name', 'alpha'); $object->name = GETPOST('name', 'alpha');
$object->name_alias = GETPOST('name_alias');
} }
$object->name_alias = GETPOST('name_alias');
$object->address = GETPOST('address'); $object->address = GETPOST('address');
$object->zip = GETPOST('zipcode', 'alpha'); $object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha'); $object->town = GETPOST('town', 'alpha');
@ -920,7 +919,6 @@ else
$("#radiocompany").click(function() { $("#radiocompany").click(function() {
$(".individualline").hide(); $(".individualline").hide();
$("#typent_id").val(0); $("#typent_id").val(0);
$("#name_alias").show();
$("#effectif_id").val(0); $("#effectif_id").val(0);
$("#TypeName").html(document.formsoc.ThirdPartyName.value); $("#TypeName").html(document.formsoc.ThirdPartyName.value);
document.formsoc.private.value=0; document.formsoc.private.value=0;
@ -928,7 +926,6 @@ else
$("#radioprivate").click(function() { $("#radioprivate").click(function() {
$(".individualline").show(); $(".individualline").show();
$("#typent_id").val(id_te_private); $("#typent_id").val(id_te_private);
$("#name_alias").hide();
$("#effectif_id").val(id_ef15); $("#effectif_id").val(id_ef15);
$("#TypeName").html(document.formsoc.LastName.value); $("#TypeName").html(document.formsoc.LastName.value);
document.formsoc.private.value=1; document.formsoc.private.value=1;
@ -970,7 +967,7 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="private" value='.$object->particulier.'>'; print '<input type="hidden" name="private" value='.$object->particulier.'>';
print '<input type="hidden" name="type" value='.GETPOST("type").'>'; print '<input type="hidden" name="type" value='.GETPOST("type").'>';
print '<input type="hidden" name="LastName" value="'.$langs->trans('LastName').'">'; print '<input type="hidden" name="LastName" value="'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName').'">';
print '<input type="hidden" name="ThirdPartyName" value="'.$langs->trans('ThirdPartyName').'">'; print '<input type="hidden" name="ThirdPartyName" value="'.$langs->trans('ThirdPartyName').'">';
if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '<input type="hidden" name="code_auto" value="1">'; if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '<input type="hidden" name="code_auto" value="1">';
@ -982,11 +979,11 @@ else
print '<tr><td class="titlefieldcreate">'; print '<tr><td class="titlefieldcreate">';
if ($object->particulier || $private) if ($object->particulier || $private)
{ {
print '<span id="TypeName" class="fieldrequired">'.$langs->trans('LastName','name').'</span>'; print '<span id="TypeName" class="fieldrequired">'.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName','name').'</span>';
} }
else else
{ {
print '<span span id="TypeName" class="fieldrequired">'.fieldLabel('ThirdPartyName','name').'</span>'; print '<span id="TypeName" class="fieldrequired">'.fieldLabel('ThirdPartyName','name').'</span>';
} }
print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>'; print '</td><td'.(empty($conf->global->SOCIETE_USEPREFIX)?' colspan="3"':'').'>';
print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus"></td>'; print '<input type="text" class="minwidth300" maxlength="128" name="name" id="name" value="'.$object->name.'" autofocus="autofocus"></td>';

View File

@ -86,13 +86,13 @@ print '<td align="center" valign="top">';
print '<table class="nocellnopadd">'; print '<table class="nocellnopadd">';
print '<tr><td align="center">'; print '<tr><td align="center">';
$urlwiki='http://wiki.dolibarr.org'; $urlwiki='https://wiki.dolibarr.org';
if (preg_match('/fr/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Accueil'; if (preg_match('/fr/i',$langs->defaultlang)) $urlwiki='https://wiki.dolibarr.org/index.php/Accueil';
if (preg_match('/es/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Portada'; if (preg_match('/es/i',$langs->defaultlang)) $urlwiki='https://wiki.dolibarr.org/index.php/Portada';
print '<br>'.$langs->trans("ForDocumentationSeeWiki",$urlwiki,$urlwiki); print '<br>'.$langs->trans("ForDocumentationSeeWiki",$urlwiki,$urlwiki);
print '<br>'; print '<br>';
$urlforum='http://www.dolibarr.org/forum/'; $urlforum='https://www.dolibarr.org/forum/';
$urlforumlocal='http://www.dolibarr.org/forum/'; $urlforumlocal='https://www.dolibarr.org/forum/';
if (preg_match('/fr/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.fr/forum/'; if (preg_match('/fr/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.fr/forum/';
if (preg_match('/es/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.es/index.php/foro/'; if (preg_match('/es/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.es/index.php/foro/';
if (preg_match('/it/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.it/forum/'; if (preg_match('/it/i',$langs->defaultlang)) $urlforumlocal='http://www.dolibarr.it/forum/';
@ -194,8 +194,7 @@ print '</td></tr></table>';
print '</td>'; print '</td>';
print '</tr><tr>'; print '</tr><tr>';
//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; $urlwiki='https://partners.dolibarr.org';
$urlwiki='http://partners.dolibarr.org';
print '<td align="center" valign="top">'; print '<td align="center" valign="top">';
print '<table class="nocellnopadd">'; print '<table class="nocellnopadd">';
print '<tr><td align="center">'; print '<tr><td align="center">';
@ -229,8 +228,7 @@ print '</td></tr></table>';
print '</td>'; print '</td>';
print '</tr><tr>'; print '</tr><tr>';
//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers'; $urlwiki='https://partners.dolibarr.org';
$urlwiki='http://partners.dolibarr.org';
print '<td align="center" valign="top">'; print '<td align="center" valign="top">';
print '<table class="nocellnopadd">'; print '<table class="nocellnopadd">';
print '<tr><td align="center">'; print '<tr><td align="center">';

View File

@ -241,6 +241,7 @@ body {
<?php } ?> <?php } ?>
color: rgb(<?php echo $colortext; ?>); color: rgb(<?php echo $colortext; ?>);
font-size: <?php print $fontsize ?>px; font-size: <?php print $fontsize ?>px;
line-height: 130%;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
@ -262,6 +263,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
input:focus, textarea:focus, button:focus, select:focus { input:focus, textarea:focus, button:focus, select:focus {
box-shadow: 0 0 4px #8091BF; box-shadow: 0 0 4px #8091BF;
/* TODO Remove shadow on focus. Use instead border-bottom: 1px solid #aaa !important; To disable with select2 too. */
} }
textarea.cke_source:focus textarea.cke_source:focus
{ {
@ -337,9 +339,9 @@ input[type=checkbox] { background-color: transparent; border: none; box-shadow:
input[type=radio] { background-color: transparent; border: none; box-shadow: none; } input[type=radio] { background-color: transparent; border: none; box-shadow: none; }
input[type=image] { background-color: transparent; border: none; box-shadow: none; } input[type=image] { background-color: transparent; border: none; box-shadow: none; }
input:-webkit-autofill { input:-webkit-autofill {
background-color: #FBFFEA !important; background-color: #FDFFF0 !important;
background-image:none !important; background-image:none !important;
-webkit-box-shadow: 0 0 0 50px #FBFFEA inset; -webkit-box-shadow: 0 0 0 50px #FDFFF0 inset;
} }
::-webkit-input-placeholder { color:#ccc; } ::-webkit-input-placeholder { color:#ccc; }
:-moz-placeholder { color:#bbb; } /* firefox 18- */ :-moz-placeholder { color:#bbb; } /* firefox 18- */
@ -593,6 +595,7 @@ div.myavailability {
.div-table-responsive { .div-table-responsive {
overflow-x: auto; overflow-x: auto;
min-height: 0.01%; min-height: 0.01%;
line-height: 100%;
} }
/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ /* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */
div.fiche>form>div.div-table-responsive { div.fiche>form>div.div-table-responsive {
@ -790,6 +793,7 @@ td.showDragHandle {
.side-nav { .side-nav {
display: table-cell; display: table-cell;
border-right: 1px solid #d0d0d0; border-right: 1px solid #d0d0d0;
box-shadow: 3px 0 6px -2px #eee;
} }
div.blockvmenulogo div.blockvmenulogo
{ {
@ -1375,6 +1379,7 @@ foreach($mainmenuusedarray as $val)
.bodylogin .bodylogin
{ {
background: #f0f0f0; background: #f0f0f0;
/* background: linear-gradient(to left top, rgb(255,255,255), rgb(240,240,240)) fixed; */
} }
.login_vertical_align { .login_vertical_align {
padding: 10px; padding: 10px;
@ -1406,12 +1411,29 @@ form#login {
-moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); -moz-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
-webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); -webkit-box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15); box-shadow: 0 2px 23px 2px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(60,60,60,0.15);
/*-moz-box-shadow: 3px 2px 20px #CCC; /*-moz-box-shadow: 3px 2px 20px #CCC;
-webkit-box-shadow: 3px 2px 20px #CCC; -webkit-box-shadow: 3px 2px 20px #CCC;
box-shadow: 3px 2px 20px #CCC;*/ box-shadow: 3px 2px 20px #CCC;*/
border-radius: 5px; border-radius: 5px;
border:solid 1px rgba(80,80,80,.4); /*border-top:solid 1px rgba(180,180,180,.4);
border-left:solid 1px rgba(180,180,180,.4);
border-right:solid 1px rgba(180,180,180,.4);
border-bottom:solid 1px rgba(180,180,180,.4);*/
}
.login_table input#username, .login_table input#password, .login_table input#securitycode {
border: none;
border-bottom: solid 1px rgba(180,180,180,.4);
padding: 5px;
margin-left: 18px;
margin-top: 5px;
}
.login_table input#username:focus, .login_table input#password:focus, .login_table input#securitycode:focus {
outline: none !important;
/* box-shadow: none;
-webkit-box-shadow: 0 0 0 50px #FFF inset;
box-shadow: 0 0 0 50px #FFF inset;*/
} }
.login_main_message { .login_main_message {
text-align: center; text-align: center;
@ -1448,8 +1470,8 @@ table.login_table_securitycode tr td {
border: 1px solid #DDDDDD; border: 1px solid #DDDDDD;
} }
#img_logo, .img_logo { #img_logo, .img_logo {
max-width: 200px; max-width: 170px;
max-height: 100px; max-height: 90px;
} }
div.login_block { div.login_block {
@ -1523,18 +1545,18 @@ img.loginphoto {
height: 16px; height: 16px;
} }
.span-icon-user { .span-icon-user {
/* background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>); */ background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>);
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.span-icon-password { .span-icon-password {
/* background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>); */ background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>);
background-repeat: no-repeat; background-repeat: no-repeat;
} }
/*
.span-icon-user input, .span-icon-password input { .span-icon-user input, .span-icon-password input {
/* margin-left: 18px; */ /* margin-left: 18px; */
margin-left: 0px; margin-left: 0px;
} }*/
/* ============================================================================== */ /* ============================================================================== */
/* Menu gauche */ /* Menu gauche */
@ -3050,7 +3072,7 @@ div.info {
-moz-border-radius: 4px; -moz-border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
background: #E0EAE4; background: #EaE4Ea;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
} }
@ -4443,7 +4465,7 @@ border-top-right-radius: 6px;
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
padding-top: 18px; padding-top: 18px;
: 54px; padding-left: 54px;
font-size: 14px; font-size: 14px;
height: 38px; height: 38px;
} }

View File

@ -242,6 +242,7 @@ body {
color: rgb(<?php echo $colortext; ?>); color: rgb(<?php echo $colortext; ?>);
font-size: <?php print $fontsize ?>px; font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>; font-family: <?php print $fontlist ?>;
line-height: 130%;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
margin-right: 0; margin-right: 0;
@ -262,6 +263,7 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
input:focus, textarea:focus, button:focus, select:focus { input:focus, textarea:focus, button:focus, select:focus {
box-shadow: 0 0 4px #8091BF; box-shadow: 0 0 4px #8091BF;
/* TODO Remove shadow on focus. Use instead border-bottom: 1px solid #aaa !important; To disable with select2 too. */
} }
textarea.cke_source:focus textarea.cke_source:focus
{ {
@ -598,6 +600,7 @@ div.myavailability {
.div-table-responsive { .div-table-responsive {
overflow-x: auto; overflow-x: auto;
min-height: 0.01%; min-height: 0.01%;
line-height: 100%;
} }
/* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */ /* Style used for full page tables with field selector and no content after table (priority before previous for such tables) */
div.fiche>form>div.div-table-responsive { div.fiche>form>div.div-table-responsive {
@ -805,6 +808,7 @@ td.showDragHandle {
<?php } else { ?> <?php } else { ?>
background: #FFF; background: #FFF;
border-right: 1px solid rgba(0,0,0,0.2); border-right: 1px solid rgba(0,0,0,0.2);
box-shadow: 3px 0 6px -2px #eee;
bottom: 0; bottom: 0;
color: #333; color: #333;
display: block; display: block;
@ -1453,6 +1457,19 @@ form#login {
border-top:solid 1px f8f8f8; border-top:solid 1px f8f8f8;
} }
.login_table input#username, .login_table input#password, .login_table input#securitycode{
border: none;
border-bottom: solid 1px rgba(180,180,180,.4);
padding: 5px;
margin-left: 18px;
margin-top: 5px;
}
.login_table input#username:focus, .login_table input#password:focus, .login_table input#securitycode:focus {
outline: none !important;
/* box-shadow: none;
-webkit-box-shadow: 0 0 0 50px #FFF inset;
box-shadow: 0 0 0 50px #FFF inset;*/
}
.login_main_message { .login_main_message {
text-align: center; text-align: center;
max-width: 560px; max-width: 560px;
@ -1488,8 +1505,8 @@ table.login_table_securitycode tr td {
border: 1px solid #f4f4f4; border: 1px solid #f4f4f4;
} }
#img_logo, .img-logo { #img_logo, .img-logo {
max-width: 200px; max-width: 170px;
max-height: 100px; max-height: 90px;
} }
div.login_block { div.login_block {
@ -1567,7 +1584,8 @@ img.loginphoto {
} }
.span-icon-user { .span-icon-user {
background: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>) no-repeat scroll 7px 7px; background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/object_user.png',1); ?>);
background-repeat: no-repeat;
} }
.span-icon-password { .span-icon-password {
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>); background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>);
@ -2976,7 +2994,7 @@ div.info {
-moz-border-radius: 4px; -moz-border-radius: 4px;
-webkit-border-radius: 4px; -webkit-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
background: #E0EAE4; background: #EaE4Ea;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
} }