Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into NEW_inventory_coreobject_listview
This commit is contained in:
commit
8b4a43ec77
@ -303,7 +303,7 @@ foreach($property as $key => $prop)
|
||||
$varprop.="\$this->db->escape(\$this->".$prop['field'].")";
|
||||
$varprop.=".\"'\")";
|
||||
}
|
||||
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_author')
|
||||
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_m' || $prop['field']=='fk_user_author')
|
||||
{
|
||||
$varprop.="'.\$user->id";
|
||||
}
|
||||
@ -367,7 +367,7 @@ foreach($property as $key => $prop)
|
||||
$varprop.=')."\'" : \'null\')';
|
||||
}
|
||||
|
||||
elseif ($prop['field']=='fk_user_mod') {
|
||||
elseif ($prop['field']=='fk_user_mod' || $prop['field']=='fk_user_m') {
|
||||
$varprop.="'.\$user->id";
|
||||
}
|
||||
else
|
||||
|
||||
@ -188,11 +188,13 @@ class Skeleton_Class extends CommonObject
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
*/
|
||||
|
||||
// $this->fetch_lines();
|
||||
|
||||
$this->db->free($resql);
|
||||
@ -251,23 +253,19 @@ class Skeleton_Class extends CommonObject
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new Skeleton_ClassLine();
|
||||
$line = new self($this->db);
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->prop1 = $obj->field1;
|
||||
$line->prop2 = $obj->field2;
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
//...
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
8
dev/tools/github_authors_peryear.sh
Executable file
8
dev/tools/github_authors_peryear.sh
Executable 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
|
||||
|
||||
15
dev/tools/github_commits_perversion.sh
Executable file
15
dev/tools/github_commits_perversion.sh
Executable 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
|
||||
|
||||
@ -888,18 +888,18 @@ if ($id)
|
||||
{
|
||||
if ($value == 'country')
|
||||
{
|
||||
print '<td>';
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre"></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">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
|
||||
@ -235,9 +235,8 @@ print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $options, "", 'width="60"
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">';
|
||||
print '<td>' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
||||
print '<td></td>';
|
||||
print '<td class="liste_titre">' . $object->select_account($search_accountancy_code_start, 'search_accountancy_code_start', 1, array (), 1, 1, '') . '</td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $langs->trans('From') . ': ';
|
||||
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 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> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td 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"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
print '<td class="liste_titre" align="right" colspan="2">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
|
||||
@ -83,6 +83,8 @@ class FormVentilation extends Form
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$out = '';
|
||||
|
||||
$options = array();
|
||||
if ($usecache && ! empty($this->options_cache[$usecache]))
|
||||
{
|
||||
@ -109,7 +111,7 @@ class FormVentilation extends Form
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$selected = 0;
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
// Langs
|
||||
$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 .= " , " . MAIN_DB_PREFIX . "facture as f";
|
||||
$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);
|
||||
$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.entity IN (" . getEntity("facture", 0) . ")"; // We don't share object for accountancy
|
||||
$sql .= " AND aa.account_number IS NULL";
|
||||
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$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";
|
||||
|
||||
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 .= " 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 . ")";
|
||||
}
|
||||
$sql .= " AND aa.account_number IS NOT NULL";
|
||||
$sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
|
||||
|
||||
@ -301,97 +319,105 @@ print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
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("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
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_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("TotalVente") . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
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();
|
||||
$db->close();
|
||||
|
||||
@ -210,6 +210,11 @@ if (strlen(trim($search_account))) {
|
||||
if (strlen(trim($search_vat))) {
|
||||
$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 .= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -290,55 +290,55 @@ print "</table>\n";
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
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 '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
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_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 '<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();
|
||||
$db->close();
|
||||
|
||||
@ -289,58 +289,56 @@ print "</table>\n";
|
||||
|
||||
|
||||
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
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 '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
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_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 '<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("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();
|
||||
$db->close();
|
||||
|
||||
@ -91,10 +91,10 @@ if ($action == 'add' && $user->rights->adherent->configurer)
|
||||
$object = new AdherentType($db);
|
||||
|
||||
$object->libelle = trim($label);
|
||||
$object->subscription = trim($subscription);
|
||||
$object->subscription = (int) trim($subscription);
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = trim($vote);
|
||||
$object->mail_valid = (boolean) trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
@ -129,10 +129,10 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
||||
$object = new AdherentType($db);
|
||||
$object->id = $rowid;
|
||||
$object->libelle = trim($label);
|
||||
$object->subscription = trim($subscription);
|
||||
$object->subscription = (int) trim($subscription);
|
||||
$object->note = trim($comment);
|
||||
$object->mail_valid = trim($mail_valid);
|
||||
$object->vote = trim($vote);
|
||||
$object->mail_valid = (boolean) trim($mail_valid);
|
||||
$object->vote = (boolean) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||
|
||||
@ -104,6 +104,11 @@ if ($action == 'setvalue' && $user->admin)
|
||||
* 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);
|
||||
|
||||
llxHeader('',$langs->trans("PrintingSetup"));
|
||||
@ -127,70 +132,179 @@ if ($mode == 'setup' && $user->admin)
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1;
|
||||
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&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
$var=true;
|
||||
|
||||
$var=false;
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th>'.$langs->trans("Value").'</th>';
|
||||
print '<th> </th>';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$submit_enabled=0;
|
||||
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td'.($key['required']?' class=required':'').'>'.$langs->trans($key['varname']).'</td>';
|
||||
print '<td>'.$langs->trans($key['info']).'</td>';
|
||||
print '<td'.($key['required']?' class="required"':'').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("SeePreviousTab");
|
||||
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 '</tr>'."\n";
|
||||
|
||||
// Show value of token
|
||||
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
|
||||
$var = ! $var;
|
||||
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
|
||||
print '<tr '.$bc[$var].'>';
|
||||
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";
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br><br>';
|
||||
}
|
||||
// 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>';
|
||||
|
||||
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 '</form>';
|
||||
}
|
||||
|
||||
|
||||
@ -82,8 +82,8 @@ $xmlremote = GETPOST('xmlremote')?GETPOST('xmlremote'):'https://www.dolibarr.org
|
||||
|
||||
// Test if remote test is ok
|
||||
$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 $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
|
||||
@ -101,7 +101,8 @@ else
|
||||
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
|
||||
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
|
||||
{
|
||||
@ -156,19 +157,25 @@ if ($xml)
|
||||
$file_list = array();
|
||||
$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 '<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 '</tr>'."\n";
|
||||
$var = true;
|
||||
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
|
||||
if (is_array($tmpfilelist) && count($tmpfilelist))
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($tmpfilelist as $file)
|
||||
{
|
||||
$i++;
|
||||
$var = !$var;
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>'.$i.'</td>' . "\n";
|
||||
print '<td>'.$file['filename'].'</td>' . "\n";
|
||||
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
|
||||
print "</tr>\n";
|
||||
@ -176,15 +183,18 @@ if ($xml)
|
||||
}
|
||||
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 '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("FilesUpdated"));
|
||||
|
||||
print '<table class="noborder">';
|
||||
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("CurrentChecksum") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("Size") . '</td>';
|
||||
@ -194,10 +204,13 @@ if ($xml)
|
||||
$tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
|
||||
if (is_array($tmpfilelist2) && count($tmpfilelist2))
|
||||
{
|
||||
$i = 0;
|
||||
foreach ($tmpfilelist2 as $file)
|
||||
{
|
||||
$i++;
|
||||
$var = !$var;
|
||||
print '<tr ' . $bc[$var] . '>';
|
||||
print '<td>'.$i.'</td>' . "\n";
|
||||
print '<td>'.$file['filename'].'</td>' . "\n";
|
||||
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
|
||||
print '<td align="center">'.$file['md5'].'</td>' . "\n";
|
||||
@ -241,14 +254,12 @@ if ($xml)
|
||||
//var_dump($checksumconcat);
|
||||
$checksumget = md5(join(',',$checksumconcat));
|
||||
$checksumtoget = $xml->dolibarr_htdocs_dir_checksum;
|
||||
if ($checksumtoget)
|
||||
{
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("GlobalChecksum").'</strong><br>';
|
||||
print $langs->trans("ExpectedChecksum").' = '.$checksumtoget.'<br>';
|
||||
print $langs->trans("CurrentChecksum").' = '.$checksumget;
|
||||
}
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
print_fiche_titre($langs->trans("GlobalChecksum")).'<br>';
|
||||
print $langs->trans("ExpectedChecksum").' = '. ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")) .'<br>';
|
||||
print $langs->trans("CurrentChecksum").' = '.$checksumget;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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/';
|
||||
$urldolibarrthemes='https://www.dolistore.com/';
|
||||
$dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
|
||||
|
||||
@ -37,7 +37,7 @@ class Facturation
|
||||
* int $prix => Prix HT du produit en cours
|
||||
* int $tva => 'rowid' du taux de tva dans llx_c_tva
|
||||
*/
|
||||
var $id;
|
||||
public $id;
|
||||
protected $ref;
|
||||
protected $qte;
|
||||
protected $stock;
|
||||
|
||||
@ -656,7 +656,7 @@ foreach ($typeofevents as $typeofevent)
|
||||
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$tmpmonth && $todayarray['year']==$tmpyear) $today=1;
|
||||
if ($today) $style='cal_today_peruser';
|
||||
|
||||
show_day_events2($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
|
||||
show_day_events_pertype($username, $tmpday, $tmpmonth, $tmpyear, $monthshown, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, $showheader, $colorsbytype, $var);
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -756,7 +756,7 @@ $db->close();
|
||||
* @param bool $var true or false for alternat style on tr/td
|
||||
* @return void
|
||||
*/
|
||||
function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false)
|
||||
function show_day_events_pertype($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false)
|
||||
{
|
||||
global $db;
|
||||
global $user, $conf, $langs, $hookmanager, $action;
|
||||
|
||||
@ -223,7 +223,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Categorisation dans projet
|
||||
// Link to a project
|
||||
else if ($action == 'classin' && $user->rights->commande->creer)
|
||||
{
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
|
||||
@ -39,10 +39,6 @@ class Cpaiement
|
||||
*/
|
||||
public $table_element = 'c_paiement';
|
||||
|
||||
/**
|
||||
* @var CpaiementLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -227,84 +223,6 @@ class Cpaiement
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.id,';
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.type,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.accountancy_code,";
|
||||
$sql .= " t.module";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new CpaiementLine();
|
||||
|
||||
$line->id = $obj->id;
|
||||
|
||||
$line->code = $obj->code;
|
||||
$line->libelle = $obj->libelle;
|
||||
$line->type = $obj->type;
|
||||
$line->active = $obj->active;
|
||||
$line->accountancy_code = $obj->accountancy_code;
|
||||
$line->module = $obj->module;
|
||||
|
||||
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
|
||||
@ -43,11 +43,6 @@ class Cchargesociales
|
||||
*/
|
||||
public $table_element = 'c_chargesociales';
|
||||
|
||||
/**
|
||||
* @var CchargesocialesLine[] Lines
|
||||
*/
|
||||
public $lines = array();
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
@ -237,83 +232,6 @@ class Cchargesociales
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= " t.id,";
|
||||
$sql .= " t.libelle,";
|
||||
$sql .= " t.deductible,";
|
||||
$sql .= " t.active,";
|
||||
$sql .= " t.code,";
|
||||
$sql .= " t.fk_pays,";
|
||||
$sql .= " t.module,";
|
||||
$sql .= " t.accountancy_code";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new CchargesocialesLine();
|
||||
|
||||
$line->id = $obj->id;
|
||||
$line->libelle = $obj->libelle;
|
||||
$line->deductible = $obj->deductible;
|
||||
$line->active = $obj->active;
|
||||
$line->code = $obj->code;
|
||||
$line->fk_pays = $obj->fk_pays;
|
||||
$line->module = $obj->module;
|
||||
$line->accountancy_code = $obj->accountancy_code;
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
|
||||
@ -18,10 +18,12 @@
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
|
||||
// Variable $upload_dir must be defined when entering here
|
||||
// Variable $upload_dirold may also exists.
|
||||
|
||||
//var_dump($upload_dir);
|
||||
//var_dump($upload_dirold);
|
||||
|
||||
// Submit file/link
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
@ -165,7 +167,11 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave'))
|
||||
|
||||
setEventMessages($langs->trans("FileRenamed"), null);
|
||||
}
|
||||
else setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
|
||||
else
|
||||
{
|
||||
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
|
||||
setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1929,7 +1929,10 @@ abstract class CommonObject
|
||||
*/
|
||||
function updateRangOfLine($rowid,$rang)
|
||||
{
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET rang = '.$rang;
|
||||
$fieldposition = 'rang';
|
||||
if ($this->table_element_line == 'ecm_files') $fieldposition = 'position';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
|
||||
$sql.= ' WHERE rowid = '.$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::updateRangOfLine", LOG_DEBUG);
|
||||
@ -3296,84 +3299,90 @@ abstract class CommonObject
|
||||
$usemargins=0;
|
||||
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"> </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);
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
|
||||
//Line extrafield
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafieldsline = new ExtraFields($this->db);
|
||||
$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"> </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)
|
||||
{
|
||||
@ -3392,7 +3401,7 @@ abstract class CommonObject
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,16 +331,40 @@ class ExtraFields
|
||||
|
||||
$table=$elementtype.'_extrafields';
|
||||
|
||||
$error=0;
|
||||
|
||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
|
||||
{
|
||||
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
|
||||
$result=$this->delete_label($attrname,$elementtype);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
|
||||
$result=$this->delete_label($attrname,$elementtype);
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "SELECT COUNT(rowid) as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE elementtype = '".$elementtype."'";
|
||||
$sql.= " AND name = '".$attrname."'";
|
||||
//$sql.= " AND entity IN (0,".$conf->entity.")"; Do not test on entity here. We want to see if there is still on field remaning in other entities before deleting field in table
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj->nb <= 0)
|
||||
{
|
||||
$result=$this->db->DDLDropField(MAIN_DB_PREFIX.$table,$attrname); // This also drop the unique key
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
else
|
||||
|
||||
@ -856,38 +856,62 @@ class FormFile
|
||||
|
||||
|
||||
/**
|
||||
* Show list of documents in a directory
|
||||
* Show list of documents in $filearray (may be they are all in same directory but may not)
|
||||
*
|
||||
* @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this
|
||||
* @param Object $object Object on which document is linked to
|
||||
* @param string $modulepart Value for modulepart used by download or viewimage wrapper
|
||||
* @param array $filearray Array of files loaded by dol_dir_list('files') function before calling this.
|
||||
* @param Object $object Object on which document is linked to.
|
||||
* @param string $modulepart Value for modulepart used by download or viewimage wrapper.
|
||||
* @param string $param Parameters on sort links (param must start with &, example &aaa=bbb&ccc=ddd)
|
||||
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
|
||||
* @param string $relativepath Relative path of docs (autodefined if not provided)
|
||||
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file.
|
||||
* @param string $relativepath Relative path of docs (autodefined if not provided), relative to module dir, not to MAIN_DATA_ROOT.
|
||||
* @param int $permonobject Permission on object (so permission to delete or crop document)
|
||||
* @param int $useinecm Change output for use in ecm module
|
||||
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
|
||||
* @param int $maxlength Maximum length of file name shown
|
||||
* @param int $maxlength Maximum length of file name shown.
|
||||
* @param string $title Title before list
|
||||
* @param string $url Full url to use for click links ('' = autodetect)
|
||||
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
|
||||
* @param int $permtoeditline Permission to edit document line (-1 is deprecated)
|
||||
* @param int $permtoeditline Permission to edit document line (You must provide a value, -1 is deprecated and must not be used any more)
|
||||
* @param string $upload_dir Full path directory so we can know dir relative to MAIN_DATA_ROOT. Fill this if you want to complete file data with database indexes.
|
||||
* @param string $sortfield Sort field ('name', 'size', 'position', ...)
|
||||
* @param string $sortorder Sort order ('ASC' or 'DESC')
|
||||
* @param int $disablemove 1=Disable move button, 0=Position move is possible.
|
||||
* @return int <0 if KO, nb of files shown if OK
|
||||
*/
|
||||
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1)
|
||||
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1)
|
||||
{
|
||||
global $user, $conf, $langs, $hookmanager;
|
||||
global $bc;
|
||||
global $bc,$bcdd;
|
||||
global $sortfield, $sortorder, $maxheightmini;
|
||||
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
// Define relative path used to store the file
|
||||
if (empty($relativepath))
|
||||
{
|
||||
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
|
||||
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2,0,0,$object,'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||
}
|
||||
// For backward compatiblity, we detect file is stored into an old path
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $file['level1name'] == 'photos')
|
||||
{
|
||||
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
||||
}
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($upload_dir)
|
||||
{
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir);
|
||||
$relativedir = preg_replace('/^[\\/]/','',$relativedir);
|
||||
}
|
||||
|
||||
$hookmanager->initHooks(array('formfile'));
|
||||
$parameters=array(
|
||||
'filearray' => $filearray,
|
||||
'modulepart'=> $modulepart,
|
||||
'param' => $param,
|
||||
'forcedownload' => $forcedownload,
|
||||
'relativepath' => $relativepath,
|
||||
'relativepath' => $relativepath, // relative filename to module dir
|
||||
'relativedir' => $relativedir, // relative dirname to DOL_DATA_ROOT
|
||||
'permtodelete' => $permonobject,
|
||||
'useinecm' => $useinecm,
|
||||
'textifempty' => $textifempty,
|
||||
@ -932,45 +956,119 @@ class FormFile
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
|
||||
}
|
||||
print '<table width="100%" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
||||
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborderbottom':'liste').'">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print_liste_field_titre($langs->trans("Documents2"),$url,"name","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Size"),$url,"size","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$url,"date","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (empty($useinecm)) print_liste_field_titre('',$url,"","",$param,'align="center"');
|
||||
print_liste_field_titre('');
|
||||
if (! $disablemove) print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
// Get list of files stored into database for same relative directory
|
||||
if ($relativedir)
|
||||
{
|
||||
$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);
|
||||
|
||||
//var_dump($filearray);
|
||||
//var_dump($filearrayindatabase);
|
||||
|
||||
// Complete filearray with properties found into $filearrayindatabase
|
||||
foreach($filearray as $key => $val)
|
||||
{
|
||||
$found=0;
|
||||
// Search if it exists into $filearrayindatabase
|
||||
foreach($filearrayindatabase as $key2 => $val2)
|
||||
{
|
||||
if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name'])
|
||||
{
|
||||
$filearray[$key]['position_name']=($filearrayindatabase[$key2]['position']?$filearrayindatabase[$key2]['position']:'0').'_'.$filearrayindatabase[$key2]['name'];
|
||||
$filearray[$key]['position']=$filearrayindatabase[$key2]['position'];
|
||||
$filearray[$key]['cover']=$filearrayindatabase[$key2]['cover'];
|
||||
$filearray[$key]['acl']=$filearrayindatabase[$key2]['acl'];
|
||||
$filearray[$key]['rowid']=$filearrayindatabase[$key2]['rowid'];
|
||||
$filearray[$key]['label']=$filearrayindatabase[$key2]['label'];
|
||||
$found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $found) // This happen in transition towerd version 6, or if files were added manually into os dir.
|
||||
{
|
||||
$filearray[$key]['position']='999999'; // File not indexed are at end. So if we add a file, it will not replace an existing position
|
||||
$filearray[$key]['cover']=0;
|
||||
$filearray[$key]['acl']='';
|
||||
|
||||
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $filearray[$key]['fullname']);
|
||||
if (! preg_match('/(\/temp\/|\/thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file
|
||||
{
|
||||
dol_syslog("list_of_documents We found a file called '".$filearray[$key]['name']."' not indexed into database. We add it");
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($this->db);
|
||||
|
||||
// Add entry into database
|
||||
$filename = basename($rel_filename);
|
||||
$rel_dir = dirname($rel_filename);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($filearray[$key]['fullname'])); // $destfile is a full path to file
|
||||
$ecmfile->fullpath_orig = $filearray[$key]['fullname'];
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
else
|
||||
{
|
||||
$filearray[$key]['rowid']=$result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$filearray[$key]['rowid']=0; // Should not happened
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*var_dump($filearray);
|
||||
var_dump($sortfield);
|
||||
var_dump($sortorder);*/
|
||||
|
||||
if ($sortfield && $sortorder)
|
||||
{
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
//var_dump($filearray);
|
||||
}
|
||||
|
||||
$nboffiles=count($filearray);
|
||||
|
||||
if ($nboffiles > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$var=true;
|
||||
|
||||
$var=true; $i=0; $nboflines = 0; $lastrowid=0;
|
||||
foreach($filearray as $key => $file) // filearray must be only files here
|
||||
{
|
||||
if ($file['name'] != '.'
|
||||
&& $file['name'] != '..'
|
||||
&& ! preg_match('/\.meta$/i',$file['name']))
|
||||
{
|
||||
// Define relative path used to store the file
|
||||
if (empty($relativepath))
|
||||
{
|
||||
$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
|
||||
if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2,0,0,$object,'invoice_supplier').$relativepath; // TODO Call using a defined value for $relativepath
|
||||
if ($object->element == 'project_task') $relativepath='Call_not_supported_._Call_function_using_a_defined_relative_path_.';
|
||||
}
|
||||
// For backward compatiblity, we detect file is stored into an old path
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO) && $file['level1name'] == 'photos')
|
||||
{
|
||||
$relativepath=preg_replace('/^.*\/produit\//','',$file['path']).'/';
|
||||
}
|
||||
$var=!$var;
|
||||
|
||||
$editline=0;
|
||||
if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid'];
|
||||
|
||||
print '<!-- Line list_of_documents '.$key.' -->'."\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
$editline=0;
|
||||
$nboflines++;
|
||||
print '<!-- Line list_of_documents '.$key.' relativepath = '.$relativepath.' -->'."\n";
|
||||
// Do we have entry into database ?
|
||||
print '<!-- In database: position='.$filearray[$key]['position'].' -->'."\n";
|
||||
print '<tr id="row-'.($filearray[$key]['rowid']>0?$filearray[$key]['rowid']:'-AFTER'.$lastrowid.'POS'.($i+1)).'" '.$bcdd[$var].'>';
|
||||
print '<td class="tdoverflow">';
|
||||
|
||||
//print "XX".$file['name']; //$file['name'] must be utf8
|
||||
@ -1074,6 +1172,24 @@ class FormFile
|
||||
print '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
|
||||
}
|
||||
print "</td>";
|
||||
|
||||
if (empty($disablemove))
|
||||
{
|
||||
if ($nboffiles > 1 && empty($conf->browser->phone)) {
|
||||
print '<td align="center" class="linecolmove tdlineupdown">';
|
||||
if ($i > 0) {
|
||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=up&rowid='.$line->id.'">'.img_up('default',0,'imgupforline').'</a>';
|
||||
}
|
||||
if ($i < $nboffiles-1) {
|
||||
print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=down&rowid='.$line->id.'">'.img_down('default',0,'imgdownforline').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
else {
|
||||
print '<td align="center"'.((empty($conf->browser->phone) && empty($disablemove)) ?' class="linecolmove tdlineupdown"':' class="linecolmove"').'>';
|
||||
print '</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1081,18 +1197,32 @@ class FormFile
|
||||
print '<input type="submit" class="button" name="renamefilesave" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
print '</td>';
|
||||
if (empty($disablemove)) print '<td class="right"></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
if ($nboffiles == 0)
|
||||
{
|
||||
print '<tr '.$bc[false].'><td colspan="'.(empty($useinecm)?'5':'5').'" class="opacitymedium">';
|
||||
$colspan=(empty($useinecm)?'5':'5');
|
||||
if (empty($disablemove)) $colspan++;
|
||||
print '<tr '.$bc[false].'><td colspan="'.$colspan.'" class="opacitymedium">';
|
||||
if (empty($textifempty)) print $langs->trans("NoFileFound");
|
||||
else print $textifempty;
|
||||
print '</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
if (! $editline && $nboflines > 1) {
|
||||
if (! empty($conf->use_javascript_ajax) && $permtoeditline) {
|
||||
$table_element_line = 'ecm_files';
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('action') == 'editfile' && $permtoeditline)
|
||||
{
|
||||
print '</form>';
|
||||
|
||||
@ -79,7 +79,7 @@ class FormProjets
|
||||
$project->fetch($selected);
|
||||
$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(
|
||||
// 'update' => array(
|
||||
// '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)
|
||||
|
||||
$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='';
|
||||
$projectkey="fk_projet";
|
||||
//print $table_element;
|
||||
switch ($table_element)
|
||||
{
|
||||
case "loan":
|
||||
$sql = "SELECT t.rowid, t.label as ref";
|
||||
break;
|
||||
case "facture":
|
||||
$sql = "SELECT t.rowid, t.facnumber as ref";
|
||||
break;
|
||||
|
||||
@ -41,7 +41,7 @@ function dol_basename($pathfile)
|
||||
* Scan a directory and return a list of files/directories.
|
||||
* Content for string is UTF8 and dir separator is "/".
|
||||
*
|
||||
* @param string $path Starting path from which to search
|
||||
* @param string $path Starting path from which to search. This is a full path.
|
||||
* @param string $types Can be "directories", "files", or "all"
|
||||
* @param int $recursive Determines whether subdirectories are searched
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
@ -50,7 +50,8 @@ function dol_basename($pathfile)
|
||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
|
||||
* @param int $nohook Disable all hooks
|
||||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file')
|
||||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','date'=>'yyy','size'=>99,'type'=>'dir|file',...)
|
||||
* @see dol_dir_list_indatabase
|
||||
*/
|
||||
function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=false)
|
||||
{
|
||||
@ -87,7 +88,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
}
|
||||
|
||||
// $reshook may contain returns stacked by other modules
|
||||
// $reshook is always empty with an array for can not lose returns stacked with other modules
|
||||
// $reshook is always empty with an array to not lose returns stacked with other modules
|
||||
// $hookmanager->resArray may contain array stacked by other modules
|
||||
if (! $nohook && ! empty($hookmanager->resArray)) // forced to use $hookmanager->resArray even if $hookmanager->resArray['nodes'] is empty
|
||||
{
|
||||
@ -205,6 +206,84 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scan a directory and return a list of files/directories.
|
||||
* Content for string is UTF8 and dir separator is "/".
|
||||
*
|
||||
* @param string $path Starting path from which to search. Example: 'produit/MYPROD'
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @param array|null $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.'))
|
||||
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
|
||||
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like description
|
||||
* @return array Array of array('name'=>'xxx','fullname'=>'/abc/xxx','type'=>'dir|file',...)
|
||||
* @see dol_dir_list
|
||||
*/
|
||||
function dol_dir_list_in_database($path, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0)
|
||||
{
|
||||
global $conf, $db;
|
||||
|
||||
$sql=" SELECT rowid, label, entity, filename, filepath, fullpath_orig, keywords, cover, gen_or_uploaded, extraparams, date_c, date_m, fk_user_c, fk_user_m, acl, position";
|
||||
if ($mode) $sql.=", description";
|
||||
$sql.=" FROM ".MAIN_DB_PREFIX."ecm_files";
|
||||
$sql.=" WHERE filepath = '".$db->escape($path)."'";
|
||||
$sql.=" AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$file_list=array();
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
preg_match('/([^\/]+)\/[^\/]+$/',DOL_DATA_ROOT.'/'.$obj->filepath.'/'.$obj->filename,$reg);
|
||||
$level1name=(isset($reg[1])?$reg[1]:'');
|
||||
$file_list[] = array(
|
||||
"rowid" => $obj->rowid,
|
||||
"label" => $obj->label, // md5
|
||||
"name" => $obj->filename,
|
||||
"path" => DOL_DATA_ROOT.'/'.$obj->filepath,
|
||||
"level1name" => $level1name,
|
||||
"fullname" => DOL_DATA_ROOT.'/'.$obj->filepath.'/'.$obj->filename,
|
||||
"fullpath_orig" => $obj->fullpath_orig,
|
||||
"date_c" => $db->jdate($obj->date_c),
|
||||
"date_m" => $db->jdate($obj->date_m),
|
||||
"type" => 'file',
|
||||
"keywords" => $obj->keywords,
|
||||
"cover" => $obj->cover,
|
||||
"position" => (int) $obj->position,
|
||||
"acl" => $obj->acl
|
||||
);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Obtain a list of columns
|
||||
if (! empty($sortcriteria))
|
||||
{
|
||||
$myarray=array();
|
||||
foreach ($file_list as $key => $row)
|
||||
{
|
||||
$myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:'');
|
||||
}
|
||||
// Sort the data
|
||||
if ($sortorder) array_multisort($myarray, $sortorder, $file_list);
|
||||
}
|
||||
|
||||
return $file_list;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fast compare of 2 files identified by their properties ->name, ->date and ->size
|
||||
*
|
||||
@ -497,11 +576,19 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
|
||||
*/
|
||||
function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
{
|
||||
global $conf;
|
||||
global $user, $db, $conf;
|
||||
$result=false;
|
||||
|
||||
dol_syslog("files.lib.php::dol_move srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwritifexists=".$overwriteifexists);
|
||||
$srcexists=dol_is_file($srcfile);
|
||||
$destexists=dol_is_file($destfile);
|
||||
|
||||
if (! $srcexists)
|
||||
{
|
||||
dol_syslog("files.lib.php::dol_move srcfile does not exists. we ignore the move request.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($overwriteifexists || ! $destexists)
|
||||
{
|
||||
$newpathofsrcfile=dol_osencode($srcfile);
|
||||
@ -512,13 +599,68 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
{
|
||||
if ($destexists)
|
||||
{
|
||||
dol_syslog("files.lib.php::dol_move failed. We try to delete first and move after.", LOG_WARNING);
|
||||
dol_syslog("files.lib.php::dol_move Failed. We try to delete target first and move after.", LOG_WARNING);
|
||||
// We force delete and try again. Rename function sometimes fails to replace dest file with some windows NTFS partitions.
|
||||
dol_delete_file($destfile);
|
||||
$result=@rename($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
|
||||
}
|
||||
else dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
|
||||
else dol_syslog("files.lib.php::dol_move Failed.", LOG_WARNING);
|
||||
}
|
||||
|
||||
// Move ok
|
||||
if ($result)
|
||||
{
|
||||
// Rename entry into ecm database
|
||||
$rel_filetorenamebefore = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $srcfile);
|
||||
$rel_filetorenameafter = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $destfile);
|
||||
if (! preg_match('/(\/temp\/|\/thumbs|\.meta$)/', $rel_filetorenameafter)) // If not a tmp file
|
||||
{
|
||||
$rel_filetorenamebefore = preg_replace('/^[\\/]/', '', $rel_filetorenamebefore);
|
||||
$rel_filetorenameafter = preg_replace('/^[\\/]/', '', $rel_filetorenameafter);
|
||||
//var_dump($rel_filetorenamebefore.' - '.$rel_filetorenameafter);
|
||||
|
||||
dol_syslog("Try to rename also entries in database for full relative path before = ".$rel_filetorenamebefore." after = ".$rel_filetorenameafter, LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filetorenamebefore);
|
||||
if ($result > 0) // If found
|
||||
{
|
||||
$filename = basename($rel_filetorenameafter);
|
||||
$rel_dir = dirname($rel_filetorenameafter);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$result = $ecmfile->update($user);
|
||||
}
|
||||
elseif ($result == 0) // If not found
|
||||
{
|
||||
$filename = basename($rel_filetorenameafter);
|
||||
$rel_dir = dirname($rel_filetorenameafter);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfile)); // $destfile is a full path to file
|
||||
$ecmfile->fullpath_orig = $srcfile;
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
elseif ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($newmask)) $newmask=empty($conf->global->MAIN_UMASK)?'0755':$conf->global->MAIN_UMASK;
|
||||
$newmaskdec=octdec($newmask);
|
||||
// Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too)
|
||||
@ -743,10 +885,33 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
|
||||
{
|
||||
if ($nophperrors) $ok=@unlink($filename);
|
||||
else $ok=unlink($filename);
|
||||
if ($ok) dol_syslog("Removed file ".$filename, LOG_DEBUG);
|
||||
if ($ok)
|
||||
{
|
||||
dol_syslog("Removed file ".$filename, LOG_DEBUG);
|
||||
|
||||
// Delete entry into ecm database
|
||||
$rel_filetodelete = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $filename);
|
||||
if (! preg_match('/(\/temp\/|\/thumbs\/|\.meta$)/', $rel_filetodelete)) // If not a tmp file
|
||||
{
|
||||
$rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete);
|
||||
|
||||
dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG);
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filetodelete);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$result = $ecmfile->delete($user);
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
else dol_syslog("Failed to remove file ".$filename, LOG_WARNING);
|
||||
// TODO Failure to remove can be because file was already removed or because of permission
|
||||
// If error because of not exists, we must can return true but we should return false if this is a permission problem
|
||||
// If error because of not exists, we must should return true and we should return false if this is a permission problem
|
||||
}
|
||||
}
|
||||
else dol_syslog("No files to delete found", LOG_WARNING);
|
||||
@ -995,12 +1160,12 @@ function dol_init_file_process($pathtoscan='', $trackid='')
|
||||
* All information used are in db, conf, langs, user and _FILES.
|
||||
* Note: This function can be used only into a HTML page context.
|
||||
*
|
||||
* @param string $upload_dir Directory where to store uploaded file (note: also find in first part of dest_file)
|
||||
* @param string $upload_dir Directory where to store uploaded file (note: used to forge $destpath = $upload_dir + filename)
|
||||
* @param int $allowoverwrite 1=Allow overwrite existing file
|
||||
* @param int $donotupdatesession 1=Do no edit _SESSION variable
|
||||
* @param string $varfiles _FILES var name
|
||||
* @param string $savingdocmask Mask to use to define output filename. For example 'XXXXX-__YYYYMMDD__-__file__'
|
||||
* @param string $link Link to add
|
||||
* @param string $link Link to add (to add a link instead of a file)
|
||||
* @param string $trackid Track id (used to prefix name of session vars to avoid conflict)
|
||||
* @return void
|
||||
*/
|
||||
@ -1026,49 +1191,82 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
||||
|
||||
for ($i = 0; $i < $nbfile; $i++)
|
||||
{
|
||||
// Define $destpath (path to file including filename) and $destfile (only filename)
|
||||
$destpath=$upload_dir . "/" . $TFile['name'][$i];
|
||||
// Define $destfull (path to file including filename) and $destfile (only filename)
|
||||
$destfull=$upload_dir . "/" . $TFile['name'][$i];
|
||||
$destfile=$TFile['name'][$i];
|
||||
|
||||
$savingdocmask = dol_sanitizeFileName($savingdocmask);
|
||||
|
||||
if ($savingdocmask)
|
||||
{
|
||||
$destpath=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
$destfull=$upload_dir . "/" . preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
$destfile=preg_replace('/__file__/',$TFile['name'][$i],$savingdocmask);
|
||||
}
|
||||
|
||||
// lowercase extension
|
||||
$info = pathinfo($destpath);
|
||||
$destpath = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']);
|
||||
$info = pathinfo($destfull);
|
||||
$destfull = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']);
|
||||
$info = pathinfo($destfile);
|
||||
$destfile = $info['filename'].'.'.strtolower($info['extension']);
|
||||
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
if (is_numeric($resupload) && $resupload > 0)
|
||||
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
|
||||
|
||||
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'
|
||||
{
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
// Generate thumbs.
|
||||
if (image_format_supported($destfull) == 1)
|
||||
{
|
||||
// Create thumbs
|
||||
// We can't use $object->addThumbs here because there is no $object known
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
}
|
||||
|
||||
// Update session
|
||||
if (empty($donotupdatesession))
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->trackid = $trackid;
|
||||
$formmail->add_attached_files($destpath, $destfile, $TFile['type'][$i]);
|
||||
$formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]);
|
||||
}
|
||||
if (image_format_supported($destpath) == 1)
|
||||
|
||||
// Update table of files
|
||||
if ($donotupdatesession)
|
||||
{
|
||||
// Create thumbs
|
||||
// We can't use $object->addThumbs here because there is no $object known
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
$rel_dir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $upload_dir);
|
||||
|
||||
if (! preg_match('/[\\/]temp[\\/]/', $rel_dir)) // If not a tmp dir
|
||||
{
|
||||
$filename = basename($destfile);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($destfull));
|
||||
$ecmfile->fullpath_orig = $TFile['name'][$i];
|
||||
$ecmfile->gen_or_uploaded = 'uploaded';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setEventMessages($langs->trans("FileTransferComplete"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
@ -1145,7 +1343,7 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
|
||||
{
|
||||
$pathtodelete=$listofpaths[$keytodelete];
|
||||
$filetodelete=$listofnames[$keytodelete];
|
||||
if (empty($donotdeletefile)) $result = dol_delete_file($pathtodelete,1);
|
||||
if (empty($donotdeletefile)) $result = dol_delete_file($pathtodelete,1); // The delete of ecm database is inside the function dol_delete_file
|
||||
else $result=0;
|
||||
if ($result >= 0)
|
||||
{
|
||||
@ -1337,11 +1535,11 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
|
||||
* Security check when accessing to a document (used by document.php, viewimage.php and webservices)
|
||||
*
|
||||
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp')
|
||||
* @param string $original_file Relative path with filename
|
||||
* @param string $original_file Relative path with filename, relative to modulepart.
|
||||
* @param string $entity Restrict onto entity
|
||||
* @param User $fuser User object (forced)
|
||||
* @param string $refname Ref of object to check permission for external users (autodetect if not provided)
|
||||
* @return mixed Array with access information : accessallowed & sqlprotectagainstexternals & original_file (as full path name)
|
||||
* @return mixed Array with access information : 'accessallowed' & 'sqlprotectagainstexternals' & 'original_file' (as a full path name)
|
||||
*/
|
||||
function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='')
|
||||
{
|
||||
@ -1635,7 +1833,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")";
|
||||
}
|
||||
else if ($modulepart == 'project_task')
|
||||
{
|
||||
@ -1644,7 +1842,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->projet->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")";
|
||||
}
|
||||
// Wrapping for interventions
|
||||
else if ($modulepart == 'fichinter')
|
||||
@ -1759,6 +1957,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
|
||||
$accessallowed=1;
|
||||
}
|
||||
$original_file=$conf->contrat->dir_output.'/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract', 1).")";
|
||||
}
|
||||
|
||||
// Wrapping pour les dons
|
||||
|
||||
@ -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('/(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]; }
|
||||
|
||||
|
||||
if ($tablet) {
|
||||
$layout = 'tablet';
|
||||
} elseif ($phone) {
|
||||
@ -268,14 +268,14 @@ function GETPOST($paramname,$check='',$method=0,$filter=NULL,$options=NULL)
|
||||
{
|
||||
$tmp=dol_getdate(dol_now(), true);
|
||||
$out = $tmp['mon'];
|
||||
}
|
||||
}
|
||||
elseif ($reg[1] == 'YEAR')
|
||||
{
|
||||
$tmp=dol_getdate(dol_now(), true);
|
||||
$out = $tmp['year'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch ($check)
|
||||
{
|
||||
case 'int':
|
||||
@ -409,15 +409,15 @@ function dol_buildpath($path, $type=0)
|
||||
if ($type == 1) $res = DOL_URL_ROOT.'/'.$path; // Standard value
|
||||
if ($type == 2) $res = DOL_MAIN_URL_ROOT.'/'.$path; // Standard value
|
||||
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", ...)
|
||||
{
|
||||
if ($key == 'main')
|
||||
if ($key == 'main')
|
||||
{
|
||||
if ($type == 3)
|
||||
{
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
|
||||
// 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
|
||||
@ -444,12 +444,12 @@ function dol_buildpath($path, $type=0)
|
||||
if ($type == 3)
|
||||
{
|
||||
global $dolibarr_main_url_root;
|
||||
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
$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;
|
||||
@ -716,13 +716,13 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
||||
throw new Exception('Incorrect log level');
|
||||
}
|
||||
if ($level > $conf->global->SYSLOG_LEVEL) return;
|
||||
|
||||
|
||||
// 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
|
||||
{
|
||||
$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
|
||||
// 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"]))
|
||||
@ -731,7 +731,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename='
|
||||
print $message."\n";
|
||||
print "Log end -->\n";
|
||||
}
|
||||
|
||||
|
||||
$data = array(
|
||||
'message' => $message,
|
||||
'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),
|
||||
'ip' => false
|
||||
);
|
||||
|
||||
|
||||
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)
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
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 == 'user') $modulepart='userphoto';
|
||||
if ($object->element == 'product') $modulepart='product';
|
||||
|
||||
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
$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);
|
||||
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>';
|
||||
else
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
$nophoto='';
|
||||
@ -1003,14 +1003,14 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
$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>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
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);
|
||||
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
|
||||
{
|
||||
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">';
|
||||
if ($object->element == 'action')
|
||||
if ($object->element == 'action')
|
||||
{
|
||||
$cssclass='photorefcenter';
|
||||
$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 ($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');
|
||||
}
|
||||
}
|
||||
elseif ($object->element == 'product')
|
||||
{
|
||||
//$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')
|
||||
{
|
||||
$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;
|
||||
}
|
||||
elseif ($object->element == 'chargesociales')
|
||||
@ -1084,7 +1084,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
}
|
||||
else { // Generic case
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
$formatwithoutreduce = preg_replace('/reduceformat/','',$format);
|
||||
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.
|
||||
// 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);
|
||||
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);
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
@ -1912,7 +1912,7 @@ function dol_user_country()
|
||||
* @param int $mode thirdparty|contact|member|other
|
||||
* @param int $id Id of object
|
||||
* @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
|
||||
* @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);
|
||||
else $out.=preg_replace('/[\r\n]+/', $charfornl, $address);
|
||||
|
||||
|
||||
$showgmap=$showomap=0;
|
||||
|
||||
// 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>';
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return;
|
||||
$jsgraphlib='flot';
|
||||
$datacolor=array();
|
||||
@ -2230,7 +2230,7 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodo
|
||||
global $conf;
|
||||
|
||||
if ($size==0 || ! empty($conf->global->MAIN_DISABLE_TRUNC)) return $string;
|
||||
|
||||
|
||||
if (empty($stringencoding)) $stringencoding='UTF-8';
|
||||
// reduce for small screen
|
||||
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 load_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;
|
||||
|
||||
|
||||
$savlimit = $limit;
|
||||
$savtotalnboflines = $totalnboflines;
|
||||
$totalnboflines=abs($totalnboflines);
|
||||
|
||||
|
||||
if ($picto == 'setup') $picto='title_setup.png';
|
||||
if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif';
|
||||
if ($limit < 0) $limit = $conf->liste_limit;
|
||||
@ -3433,7 +3433,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee
|
||||
function vatrate($rate, $addpercent=false, $info_bits=0, $usestarfornpr=0)
|
||||
{
|
||||
$morelabel='';
|
||||
|
||||
|
||||
if (preg_match('/%/',$rate))
|
||||
{
|
||||
$rate=str_replace('%','',$rate);
|
||||
@ -3636,7 +3636,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
|
||||
|
||||
/**
|
||||
* Output a dimension with best unit
|
||||
*
|
||||
*
|
||||
* @param float $dimension Dimension
|
||||
* @param int $unit Unit of dimension (0, -3, ...)
|
||||
* @param string $type 'weight', 'volume', ...
|
||||
@ -3648,16 +3648,16 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
|
||||
function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no')
|
||||
{
|
||||
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;
|
||||
$unit = $unit - 6;
|
||||
$unit = $unit - 6;
|
||||
}
|
||||
elseif (($forceunitoutput == 'no' && $dimension < 1/10) || (is_numeric($forceunitoutput) && $forceunitoutput == -3))
|
||||
{
|
||||
$dimension = $dimension * 1000;
|
||||
$unit = $unit - 3;
|
||||
$unit = $unit - 3;
|
||||
}
|
||||
elseif (($forceunitoutput == 'no' && $dimension > 100000000) || (is_numeric($forceunitoutput) && $forceunitoutput == 6))
|
||||
{
|
||||
@ -3669,9 +3669,9 @@ function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=
|
||||
$dimension = $dimension / 1000;
|
||||
$unit = $unit + 3;
|
||||
}
|
||||
|
||||
|
||||
$ret=price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
|
||||
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@ -3702,12 +3702,12 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
$vatratecleaned = trim($reg[1]);
|
||||
$vatratecode = $reg[2];
|
||||
}
|
||||
|
||||
|
||||
/*if ($thirdparty_buyer->country_code != $thirdparty_seller->country_code)
|
||||
{
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
|
||||
// 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
|
||||
{
|
||||
@ -3805,7 +3805,7 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
|
||||
if ($local==1) return $obj->localtax1;
|
||||
elseif ($local==2) return $obj->localtax2;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3865,7 +3865,7 @@ function get_localtax_by_third($local)
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...)
|
||||
@ -3919,7 +3919,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$vatratecleaned = $reg[1];
|
||||
$vatratecode = $reg[2];
|
||||
}
|
||||
|
||||
|
||||
// Search local taxes
|
||||
$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";
|
||||
@ -3932,7 +3932,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
|
||||
$sql.= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
|
||||
if ($vatratecode) $sql.= " AND t.code ='".$vatratecode."'";
|
||||
}
|
||||
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -4339,7 +4339,7 @@ function yn($yesno, $case=1, $color=0)
|
||||
/**
|
||||
* 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')
|
||||
* 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 int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future)
|
||||
@ -4356,7 +4356,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
|
||||
$path = '';
|
||||
|
||||
$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))
|
||||
{
|
||||
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
|
||||
@ -4509,7 +4509,7 @@ function dolGetFirstLineOfText($text)
|
||||
{
|
||||
$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
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5415,7 +5415,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'].
|
||||
* Or by change using hook completeTabsHead
|
||||
*
|
||||
@ -5445,7 +5445,7 @@ function picto_from_langcode($codelang)
|
||||
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
|
||||
{
|
||||
global $hookmanager;
|
||||
|
||||
|
||||
if (isset($conf->modules_parts['tabs'][$type]) && is_array($conf->modules_parts['tabs'][$type]))
|
||||
{
|
||||
foreach ($conf->modules_parts['tabs'][$type] as $value)
|
||||
@ -5511,7 +5511,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
|
||||
if (! empty($hookmanager))
|
||||
{
|
||||
@ -5549,11 +5549,11 @@ function printCommonFooter($zone='private')
|
||||
{
|
||||
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 '<!-- If page_y set, we set scollbar with it -->'."\n";
|
||||
print "page_y=getParameterByName('page_y', 0);";
|
||||
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 'jQuery(".reposition").click(function() {
|
||||
var page_y = $(document).scrollTop();
|
||||
@ -5573,7 +5573,7 @@ function printCommonFooter($zone='private')
|
||||
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
|
||||
// Google Analytics (need Google module)
|
||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||
{
|
||||
@ -5717,7 +5717,7 @@ function dol_getmypid()
|
||||
* 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"
|
||||
* @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
|
||||
*/
|
||||
function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
@ -5732,6 +5732,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*\|\s*/','|', $value);
|
||||
|
||||
$crits = explode(' ', $value);
|
||||
$res = '';
|
||||
if (! is_array($fields)) $fields = array($fields);
|
||||
@ -5786,15 +5789,15 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||
$tmpcrit=trim($tmpcrit);
|
||||
$tmpcrit2=$tmpcrit;
|
||||
$tmpbefore='%'; $tmpafter='%';
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
if (preg_match('/^[\^\$]/', $tmpcrit))
|
||||
{
|
||||
$tmpbefore='';
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
$tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2);
|
||||
}
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
if (preg_match('/[\^\$]$/', $tmpcrit))
|
||||
{
|
||||
$tmpafter='';
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
$tmpcrit2 = preg_replace('/[\^\$]$/', '', $tmpcrit2);
|
||||
}
|
||||
$newres .= $tmpbefore;
|
||||
$newres .= $db->escape($tmpcrit2);
|
||||
@ -5859,7 +5862,7 @@ function getImageFileNameForSize($file, $extName, $extImgTarget='')
|
||||
function getAdvancedPreviewUrl($modulepart, $relativepath)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
if (empty($conf->use_javascript_ajax)) return '';
|
||||
|
||||
$mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css');
|
||||
|
||||
@ -37,8 +37,10 @@ $quality = 80;
|
||||
*/
|
||||
function image_format_supported($file)
|
||||
{
|
||||
$regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm'; // See also into product.class.php
|
||||
|
||||
// Case filename is not a format image
|
||||
if (! preg_match('/(\.gif|\.jpg|\.jpeg|\.png|\.bmp)$/i',$file,$reg)) return -1;
|
||||
if (! preg_match('/('.$regeximgext.')$/i',$file,$reg)) return -1;
|
||||
|
||||
// Case filename is a format image but not supported by this PHP
|
||||
$imgfonction='';
|
||||
@ -47,6 +49,8 @@ function image_format_supported($file)
|
||||
if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg';
|
||||
if (strtolower($reg[1]) == '.jpeg') $imgfonction = 'imagecreatefromjpeg';
|
||||
if (strtolower($reg[1]) == '.bmp') $imgfonction = 'imagecreatefromwbmp';
|
||||
if (strtolower($reg[1]) == '.xpm') $imgfonction = 'imagecreatefromxpm';
|
||||
if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm';
|
||||
if ($imgfonction)
|
||||
{
|
||||
if (! function_exists($imgfonction))
|
||||
|
||||
@ -26,9 +26,13 @@
|
||||
// Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
|
||||
$supportedoauth2array=array(
|
||||
'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
|
||||
$list = array (
|
||||
array(
|
||||
@ -264,7 +268,7 @@ function oauthadmin_prepare_head()
|
||||
$h++;
|
||||
|
||||
$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';
|
||||
$h++;
|
||||
|
||||
|
||||
@ -111,13 +111,13 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
|
||||
$chaine="";
|
||||
if (! empty($conf->product->enabled)) {
|
||||
$chaine.=$langs->trans("Products");
|
||||
$chaine.=$langs->trans("TMenuProducts");
|
||||
}
|
||||
if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) {
|
||||
$chaine.="/";
|
||||
$chaine.=" | ";
|
||||
}
|
||||
if (! empty($conf->service->enabled)) {
|
||||
$chaine.=$langs->trans("Services");
|
||||
$chaine.=$langs->trans("TMenuServices");
|
||||
}
|
||||
|
||||
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';
|
||||
|
||||
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&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_text_menu_entry($langs->trans("TMenuTools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||
if (empty($noout)) print_end_menu_entry($showmode);
|
||||
$menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ class modAgenda extends DolibarrModules
|
||||
// $r++;
|
||||
$this->menu[$r]=array('fk_menu'=>0,
|
||||
'type'=>'top',
|
||||
'titre'=>'Agenda',
|
||||
'titre'=>'TMenuAgenda',
|
||||
'mainmenu'=>'agenda',
|
||||
'url'=>'/comm/action/index.php',
|
||||
'langs'=>'agenda',
|
||||
|
||||
171
htdocs/core/modules/oauth/github_oauthcallback.php
Normal file
171
htdocs/core/modules/oauth/github_oauthcallback.php
Normal 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();
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/oauth/getoauthcallback.php
|
||||
* \file htdocs/core/modules/oauth/google_oauthcallback.php
|
||||
* \ingroup oauth
|
||||
* \brief Page to get oauth callback
|
||||
*/
|
||||
@ -83,7 +83,7 @@ if ($action != 'delete' && empty($requestedpermissionsarray))
|
||||
/** @var $apiService Service */
|
||||
$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');
|
||||
|
||||
$langs->load("oauth");
|
||||
@ -104,7 +104,7 @@ if ($action == 'delete')
|
||||
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"));
|
||||
|
||||
@ -121,6 +121,7 @@ if (! empty($_GET['code'])) // We are coming from Google oauth page
|
||||
//var_dump($_GET['code']);
|
||||
//var_dump($state);
|
||||
//var_dump($apiService); // OAuth\OAuth2\Service\Google
|
||||
|
||||
$token = $apiService->requestAccessToken($_GET['code'], $state);
|
||||
|
||||
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;
|
||||
|
||||
// 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')));
|
||||
@ -146,7 +149,8 @@ else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
$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);
|
||||
exit();
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ class printing_printgcp extends PrintingDriver
|
||||
$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
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
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_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) {
|
||||
$expiredat='';
|
||||
|
||||
$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_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)) {
|
||||
|
||||
@ -134,11 +134,50 @@ if ($action == 'confirm_resize' && (isset($_POST["file"]) != "") && (isset($_POS
|
||||
{
|
||||
$fullpath=$dir."/".$original_file;
|
||||
$result=dol_imageResizeOrCrop($fullpath,0,$_POST['sizex'],$_POST['sizey']);
|
||||
|
||||
|
||||
if ($result == $fullpath)
|
||||
{
|
||||
$object->addThumbs($fullpath);
|
||||
|
||||
// Update/create database for file $fullpath
|
||||
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $fullpath);
|
||||
$rel_filename = preg_replace('/^[\\/]/','',$rel_filename);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filename);
|
||||
if ($result > 0) // If found
|
||||
{
|
||||
$filename = basename($rel_filename);
|
||||
$rel_dir = dirname($rel_filename);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath));
|
||||
$result = $ecmfile->update($user);
|
||||
}
|
||||
elseif ($result == 0) // If not found
|
||||
{
|
||||
$filename = basename($rel_filename);
|
||||
$rel_dir = dirname($rel_filename);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->fullpath_orig = $fullpath;
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
$result = $ecmfile->create($user);
|
||||
}
|
||||
|
||||
if ($backtourl)
|
||||
{
|
||||
header("Location: ".$backtourl);
|
||||
@ -168,6 +207,45 @@ if ($action == 'confirm_crop')
|
||||
{
|
||||
$object->addThumbs($fullpath);
|
||||
|
||||
// Update/create database for file $fullpath
|
||||
$rel_filename = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $fullpath);
|
||||
$rel_filename = preg_replace('/^[\\/]/','',$rel_filename);
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
|
||||
$ecmfile=new EcmFiles($db);
|
||||
$result = $ecmfile->fetch(0, '', $rel_filename);
|
||||
if ($result > 0) // If found
|
||||
{
|
||||
$filename = basename($rel_filename);
|
||||
$rel_dir = dirname($rel_filename);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath));
|
||||
$result = $ecmfile->update($user);
|
||||
}
|
||||
elseif ($result == 0) // If not found
|
||||
{
|
||||
$filename = basename($rel_filename);
|
||||
$rel_dir = dirname($rel_filename);
|
||||
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
|
||||
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);
|
||||
|
||||
$ecmfile->filepath = $rel_dir;
|
||||
$ecmfile->filename = $filename;
|
||||
$ecmfile->label = md5_file(dol_osencode($fullpath)); // $fullpath is a full path to file
|
||||
$ecmfile->fullpath_orig = $fullpath;
|
||||
$ecmfile->gen_or_uploaded = 'unknown';
|
||||
$ecmfile->description = ''; // indexed content
|
||||
$ecmfile->keyword = ''; // keyword content
|
||||
$result = $ecmfile->create($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($ecmfile->error, $ecmfile->errors, 'warnings');
|
||||
}
|
||||
$result = $ecmfile->create($user);
|
||||
}
|
||||
|
||||
if ($backtourl)
|
||||
{
|
||||
header("Location: ".$backtourl);
|
||||
@ -218,10 +296,11 @@ print '<legend>'.$langs->trans("Resize").'</legend>';
|
||||
print $langs->trans("ResizeDesc").'<br>';
|
||||
print $langs->trans("NewLength").': <input class="flat" name="sizex" size="10" type="text" > px '.$langs->trans("or").' ';
|
||||
print $langs->trans("NewHeight").': <input class="flat" name="sizey" size="10" type="text" > px <br>';
|
||||
|
||||
print '<input type="hidden" name="file" value="'.dol_escape_htmltag(GETPOST('file')).'" />';
|
||||
print '<input type="hidden" name="action" value="confirm_resize" />';
|
||||
print '<input type="hidden" name="product" value="'.$id.'" />';
|
||||
print '<input type="hidden" name="modulepart" value="'.$modulepart.'" />';
|
||||
print '<input type="hidden" name="modulepart" value="'.dol_escape_htmltag($modulepart).'" />';
|
||||
print '<input type="hidden" name="id" value="'.$id.'" />';
|
||||
print '<br>';
|
||||
print '<input class="button" id="submitresize" name="sendit" value="'.dol_escape_htmltag($langs->trans("Resize")).'" type="submit" />';
|
||||
|
||||
@ -17,18 +17,19 @@
|
||||
*
|
||||
* Javascript code to activate drag and drop on lines
|
||||
* You can use this if you want to be abale to drag and drop rows of a table.
|
||||
* You must add id="tablelines" on table level tag and have count($object->lines) or count($taskarray) > 0
|
||||
* You must add id="tablelines" on table level tag and have ($nboflines or count($object->lines) or count($taskarray) > 0)
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP -->
|
||||
<!-- BEGIN PHP TEMPLATE AJAXROW.TPL.PHP - Script to enable drag and drop on tables -->
|
||||
<?php
|
||||
$id=$object->id;
|
||||
$fk_element=$object->fk_element;
|
||||
$table_element_line=$object->table_element_line;
|
||||
$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):0));
|
||||
$table_element_line=(empty($table_element_line)?$object->table_element_line:$table_element_line);
|
||||
$nboflines=(isset($object->lines)?count($object->lines):(isset($tasksarray)?count($tasksarray):(empty($nboflines)?0:$nboflines)));
|
||||
$forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
|
||||
$tagidfortablednd=(empty($tagidfortablednd)?'tablelines':$tagidfortablednd);
|
||||
$filepath=(empty($filepath)?'':$filepath);
|
||||
|
||||
if (GETPOST('action') != 'editline' && $nboflines > 1) { ?>
|
||||
<script type="text/javascript">
|
||||
@ -43,16 +44,19 @@ $(document).ready(function(){
|
||||
$("#<?php echo $tagidfortablednd; ?>").tableDnD({
|
||||
onDrop: function(table, row) {
|
||||
var reloadpage = "<?php echo $forcereloadpage; ?>";
|
||||
console.log($("#<?php echo $tagidfortablednd; ?>").tableDnDSerialize());
|
||||
var roworder = cleanSerialize($("#<?php echo $tagidfortablednd; ?>").tableDnDSerialize());
|
||||
var table_element_line = "<?php echo $table_element_line; ?>";
|
||||
var fk_element = "<?php echo $fk_element; ?>";
|
||||
var element_id = "<?php echo $id; ?>";
|
||||
var filepath = "<?php echo urlencode($filepath); ?>";
|
||||
$.post("<?php echo DOL_URL_ROOT; ?>/core/ajax/row.php",
|
||||
{
|
||||
roworder: roworder,
|
||||
table_element_line: table_element_line,
|
||||
fk_element: fk_element,
|
||||
element_id: element_id
|
||||
element_id: element_id,
|
||||
filepath: filepath
|
||||
},
|
||||
function() {
|
||||
if (reloadpage == 1) {
|
||||
|
||||
@ -72,6 +72,9 @@ $formfile->form_attach_new_file(
|
||||
$savingdocmask
|
||||
);
|
||||
|
||||
$disablemove=1;
|
||||
if ($modulepart == 'produit') $disablemove=0;
|
||||
|
||||
// List of document
|
||||
$formfile->list_of_documents(
|
||||
$filearray,
|
||||
@ -79,7 +82,7 @@ $formfile->list_of_documents(
|
||||
$modulepart,
|
||||
$param,
|
||||
0,
|
||||
$relativepathwithnofile, // relative path with no file. For example "moduledir/0/1"
|
||||
$relativepathwithnofile, // relative path with no file. For example "0/1"
|
||||
$permission,
|
||||
0,
|
||||
'',
|
||||
@ -87,7 +90,11 @@ $formfile->list_of_documents(
|
||||
'',
|
||||
'',
|
||||
0,
|
||||
$permtoedit
|
||||
$permtoedit,
|
||||
$upload_dir,
|
||||
$sortfield,
|
||||
$sortorder,
|
||||
$disablemove
|
||||
);
|
||||
|
||||
print "<br>";
|
||||
|
||||
@ -102,9 +102,9 @@ $(document).ready(function () {
|
||||
<!-- Password -->
|
||||
<tr>
|
||||
<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">
|
||||
<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>
|
||||
</td></tr>
|
||||
<?php
|
||||
|
||||
@ -109,7 +109,7 @@ if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
|
||||
$check_access = dol_check_secure_access_document($modulepart,$original_file,$entity,$refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$original_file = $check_access['original_file'];
|
||||
$original_file = $check_access['original_file']; // original_file is now a full path name
|
||||
|
||||
// Basic protection (against external users only)
|
||||
if ($user->societe_id > 0)
|
||||
|
||||
@ -23,8 +23,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class EcmDirectory
|
||||
* \brief Class to manage ECM directories
|
||||
* Class to manage ECM directories
|
||||
*/
|
||||
class EcmDirectory // extends CommonObject
|
||||
{
|
||||
|
||||
782
htdocs/ecm/class/ecmfiles.class.php
Normal file
782
htdocs/ecm/class/ecmfiles.class.php
Normal file
@ -0,0 +1,782 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2014-2016 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) ---Put here your own copyright and developer email---
|
||||
*
|
||||
* 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 ecm/ecmfiles.class.php
|
||||
* \ingroup ecm
|
||||
* \brief Class to manage ECM Files (Create/Read/Update/Delete)
|
||||
*/
|
||||
|
||||
// Put here all includes required by your class file
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
/**
|
||||
* Class to manage ECM files
|
||||
*/
|
||||
class EcmFiles //extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var string Id to identify managed objects
|
||||
*/
|
||||
public $element = 'ecmfiles';
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element = 'ecm_files';
|
||||
|
||||
/**
|
||||
*/
|
||||
public $label;
|
||||
public $entity;
|
||||
public $filename;
|
||||
public $filepath;
|
||||
public $fullpath_orig;
|
||||
public $description;
|
||||
public $keywords;
|
||||
public $cover;
|
||||
public $position;
|
||||
public $gen_or_uploaded; // can be 'generated', 'uploaded', 'unknown'
|
||||
public $extraparams;
|
||||
public $date_c = '';
|
||||
public $date_m = '';
|
||||
public $fk_user_c;
|
||||
public $fk_user_m;
|
||||
public $acl;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that creates
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->label)) {
|
||||
$this->label = trim($this->label);
|
||||
}
|
||||
if (isset($this->entity)) {
|
||||
$this->entity = trim($this->entity);
|
||||
}
|
||||
if (isset($this->filename)) {
|
||||
$this->filename = trim($this->filename);
|
||||
}
|
||||
if (isset($this->filepath)) {
|
||||
$this->filepath = trim($this->filepath);
|
||||
}
|
||||
if (isset($this->fullpath_orig)) {
|
||||
$this->fullpath_orig = trim($this->fullpath_orig);
|
||||
}
|
||||
if (isset($this->description)) {
|
||||
$this->description = trim($this->description);
|
||||
}
|
||||
if (isset($this->keywords)) {
|
||||
$this->keywords = trim($this->keywords);
|
||||
}
|
||||
if (isset($this->cover)) {
|
||||
$this->cover = trim($this->cover);
|
||||
}
|
||||
if (isset($this->gen_or_uploaded)) {
|
||||
$this->gen_or_uploaded = trim($this->gen_or_uploaded);
|
||||
}
|
||||
if (isset($this->extraparams)) {
|
||||
$this->extraparams = trim($this->extraparams);
|
||||
}
|
||||
if (isset($this->fk_user_c)) {
|
||||
$this->fk_user_c = trim($this->fk_user_c);
|
||||
}
|
||||
if (isset($this->fk_user_m)) {
|
||||
$this->fk_user_m = trim($this->fk_user_m);
|
||||
}
|
||||
if (isset($this->acl)) {
|
||||
$this->acl = trim($this->acl);
|
||||
}
|
||||
if (empty($this->date_c)) $this->date_c = dol_now();
|
||||
|
||||
$maxposition=0;
|
||||
if (empty($this->position)) // Get max used
|
||||
{
|
||||
$sql = "SELECT MAX(position) as maxposition FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql.= " WHERE filepath ='".$this->filepath."'";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$maxposition = (int) $obj->maxposition;
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
$maxposition=$maxposition+1;
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '(';
|
||||
$sql.= 'label,';
|
||||
$sql.= 'entity,';
|
||||
$sql.= 'filename,';
|
||||
$sql.= 'filepath,';
|
||||
$sql.= 'fullpath_orig,';
|
||||
$sql.= 'description,';
|
||||
$sql.= 'keywords,';
|
||||
$sql.= 'cover,';
|
||||
$sql.= 'position,';
|
||||
$sql.= 'gen_or_uploaded,';
|
||||
$sql.= 'extraparams,';
|
||||
$sql.= 'date_c,';
|
||||
$sql.= 'date_m,';
|
||||
$sql.= 'fk_user_c,';
|
||||
$sql.= 'fk_user_m,';
|
||||
$sql.= 'acl';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' '.(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").',';
|
||||
$sql .= ' '.(! isset($this->entity)?$conf->entity:$this->entity).',';
|
||||
$sql .= ' '.(! isset($this->filename)?'NULL':"'".$this->db->escape($this->filename)."'").',';
|
||||
$sql .= ' '.(! isset($this->filepath)?'NULL':"'".$this->db->escape($this->filepath)."'").',';
|
||||
$sql .= ' '.(! isset($this->fullpath_orig)?'NULL':"'".$this->db->escape($this->fullpath_orig)."'").',';
|
||||
$sql .= ' '.(! isset($this->description)?'NULL':"'".$this->db->escape($this->description)."'").',';
|
||||
$sql .= ' '.(! isset($this->keywords)?'NULL':"'".$this->db->escape($this->keywords)."'").',';
|
||||
$sql .= ' '.(! isset($this->cover)?'NULL':"'".$this->db->escape($this->cover)."'").',';
|
||||
$sql .= ' '.$maxposition.',';
|
||||
$sql .= ' '.(! isset($this->gen_or_uploaded)?'NULL':"'".$this->db->escape($this->gen_or_uploaded)."'").',';
|
||||
$sql .= ' '.(! isset($this->extraparams)?'NULL':"'".$this->db->escape($this->extraparams)."'").',';
|
||||
$sql .= ' '."'".$this->db->idate($this->date_c)."'".',';
|
||||
$sql .= ' '.(! isset($this->date_m) || dol_strlen($this->date_m)==0?'NULL':"'".$this->db->idate($this->date_m)."'").',';
|
||||
$sql .= ' '.(! isset($this->fk_user_c)?$user->id:$this->fk_user_c).',';
|
||||
$sql .= ' '.(! isset($this->fk_user_m)?'NULL':$this->fk_user_m).',';
|
||||
$sql .= ' '.(! isset($this->acl)?'NULL':"'".$this->db->escape($this->acl)."'");
|
||||
$sql .= ')';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element);
|
||||
$this->position = $maxposition;
|
||||
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action to call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_CREATE',$user);
|
||||
//if ($result < 0) $error++;
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $ref Not used yet. Will contains a hash id from filename+filepath
|
||||
* @param string $fullpath Full path of file (relative path to document directory)
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null, $fullpath = '')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.ref,";
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.filename,";
|
||||
$sql .= " t.filepath,";
|
||||
$sql .= " t.fullpath_orig,";
|
||||
$sql .= " t.description,";
|
||||
$sql .= " t.keywords,";
|
||||
$sql .= " t.cover,";
|
||||
$sql .= " t.position,";
|
||||
$sql .= " t.gen_or_uploaded,";
|
||||
$sql .= " t.extraparams,";
|
||||
$sql .= " t.date_c,";
|
||||
$sql .= " t.date_m,";
|
||||
$sql .= " t.fk_user_c,";
|
||||
$sql .= " t.fk_user_m,";
|
||||
$sql .= " t.acl";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
/* Fetching this table depends on filepath+filename, it must not depends on entity
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("ecmfiles", 1) . ")";
|
||||
}*/
|
||||
if ($fullpath) {
|
||||
$sql .= " AND t.filepath = '" . $this->db->escape(dirname($fullpath)) . "' AND t.filename = '".$this->db->escape(basename($fullpath))."'";
|
||||
}
|
||||
elseif (null !== $ref) {
|
||||
$sql .= " AND t.ref = '".$this->db->escape($ref)."'";
|
||||
} else {
|
||||
$sql .= ' AND t.rowid = ' . $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$numrows = $this->db->num_rows($resql);
|
||||
if ($numrows) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
$this->label = $obj->label;
|
||||
$this->entity = $obj->entity;
|
||||
$this->filename = $obj->filename;
|
||||
$this->filepath = $obj->filepath;
|
||||
$this->fullpath_orig = $obj->fullpath_orig;
|
||||
$this->description = $obj->description;
|
||||
$this->keywords = $obj->keywords;
|
||||
$this->cover = $obj->cover;
|
||||
$this->position = $obj->position;
|
||||
$this->gen_or_uploaded = $obj->gen_or_uploaded;
|
||||
$this->extraparams = $obj->extraparams;
|
||||
$this->date_c = $this->db->jdate($obj->date_c);
|
||||
$this->date_m = $this->db->jdate($obj->date_m);
|
||||
$this->fk_user_c = $obj->fk_user_c;
|
||||
$this->fk_user_m = $obj->fk_user_m;
|
||||
$this->acl = $obj->acl;
|
||||
}
|
||||
|
||||
// Retrieve all extrafields for invoice
|
||||
// fetch optionals attributes and labels
|
||||
/*
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
*/
|
||||
// $this->fetch_lines();
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
if ($numrows) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.label,";
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.filename,";
|
||||
$sql .= " t.filepath,";
|
||||
$sql .= " t.fullpath_orig,";
|
||||
$sql .= " t.description,";
|
||||
$sql .= " t.keywords,";
|
||||
$sql .= " t.cover,";
|
||||
$sql .= " t.position,";
|
||||
$sql .= " t.gen_or_uploaded,";
|
||||
$sql .= " t.extraparams,";
|
||||
$sql .= " t.date_c,";
|
||||
$sql .= " t.date_m,";
|
||||
$sql .= " t.fk_user_c,";
|
||||
$sql .= " t.fk_user_m,";
|
||||
$sql .= " t.acl";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
/* Fetching this table depends on filepath+filename, it must not depends on entity
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("ecmfiles", 1) . ")";
|
||||
}*/
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new EcmfilesLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
$line->label = $obj->label;
|
||||
$line->entity = $obj->entity;
|
||||
$line->filename = $obj->filename;
|
||||
$line->filepath = $obj->filepath;
|
||||
$line->fullpath_orig = $obj->fullpath_orig;
|
||||
$line->description = $obj->description;
|
||||
$line->keywords = $obj->keywords;
|
||||
$line->cover = $obj->cover;
|
||||
$line->position = $obj->position;
|
||||
$line->gen_or_uploaded = $obj->gen_or_uploaded;
|
||||
$line->extraparams = $obj->extraparams;
|
||||
$line->date_c = $this->db->jdate($obj->date_c);
|
||||
$line->date_m = $this->db->jdate($obj->date_m);
|
||||
$line->fk_user_c = $obj->fk_user_c;
|
||||
$line->fk_user_m = $obj->fk_user_m;
|
||||
$line->acl = $obj->acl;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modifies
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false)
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->label)) {
|
||||
$this->label = trim($this->label);
|
||||
}
|
||||
if (isset($this->entity)) {
|
||||
$this->entity = trim($this->entity);
|
||||
}
|
||||
if (isset($this->filename)) {
|
||||
$this->filename = trim($this->filename);
|
||||
}
|
||||
if (isset($this->filepath)) {
|
||||
$this->filepath = trim($this->filepath);
|
||||
}
|
||||
if (isset($this->fullpath_orig)) {
|
||||
$this->fullpath_orig = trim($this->fullpath_orig);
|
||||
}
|
||||
if (isset($this->description)) {
|
||||
$this->description = trim($this->description);
|
||||
}
|
||||
if (isset($this->keywords)) {
|
||||
$this->keywords = trim($this->keywords);
|
||||
}
|
||||
if (isset($this->cover)) {
|
||||
$this->cover = trim($this->cover);
|
||||
}
|
||||
if (isset($this->gen_or_uploaded)) {
|
||||
$this->gen_or_uploaded = trim($this->gen_or_uploaded);
|
||||
}
|
||||
if (isset($this->extraparams)) {
|
||||
$this->extraparams = trim($this->extraparams);
|
||||
}
|
||||
if (isset($this->fk_user_c)) {
|
||||
$this->fk_user_c = trim($this->fk_user_c);
|
||||
}
|
||||
if (isset($this->fk_user_m)) {
|
||||
$this->fk_user_m = trim($this->fk_user_m);
|
||||
}
|
||||
if (isset($this->acl)) {
|
||||
$this->acl = trim($this->acl);
|
||||
}
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add a control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
$sql .= ' label = '.(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").',';
|
||||
$sql .= ' entity = '.(isset($this->entity)?$this->entity:$conf->entity).',';
|
||||
$sql .= ' filename = '.(isset($this->filename)?"'".$this->db->escape($this->filename)."'":"null").',';
|
||||
$sql .= ' filepath = '.(isset($this->filepath)?"'".$this->db->escape($this->filepath)."'":"null").',';
|
||||
$sql .= ' fullpath_orig = '.(isset($this->fullpath_orig)?"'".$this->db->escape($this->fullpath_orig)."'":"null").',';
|
||||
$sql .= ' description = '.(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").',';
|
||||
$sql .= ' keywords = '.(isset($this->keywords)?"'".$this->db->escape($this->keywords)."'":"null").',';
|
||||
$sql .= ' cover = '.(isset($this->cover)?"'".$this->db->escape($this->cover)."'":"null").',';
|
||||
$sql .= ' position = '.(isset($this->position)?$this->db->escape($this->position):"0").',';
|
||||
$sql .= ' gen_or_uploaded = '.(isset($this->gen_or_uploaded)?"'".$this->db->escape($this->gen_or_uploaded)."'":"null").',';
|
||||
$sql .= ' extraparams = '.(isset($this->extraparams)?"'".$this->db->escape($this->extraparams)."'":"null").',';
|
||||
$sql .= ' date_c = '.(! isset($this->date_c) || dol_strlen($this->date_c) != 0 ? "'".$this->db->idate($this->date_c)."'" : 'null').',';
|
||||
//$sql .= ' date_m = '.(! isset($this->date_m) || dol_strlen($this->date_m) != 0 ? "'".$this->db->idate($this->date_m)."'" : 'null').','; // Field automatically updated
|
||||
$sql .= ' fk_user_c = '.(isset($this->fk_user_c)?$this->fk_user_c:"null").',';
|
||||
$sql .= ' fk_user_m = '.($this->fk_user_m > 0?$this->fk_user_m:$user->id).',';
|
||||
$sql .= ' acl = '.(isset($this->acl)?"'".$this->db->escape($this->acl)."'":"null");
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_MODIFY',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that deletes
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error) {
|
||||
if (!$notrigger) {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//$result=$this->call_trigger('MYOBJECT_DELETE',$user);
|
||||
//if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail}
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// If you need to delete child tables to, you can insert them here
|
||||
|
||||
if (!$error) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error) {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1 * $error;
|
||||
} else {
|
||||
$this->db->commit();
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
*
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone($fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
global $user;
|
||||
$error = 0;
|
||||
$object = new Ecmfiles($this->db);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Load source object
|
||||
$object->fetch($fromid);
|
||||
// Reset object
|
||||
$object->id = 0;
|
||||
|
||||
// Clear fields
|
||||
// ...
|
||||
|
||||
// Create clone
|
||||
$result = $object->create($user);
|
||||
|
||||
// Other options
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$this->errors = $object->errors;
|
||||
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
|
||||
// End
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
|
||||
return $object->id;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
|
||||
* @param string $option On what the link point to
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param int $maxlen Max length of visible user name
|
||||
* @param string $morecss Add more css on link
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='')
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||
$label.= '<br>';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
|
||||
$url = DOL_URL_ROOT.'/ecm/'.$this->table_name.'_card.php?id='.$this->id;
|
||||
|
||||
$linkclose='';
|
||||
if (empty($notooltip))
|
||||
{
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
|
||||
{
|
||||
$label=$langs->trans("ShowProject");
|
||||
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
|
||||
}
|
||||
$linkclose.=' title="'.dol_escape_htmltag($label, 1).'"';
|
||||
$linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"';
|
||||
}
|
||||
else $linkclose = ($morecss?' class="'.$morecss.'"':'');
|
||||
|
||||
$linkstart = '<a href="'.$url.'"';
|
||||
$linkstart.=$linkclose.'>';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto)
|
||||
{
|
||||
$result.=($linkstart.img_object(($notooltip?'':$label), 'label', ($notooltip?'':'class="classfortooltip"')).$linkend);
|
||||
if ($withpicto != 2) $result.=' ';
|
||||
}
|
||||
$result.= $linkstart . $this->ref . $linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne le libelle du status d'un user (actif, inactif)
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode=0)
|
||||
{
|
||||
return $this->LibStatut($this->status,$mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
$prefix='';
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 1)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled');
|
||||
if ($status == 0) return $langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
|
||||
if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
|
||||
}
|
||||
if ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise object with example values
|
||||
* Id must be 0 if object instance is a specimen
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
$this->id = 0;
|
||||
|
||||
$this->label = '0a1b2c3e4f59999999';
|
||||
$this->entity = '1';
|
||||
$this->filename = 'myspecimenfilefile.pdf';
|
||||
$this->filepath = '/aaa/bbb';
|
||||
$this->fullpath_orig = 'c:/file on my disk.pdf';
|
||||
$this->description = 'This is a long description of file';
|
||||
$this->keywords = 'key1,key2';
|
||||
$this->cover = '1';
|
||||
$this->position = '5';
|
||||
$this->gen_or_uploaded = 'uploaded';
|
||||
$this->extraparams = '';
|
||||
$this->date_c = (dol_now() - 3600 * 24 * 10);
|
||||
$this->date_m = '';
|
||||
$this->fk_user_c = $user->id;
|
||||
$this->fk_user_m = '';
|
||||
$this->acl = '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','5.0.0-rc1'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-alpha');
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@ -596,7 +596,7 @@ class CommandeFournisseurDispatch extends CommonObject
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
|
||||
@ -34,20 +34,20 @@ class Establishment extends CommonObject
|
||||
public $fk_element = 'fk_establishment';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $id;
|
||||
var $rowid;
|
||||
public $id;
|
||||
public $rowid;
|
||||
|
||||
var $name;
|
||||
var $address;
|
||||
var $zip;
|
||||
var $town;
|
||||
var $status; // 0=open, 1=closed
|
||||
var $entity;
|
||||
public $name;
|
||||
public $address;
|
||||
public $zip;
|
||||
public $town;
|
||||
public $status; // 0=open, 1=closed
|
||||
public $entity;
|
||||
|
||||
var $country_id;
|
||||
public $country_id;
|
||||
|
||||
var $statuts=array();
|
||||
var $statuts_short=array();
|
||||
public $statuts=array();
|
||||
public $statuts_short=array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -97,7 +97,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
$this->tokens = array();
|
||||
}
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -113,7 +113,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
} else {
|
||||
// save
|
||||
$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);
|
||||
}
|
||||
//print $sql;
|
||||
@ -130,7 +130,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
// get from db
|
||||
dol_syslog("hasAccessToken service=".$service);
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -159,7 +159,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
// unset($tokens[$service]);
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token";
|
||||
$sql.= " WHERE service='".$service."'";
|
||||
$sql.= " WHERE service='".$this->db->escape($service)."'";
|
||||
$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;
|
||||
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -223,7 +223,7 @@ class DoliStorage implements TokenStorageInterface
|
||||
} else {
|
||||
// save
|
||||
$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);
|
||||
}
|
||||
|
||||
@ -236,9 +236,10 @@ class DoliStorage implements TokenStorageInterface
|
||||
*/
|
||||
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.= " WHERE service='".$service."'";
|
||||
$sql.= " WHERE service='".$this->db->escape($service)."'";
|
||||
$resql = $this->db->query($sql);
|
||||
$result = $this->db->fetch_array($resql);
|
||||
$states[$service] = $result[state];
|
||||
|
||||
@ -411,7 +411,8 @@ else
|
||||
array('from'=>'3.7.0', 'to'=>'3.8.0'),
|
||||
array('from'=>'3.8.0', 'to'=>'3.9.0'),
|
||||
array('from'=>'3.9.0', 'to'=>'4.0.0'),
|
||||
array('from'=>'4.0.0', 'to'=>'5.0.0')
|
||||
array('from'=>'4.0.0', 'to'=>'5.0.0'),
|
||||
array('from'=>'5.0.0', 'to'=>'6.0.0')
|
||||
);
|
||||
|
||||
$count=0;
|
||||
|
||||
@ -343,8 +343,8 @@ ul {
|
||||
|
||||
|
||||
.button {
|
||||
background: #eee;
|
||||
/*border: 1px solid #C0C0C0;*/
|
||||
background: #fcfcfc;
|
||||
border: 1px solid #d0d0d0;
|
||||
padding: 0.3em 0.7em;
|
||||
margin: 0 0.5em;
|
||||
-moz-border-radius:0 5px 0 5px;
|
||||
|
||||
@ -77,6 +77,9 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_CLASSIFY_UNBILLED','Intervention set unbilled','Executed when a intervention is set to unbilled (when option FICHINTER_CLASSIFY_BILLED is set)','ficheinter',19);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_REOPEN','Intervention opened','Executed when a intervention is re-opened','ficheinter',19);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('FICHINTER_SENTBYMAIL','Intervention sent by mail','Executed when a intervention is sent by mail','ficheinter',19);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','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);
|
||||
-- actions not enabled by default (no constant created for that) when we enable module agenda
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_CREATE','Project creation','Executed when a project is created','project',140);
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PROJECT_MODIFY','Project modified','Executed when a project is modified','project',141);
|
||||
|
||||
48
htdocs/install/mysql/migration/5.0.0-6.0.0.sql
Normal file
48
htdocs/install/mysql/migration/5.0.0-6.0.0.sql
Normal file
@ -0,0 +1,48 @@
|
||||
--
|
||||
-- Be carefull to requests order.
|
||||
-- This file must be loaded by calling /install/index.php page
|
||||
-- when current version is 5.0.0 or higher.
|
||||
--
|
||||
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
|
||||
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
|
||||
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
|
||||
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
|
||||
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
|
||||
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
|
||||
-- To drop an index: -- VMYSQL4.0 DROP INDEX nomindex on llx_table
|
||||
-- To drop an index: -- VPGSQL8.0 DROP INDEX nomindex
|
||||
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
|
||||
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
|
||||
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_c_shipment_mode CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
-- To make pk to be auto increment (postgres): -- VPGSQL8.2 NOT POSSIBLE. MUST DELETE/CREATE TABLE
|
||||
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
|
||||
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
|
||||
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
|
||||
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
|
||||
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
|
||||
-- Note: fields with type BLOB/TEXT can't have default value.
|
||||
-- -- VPGSQL8.2 DELETE FROM llx_usergroup_user WHERE fk_user NOT IN (SELECT rowid from llx_user);
|
||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN ref varchar(128) AFTER rowid;
|
||||
ALTER TABLE llx_ecm_files CHANGE COLUMN fullpath filepath varchar(255);
|
||||
ALTER TABLE llx_ecm_files CHANGE COLUMN filepath filepath varchar(255);
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN position integer;
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN keyword varchar(750);
|
||||
ALTER TABLE llx_ecm_files CHANGE COLUMN keyword keyword varchar(750);
|
||||
ALTER TABLE llx_ecm_files ADD COLUMN gen_or_uploaded varchar(12);
|
||||
|
||||
ALTER TABLE llx_ecm_files DROP INDEX uk_ecm_files;
|
||||
ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename, entity);
|
||||
|
||||
ALTER TABLE llx_ecm_files ADD INDEX idx_ecm_files_label (label);
|
||||
|
||||
|
||||
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','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);
|
||||
|
||||
|
||||
ALTER TABLE llx_loan ADD COLUMN fk_projet integer DEFAULT NULL;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
@ -17,5 +17,9 @@
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (label, entity);
|
||||
ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files (filepath, filename);
|
||||
ALTER TABLE llx_ecm_files ADD INDEX idx_ecm_files_label (label);
|
||||
|
||||
--ALTER TABLE llx_ecm_files ADD UNIQUE INDEX uk_ecm_files_fullpath(fullpath); Disabled, mysql limits size of index
|
||||
|
||||
|
||||
|
||||
@ -19,14 +19,16 @@
|
||||
CREATE TABLE llx_ecm_files
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
label varchar(64) NOT NULL,
|
||||
ref varchar(128), -- Not used yet. Will contains a hash id from filename+filepath
|
||||
label varchar(64) NOT NULL, -- label contains a md5
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
filepath varchar(255) NOT NULL, -- relative to dolibarr document dir. Example module/def
|
||||
filename varchar(255) NOT NULL, -- file name only without any directory
|
||||
fullpath varchar(750) NOT NULL, -- relative to dolibarr document dir. example abc/def/myfile
|
||||
fullpath_orig varchar(750), -- full path of original filename, when file is uploaded from a local computer
|
||||
description text,
|
||||
keywords text, -- list of keywords, separated with comma
|
||||
keywords varchar(750), -- list of keywords, separated with comma. Must be limited to most important keywords.
|
||||
cover text, -- is this file a file to use for a cover
|
||||
position integer, -- position of file among others
|
||||
gen_or_uploaded varchar(12), -- 'generated' or 'uploaded'
|
||||
extraparams varchar(255), -- for stocking other parameters with json format
|
||||
date_c datetime,
|
||||
|
||||
@ -45,7 +45,9 @@ create table llx_loan
|
||||
accountancy_account_insurance varchar(32),
|
||||
accountancy_account_interest varchar(32),
|
||||
|
||||
fk_projet 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
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -28,6 +28,5 @@ CREATE TABLE llx_website_page
|
||||
content mediumtext, -- text is not enough in size
|
||||
status integer,
|
||||
date_creation datetime,
|
||||
date_modification datetime,
|
||||
tms timestamp
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -251,10 +251,34 @@ if ($ok)
|
||||
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." -> ";
|
||||
$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(
|
||||
'type'=>$type,
|
||||
'value'=>$value,
|
||||
'type'=>$typedb,
|
||||
'value'=>$lengthdb,
|
||||
'attribute'=>$attribute,
|
||||
'default'=>$default,
|
||||
'extra'=>$extra,
|
||||
|
||||
@ -279,7 +279,7 @@ ModuleFamilyInterface=Interfaces with external systems
|
||||
MenuHandlers=Menu handlers
|
||||
MenuAdmin=Menu editor
|
||||
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:
|
||||
StepNb=Step %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.
|
||||
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.
|
||||
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.
|
||||
LimitsSetup=Limits/Precision setup
|
||||
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:
|
||||
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.
|
||||
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
|
||||
HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight)
|
||||
TextTitleColor=Color of page title
|
||||
@ -1618,8 +1618,8 @@ ByDefaultInList=Show by default on list view
|
||||
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)
|
||||
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.
|
||||
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.
|
||||
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 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.
|
||||
ModelModulesProduct=Templates for product documents
|
||||
ToGenerateCodeDefineAutomaticRuleFirst=To be able to generate automatically codes, you must first define a manager to auto define barcode number.
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
IdAgenda=ID event
|
||||
Actions=Events
|
||||
Agenda=Agenda
|
||||
TMenuAgenda=Agenda
|
||||
Agendas=Agendas
|
||||
LocalAgenda=Internal calendar
|
||||
ActionsOwnedBy=Event owned by
|
||||
|
||||
@ -43,6 +43,7 @@ LoanCalcDesc=This <b>mortgage calculator</b> can be used to figure out monthly p
|
||||
GoToInterest=%s will go towards INTEREST
|
||||
GoToPrincipal=%s will go towards PRINCIPAL
|
||||
YouWillSpend=You will spend %s in year %s
|
||||
ListLoanAssociatedProject=List of loan associated with the project
|
||||
# Admin
|
||||
ConfigLoan=Configuration of the module loan
|
||||
LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default
|
||||
|
||||
@ -788,8 +788,8 @@ SetRef=Set ref
|
||||
Select2ResultFoundUseArrows=Some results found. Use arrows to select.
|
||||
Select2NotFound=No result found
|
||||
Select2Enter=Enter
|
||||
Select2MoreCharacter=or more character
|
||||
Select2MoreCharacters=or more characters
|
||||
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<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...
|
||||
Select2SearchInProgress=Search in progress...
|
||||
SearchIntoThirdparties=Thirdparties
|
||||
|
||||
@ -2,15 +2,20 @@
|
||||
ConfigOAuth=Oauth Configuration
|
||||
OAuthServices=OAuth services
|
||||
ManualTokenGeneration=Manual token generation
|
||||
TokenManager=Token manager
|
||||
IsTokenGenerated=Is token generated ?
|
||||
NoAccessToken=No access token saved into local database
|
||||
HasAccessToken=A token was generated and saved into local database
|
||||
NewTokenStored=Token received ans saved
|
||||
ToCheckDeleteTokenOnProvider=To check/delete authorization saved by %s OAuth provider
|
||||
NewTokenStored=Token received and saved
|
||||
ToCheckDeleteTokenOnProvider=Click here to check/delete authorization saved by %s OAuth provider
|
||||
TokenDeleted=Token deleted
|
||||
RequestAccess=Click here to request/renew access and receive a new token to save
|
||||
DeleteAccess=Click here to delete token
|
||||
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.
|
||||
OAuthSetupForLogin=Page to generate an OAuth token
|
||||
SeePreviousTab=See previous tab
|
||||
OAuthIDSecret=OAuth ID and Secret
|
||||
TOKEN_REFRESH=Token Refresh Present
|
||||
TOKEN_EXPIRED=Token expired
|
||||
TOKEN_EXPIRE_AT=Token expire at
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
SecurityCode=Security code
|
||||
NumberingShort=N°
|
||||
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.
|
||||
Birthday=Birthday
|
||||
BirthdayDate=Birthday date
|
||||
|
||||
@ -46,6 +46,6 @@ IPP_Media=Printer media
|
||||
IPP_Supported=Type of media
|
||||
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.
|
||||
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.
|
||||
PrintTestDescprintgcp=List of Printers for Google Cloud Print.
|
||||
|
||||
@ -5,6 +5,8 @@ ProductLabelTranslated=Translated product label
|
||||
ProductDescriptionTranslated=Translated product description
|
||||
ProductNoteTranslated=Translated product note
|
||||
ProductServiceCard=Products/Services card
|
||||
TMenuProducts=Products
|
||||
TMenuServices=Services
|
||||
Products=Products
|
||||
Services=Services
|
||||
Product=Product
|
||||
|
||||
@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.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.'/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("bills");
|
||||
@ -45,148 +47,167 @@ $result = restrictedArea($user, 'loan', $id, '','');
|
||||
|
||||
$object = new Loan($db);
|
||||
|
||||
$hookmanager->initHooks(array('loancard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
if ($result > 0)
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $confirm == 'yes')
|
||||
{
|
||||
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');
|
||||
|
||||
$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);
|
||||
|
||||
$object->fetch($id);
|
||||
$result = $object->set_paid($user);
|
||||
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);
|
||||
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);
|
||||
exit;
|
||||
$object->fetch($id);
|
||||
$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
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formproject = new FormProjets($db);
|
||||
if (! empty($conf->accounting->enabled)) $formaccountancy = New FormVentilation($db);
|
||||
|
||||
$title = $langs->trans("Loan") . ' - ' . $langs->trans("Card");
|
||||
@ -250,6 +271,21 @@ if ($action == 'create')
|
||||
// Rate
|
||||
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
|
||||
print '<tr>';
|
||||
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');
|
||||
|
||||
// Loan card
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref loan
|
||||
$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.='</div>';
|
||||
|
||||
$linkback = '<a href="' . DOL_URL_ROOT . '/loan/index.php">' . $langs->trans("BackToList") . '</a>';
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&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
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
@ -468,6 +538,7 @@ if ($id > 0)
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Status
|
||||
// print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4, $totalpaye).'</td></tr>';
|
||||
|
||||
@ -572,33 +643,37 @@ if ($id > 0)
|
||||
*/
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</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)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create">'.$langs->trans("DoPayment").'</a>';
|
||||
}
|
||||
|
||||
// Classify 'paid'
|
||||
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.'&action=paid">'.$langs->trans("ClassifyPaid").'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->loan->delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Edit
|
||||
if ($user->rights->loan->write)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</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)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/loan/payment/payment.php?id='.$object->id.'&action=create">'.$langs->trans("DoPayment").'</a>';
|
||||
}
|
||||
|
||||
// Classify 'paid'
|
||||
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.'&action=paid">'.$langs->trans("ClassifyPaid").'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->loan->delete)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.DOL_URL_ROOT.'/loan/card.php?id='.$object->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -24,14 +24,15 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/** \class Loan
|
||||
* \brief Class to manage loan
|
||||
/**
|
||||
* Loan
|
||||
*/
|
||||
class Loan extends CommonObject
|
||||
{
|
||||
public $element='loan';
|
||||
public $table='loan';
|
||||
public $table_element='loan';
|
||||
|
||||
public $picto = 'bill';
|
||||
|
||||
public $rowid;
|
||||
@ -51,6 +52,7 @@ class Loan extends CommonObject
|
||||
public $fk_bank;
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
public $fk_project;
|
||||
|
||||
|
||||
/**
|
||||
@ -73,7 +75,7 @@ class Loan extends CommonObject
|
||||
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.= " 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.= " WHERE l.rowid = ".$id;
|
||||
|
||||
@ -100,6 +102,7 @@ class Loan extends CommonObject
|
||||
$this->account_capital = $obj->accountancy_account_capital;
|
||||
$this->account_insurance = $obj->accountancy_account_insurance;
|
||||
$this->account_interest = $obj->accountancy_account_interest;
|
||||
$this->fk_project = $obj->fk_project;
|
||||
|
||||
$this->db->free($resql);
|
||||
return 1;
|
||||
@ -127,7 +130,7 @@ class Loan extends CommonObject
|
||||
function create($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
$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_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_project)) $this->fk_project=trim($this->fk_project);
|
||||
|
||||
// Check parameters
|
||||
if (! $newcapital > 0 || empty($this->datestart) || empty($this->dateend))
|
||||
@ -157,9 +161,9 @@ class Loan extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$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.= " ,datec, fk_user_author)";
|
||||
$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.= " datec, fk_projet, fk_user_author)";
|
||||
$sql.= " VALUES ('".$this->db->escape($this->label)."',";
|
||||
$sql.= " '".$this->db->escape($this->fk_bank)."',";
|
||||
$sql.= " '".price2num($newcapital)."',";
|
||||
@ -174,6 +178,7 @@ class Loan extends CommonObject
|
||||
$sql.= " '".$this->db->escape($this->account_interest)."',";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
$sql.= " '".$this->db->idate($now)."',";
|
||||
$sql.= " ".(empty($this->fk_project)?'NULL':$this->fk_project).",";
|
||||
$sql.= " ".$user->id;
|
||||
$sql.= ")";
|
||||
|
||||
@ -282,6 +287,7 @@ class Loan extends CommonObject
|
||||
$sql.= " capital='".price2num($this->db->escape($this->capital))."',";
|
||||
$sql.= " datestart='".$this->db->idate($this->datestart)."',";
|
||||
$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.= " WHERE rowid=".$this->id;
|
||||
|
||||
@ -345,7 +351,7 @@ class Loan extends CommonObject
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
$langs->load('bills');
|
||||
|
||||
|
||||
if ($mode == 0)
|
||||
{
|
||||
if ($statut == 0) return $langs->trans("Unpaid");
|
||||
@ -398,7 +404,7 @@ class Loan extends CommonObject
|
||||
* @param int $maxlen Label max length
|
||||
* @return string Chaine with URL
|
||||
*/
|
||||
function getLinkUrl($withpicto=0,$maxlen=0)
|
||||
function getNomUrl($withpicto=0,$maxlen=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ if ($resql)
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Ref
|
||||
print '<td>'.$loan_static->getLinkUrl(1, 42).'</td>';
|
||||
print '<td>'.$loan_static->getNomUrl(1, 42).'</td>';
|
||||
|
||||
// Label
|
||||
print '<td>'.dol_trunc($obj->label,42).'</td>';
|
||||
|
||||
@ -231,7 +231,7 @@ if ($resql)
|
||||
// Ref
|
||||
print '<td>';
|
||||
$loan->fetch($objp->id);
|
||||
print $loan->getLinkUrl(1);
|
||||
print $loan->getNomUrl(1);
|
||||
print "</td>\n";
|
||||
// Label
|
||||
print '<td>'.$objp->label.'</td>';
|
||||
|
||||
@ -161,9 +161,19 @@ if ($mode == 'setup' && $user->admin)
|
||||
break;
|
||||
case "info": // Google Api setup or Google OAuth Token
|
||||
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>';
|
||||
//var_dump($key);
|
||||
if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS')
|
||||
{
|
||||
// Delete remote tokens
|
||||
@ -187,7 +197,8 @@ if ($mode == 'setup' && $user->admin)
|
||||
// Token
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("Token").'</td>';
|
||||
print '<td>';
|
||||
print '<td colspan="2">';
|
||||
$tokenobj=null;
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try
|
||||
@ -210,8 +221,6 @@ if ($mode == 'setup' && $user->admin)
|
||||
print '</textarea>';*/
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class Product extends CommonObject
|
||||
*/
|
||||
protected $table_ref_field = 'ref';
|
||||
|
||||
var $regeximgext='\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff';
|
||||
var $regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm'; // See also into images.lib.php
|
||||
|
||||
/*
|
||||
* @deprecated
|
||||
@ -3691,15 +3691,16 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche la premiere photo du produit
|
||||
* Return if at least one photo is available
|
||||
*
|
||||
* @param string $sdir Repertoire a scanner
|
||||
* @return boolean true si photo dispo, false sinon
|
||||
* @param string $sdir Directory to scan
|
||||
* @return boolean True if at least one photo is available, False if not
|
||||
*/
|
||||
function is_photo_available($sdir)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
|
||||
global $conf;
|
||||
|
||||
$dir = $sdir;
|
||||
@ -3717,7 +3718,7 @@ class Product extends CommonObject
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in UTF8 in memory
|
||||
if (dol_is_file($dir.$file)) return true;
|
||||
if (dol_is_file($dir.$file) && image_format_supported($file) > 0) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3729,7 +3730,7 @@ class Product extends CommonObject
|
||||
* Show photos of a product (nbmax maximum), into several columns
|
||||
* TODO Move this into html.formproduct.class.php
|
||||
*
|
||||
* @param string $sdir Directory to scan
|
||||
* @param string $sdir Directory to scan (full absolute path)
|
||||
* @param int $size 0=original size, 1='small' use thumbnail if possible
|
||||
* @param int $nbmax Nombre maximum de photos (0=pas de max)
|
||||
* @param int $nbbyrow Number of image per line or -1 to use div. Used only if size=1.
|
||||
@ -3747,140 +3748,186 @@ class Product extends CommonObject
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
|
||||
$sortfield='position_name';
|
||||
$sortorder='asc';
|
||||
|
||||
$dir = $sdir . '/';
|
||||
$pdir = '/';
|
||||
$dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
$pdir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$dir .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
$pdir .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
}
|
||||
else
|
||||
{
|
||||
$dir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
$pdir .= get_exdir(0,0,0,0,$this,'product').$this->ref.'/';
|
||||
$dirold .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
$pdirold .= get_exdir($this->id,2,0,0,$this,'product') . $this->id ."/photos/";
|
||||
}
|
||||
|
||||
// Defined relative dir to DOL_DATA_ROOT
|
||||
$relativedir = '';
|
||||
if ($dir)
|
||||
{
|
||||
$relativedir = preg_replace('/^'.preg_quote(DOL_DATA_ROOT,'/').'/', '', $dir);
|
||||
$relativedir = preg_replace('/^[\\/]/','',$relativedir);
|
||||
$relativedir = preg_replace('/[\\/]$/','',$relativedir);
|
||||
}
|
||||
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
$pdirthumb = $pdir.'thumbs/';
|
||||
|
||||
$return ='<!-- Photo -->'."\n";
|
||||
$nbphoto=0;
|
||||
|
||||
$dir_osencoded=dol_osencode($dir);
|
||||
if (file_exists($dir_osencoded))
|
||||
$filearray=dol_dir_list($dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) // For backward compatiblity, we scan also old dirs
|
||||
{
|
||||
$handle=opendir($dir_osencoded);
|
||||
if (is_resource($handle))
|
||||
$filearrayold=dol_dir_list($dirold,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
$filearray=array_merge($filearray, $filearrayold);
|
||||
}
|
||||
|
||||
$filearrayindatabase = dol_dir_list_in_database($relativedir, '', null, 'name', SORT_ASC);
|
||||
|
||||
//var_dump($filearray);
|
||||
//var_dump($filearrayindatabase);
|
||||
|
||||
// Complete filearray with properties found into $filearrayindatabase
|
||||
foreach($filearray as $key => $val)
|
||||
{
|
||||
$found=0;
|
||||
// Search if it exists into $filearrayindatabase
|
||||
foreach($filearrayindatabase as $key2 => $val2)
|
||||
{
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
$photo='';
|
||||
if ($filearrayindatabase[$key2]['name'] == $filearray[$key]['name'])
|
||||
{
|
||||
$filearray[$key]['position_name']=($filearrayindatabase[$key2]['position']?$filearrayindatabase[$key2]['position']:'0').'_'.$filearrayindatabase[$key2]['name'];
|
||||
$filearray[$key]['position']=$filearrayindatabase[$key2]['position'];
|
||||
$filearray[$key]['cover']=$filearrayindatabase[$key2]['cover'];
|
||||
$filearray[$key]['acl']=$filearrayindatabase[$key2]['acl'];
|
||||
$filearray[$key]['rowid']=$filearrayindatabase[$key2]['rowid'];
|
||||
$filearray[$key]['label']=$filearrayindatabase[$key2]['label'];
|
||||
$found=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($filearray))
|
||||
{
|
||||
if ($sortfield && $sortorder)
|
||||
{
|
||||
$filearray=dol_sort_array($filearray, $sortfield, $sortorder);
|
||||
}
|
||||
|
||||
foreach($filearray as $key => $val)
|
||||
{
|
||||
$photo='';
|
||||
$file = $val['name'];
|
||||
|
||||
//if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
|
||||
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
||||
//if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
if (image_format_supported($file) >= 0)
|
||||
{
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
$viewfilename = $file;
|
||||
|
||||
if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file))
|
||||
{
|
||||
$nbphoto++;
|
||||
$photo = $file;
|
||||
$viewfilename = $file;
|
||||
if ($size == 1 || $size == 'small') { // Format vignette
|
||||
|
||||
if ($size == 1 || $size == 'small') { // Format vignette
|
||||
// Find name of thumb file
|
||||
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
|
||||
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
||||
|
||||
// Get filesize of original file
|
||||
$imgarray=dol_getImageSize($dir.$photo);
|
||||
|
||||
// Find name of thumb file
|
||||
$photo_vignette=basename(getImageFileNameForSize($dir.$file, '_small'));
|
||||
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
||||
|
||||
// Get filesize of original file
|
||||
$imgarray=dol_getImageSize($dir.$photo);
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
if ($nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
if ($nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
if ($nbphoto % $nbbyrow == 1) $return.= '<tr align=center valign=middle border=1>';
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
||||
|
||||
if ($nbphoto % $nbbyrow == 1) $return.= '<tr align=center valign=middle border=1>';
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return .= '<div class="inline-block">';
|
||||
$return.= "\n";
|
||||
|
||||
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||
if (empty($nolink))
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl('product', $relativefile);
|
||||
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||
}
|
||||
|
||||
$return.= "\n";
|
||||
|
||||
$relativefile=preg_replace('/^\//', '', $pdir.$photo);
|
||||
if (empty($nolink))
|
||||
{
|
||||
$urladvanced=getAdvancedPreviewUrl('product', $relativefile);
|
||||
if ($urladvanced) $return.='<a href="'.$urladvanced.'">';
|
||||
else $return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" class="aphoto" target="_blank">';
|
||||
}
|
||||
// Show image (width height=$maxHeight)
|
||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
||||
$alt=$langs->transnoentitiesnoconv('File').': '.$relativefile;
|
||||
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
|
||||
// Show image (width height=$maxHeight)
|
||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
||||
$alt=$langs->transnoentitiesnoconv('File').': '.$relativefile;
|
||||
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||
|
||||
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight)
|
||||
{
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo photowithmargin" border="0" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
if (empty($nolink)) $return.= '</a>';
|
||||
$return.="\n";
|
||||
|
||||
if (empty($nolink)) $return.= '</a>';
|
||||
$return.="\n";
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
$return.= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && (image_format_supported($photo) > 0) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight))
|
||||
{
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
$return.= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && preg_match('/('.$this->regeximgext.')$/i', $photo) && ($this->imgWidth > $maxWidth || $this->imgHeight > $maxHeight))
|
||||
{
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
$return.= "\n";
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
$return.= "\n";
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
$return.= '</td>';
|
||||
if (($nbphoto % $nbbyrow) == 0) $return.= '</tr>';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return.='</div>';
|
||||
}
|
||||
|
||||
if ($nbbyrow > 0)
|
||||
{
|
||||
$return.= '</td>';
|
||||
if (($nbphoto % $nbbyrow) == 0) $return.= '</tr>';
|
||||
}
|
||||
else if ($nbbyrow < 0) $return.='</div>';
|
||||
}
|
||||
if (empty($size)) { // Format origine
|
||||
$return.= '<img class="photo photowithmargin" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
||||
|
||||
if (empty($size)) { // Format origine
|
||||
$return.= '<img class="photo photowithmargin" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&entity='.$this->entity.'&file='.urlencode($pdir.$photo).'">';
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?modulepart='.urlencode('produit|service').'&id='.$this->id.'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Link to delete
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// On continue ou on arrete de boucler ?
|
||||
if ($nbmax && $nbphoto >= $nbmax) break;
|
||||
}
|
||||
}
|
||||
// On continue ou on arrete de boucler ?
|
||||
if ($nbmax && $nbphoto >= $nbmax) break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($size==1 || $size=='small')
|
||||
@ -3897,8 +3944,6 @@ class Product extends CommonObject
|
||||
if ($nbphoto) $return.= '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
$this->nbphoto = $nbphoto;
|
||||
@ -3916,8 +3961,9 @@ class Product extends CommonObject
|
||||
*/
|
||||
function liste_photos($dir,$nbmax=0)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$nbphoto=0;
|
||||
$tabobj=array();
|
||||
|
||||
@ -3928,7 +3974,7 @@ class Product extends CommonObject
|
||||
while (($file = readdir($handle)) !== false)
|
||||
{
|
||||
if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO
|
||||
if (dol_is_file($dir.$file) && preg_match('/('.$this->regeximgext.')$/i', $dir.$file))
|
||||
if (dol_is_file($dir.$file) && image_format_supported($file) >= 0)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
@ -3969,8 +4015,9 @@ class Product extends CommonObject
|
||||
*/
|
||||
function delete_photo($file)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
|
||||
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
|
||||
$filename = preg_replace('/'.preg_quote($dir,'/').'/i','',$file); // Nom du fichier
|
||||
|
||||
@ -29,14 +29,14 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
*/
|
||||
class Service extends CommonObject
|
||||
{
|
||||
var $libelle;
|
||||
var $price;
|
||||
var $tms;
|
||||
var $debut;
|
||||
var $fin;
|
||||
public $libelle;
|
||||
public $price;
|
||||
public $tms;
|
||||
public $debut;
|
||||
public $fin;
|
||||
|
||||
var $debut_epoch;
|
||||
var $fin_epoch;
|
||||
public $debut_epoch;
|
||||
public $fin_epoch;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -62,7 +62,7 @@ $offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="name";
|
||||
if (! $sortfield) $sortfield="position_name";
|
||||
|
||||
|
||||
$object = new Product($db);
|
||||
@ -192,7 +192,7 @@ if ($object->id)
|
||||
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
// Construit liste des fichiers
|
||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||
|
||||
|
||||
@ -256,92 +256,6 @@ class Productlot extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit offset limit
|
||||
* @param int $offset offset limit
|
||||
* @param array $filter filter array
|
||||
* @param string $filtermode filter mode (AND or OR)
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.fk_product,";
|
||||
$sql .= " t.batch,";
|
||||
$sql .= " t.eatby,";
|
||||
$sql .= " t.sellby,";
|
||||
$sql .= " t.datec,";
|
||||
$sql .= " t.tms,";
|
||||
$sql .= " t.fk_user_creat,";
|
||||
$sql .= " t.fk_user_modif,";
|
||||
$sql .= " t.import_key";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$line = new ProductlotLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
$line->entity = $obj->entity;
|
||||
$line->fk_product = $obj->fk_product;
|
||||
$line->batch = $obj->batch;
|
||||
$line->eatby = $this->db->jdate($obj->eatby);
|
||||
$line->sellby = $this->db->jdate($obj->sellby);
|
||||
$line->datec = $this->db->jdate($obj->datec);
|
||||
$line->tms = $this->db->jdate($obj->tms);
|
||||
$line->fk_user_creat = $obj->fk_user_creat;
|
||||
$line->fk_user_modif = $obj->fk_user_modif;
|
||||
$line->import_key = $obj->import_key;
|
||||
|
||||
$this->lines[$line->id] = $line;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $num;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
@ -595,32 +509,3 @@ class Productlot extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class ProductlotLine
|
||||
*/
|
||||
class ProductlotLine
|
||||
{
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @var mixed Sample line property 1
|
||||
*/
|
||||
|
||||
public $entity;
|
||||
public $fk_product;
|
||||
public $batch;
|
||||
public $eatby = '';
|
||||
public $sellby = '';
|
||||
public $datec = '';
|
||||
public $tms = '';
|
||||
public $fk_user_creat;
|
||||
public $fk_user_modif;
|
||||
public $import_key;
|
||||
|
||||
/**
|
||||
* @var mixed Sample line property 2
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ class ProductStockEntrepot extends CommonObject
|
||||
// "elseif" used instead of "if" because getting list with specified fk_product and specified fk_entrepot would be the same as doing a fetch
|
||||
|
||||
if (!empty($sortfield)) $sql .= $this->db->order($sortfield,$sortorder);
|
||||
if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
if (!empty($limit)) $sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
|
||||
$lines = array();
|
||||
|
||||
|
||||
@ -37,6 +37,7 @@ $htmlname=GETPOST('htmlname','alpha');
|
||||
$socid=GETPOST('socid','int');
|
||||
$action=GETPOST('action', 'alpha');
|
||||
$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):''));
|
||||
|
||||
$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();
|
||||
|
||||
|
||||
@ -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->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->loan->enabled)) require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php';
|
||||
|
||||
$langs->load("projects");
|
||||
$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->expensereport->enabled)) $langs->load("trips");
|
||||
if (! empty($conf->don->enabled)) $langs->load("donations");
|
||||
if (! empty($conf->loan->enabled)) $langs->load("loan");
|
||||
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref','alpha');
|
||||
@ -370,6 +372,19 @@ $listofreferent=array(
|
||||
'buttonnew'=>'AddDonation',
|
||||
'testnew'=>$user->rights->don->creer,
|
||||
'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(
|
||||
'name'=>"TaskTimeValorised",
|
||||
'title'=>"ListTaskTimeUserProject",
|
||||
@ -402,9 +417,9 @@ $parameters=array('listofreferent'=>$listofreferent);
|
||||
$resHook = $hookmanager->executeHooks('completeListOfReferent',$parameters,$object,$action);
|
||||
|
||||
if(!empty($hookmanager->resArray)) {
|
||||
|
||||
|
||||
$listofreferent = array_merge($listofreferent, $hookmanager->resArray);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($action=="addelement")
|
||||
@ -495,7 +510,7 @@ foreach ($listofreferent as $key => $value)
|
||||
$element = new $classname($db);
|
||||
|
||||
$elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee);
|
||||
|
||||
|
||||
if (count($elementarray)>0 && is_array($elementarray))
|
||||
{
|
||||
$total_ht = 0;
|
||||
@ -511,7 +526,7 @@ foreach ($listofreferent as $key => $value)
|
||||
$element->fetch($idofelement);
|
||||
if ($idofelementuser) $elementuser->fetch($idofelementuser);
|
||||
|
||||
// Special cases
|
||||
// Special cases
|
||||
if ($tablename != 'expensereport_det' && method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty();
|
||||
if ($tablename == 'don') $total_ht_by_line=$element->amount;
|
||||
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 ($qualifiedfortotal) $total_ht = $total_ht + $total_ht_by_line;
|
||||
|
||||
if ($tablename == 'don') $total_ttc_by_line=$element->amount;
|
||||
@ -806,7 +821,7 @@ foreach ($listofreferent as $key => $value)
|
||||
print ' - '.dol_trunc($element->label, 48);
|
||||
}
|
||||
else print $element->getNomUrl(1);
|
||||
|
||||
|
||||
$element_doc = $element->element;
|
||||
$filename=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>';
|
||||
|
||||
|
||||
// Show supplier ref
|
||||
if (! empty($element->ref_supplier)) print ' - '.$element->ref_supplier;
|
||||
// Show customer ref
|
||||
@ -836,7 +851,7 @@ foreach ($listofreferent as $key => $value)
|
||||
elseif (! empty($element->status) || ! empty($element->statut) || ! empty($element->fk_status))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
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').")";
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +151,7 @@ if ($object->id > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
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').")";
|
||||
}
|
||||
|
||||
|
||||
@ -130,7 +130,7 @@ if ($object->id > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
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').")";
|
||||
}
|
||||
|
||||
|
||||
@ -242,7 +242,7 @@ if ($id > 0 || ! empty($ref))
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
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').")";
|
||||
}
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
// Define a complementary filter for search of next/prev ref.
|
||||
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').")";
|
||||
}
|
||||
|
||||
|
||||
@ -86,13 +86,13 @@ print '<td align="center" valign="top">';
|
||||
|
||||
print '<table class="nocellnopadd">';
|
||||
print '<tr><td align="center">';
|
||||
$urlwiki='http://wiki.dolibarr.org';
|
||||
if (preg_match('/fr/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Accueil';
|
||||
if (preg_match('/es/i',$langs->defaultlang)) $urlwiki='http://wiki.dolibarr.org/index.php/Portada';
|
||||
$urlwiki='https://wiki.dolibarr.org';
|
||||
if (preg_match('/fr/i',$langs->defaultlang)) $urlwiki='https://wiki.dolibarr.org/index.php/Accueil';
|
||||
if (preg_match('/es/i',$langs->defaultlang)) $urlwiki='https://wiki.dolibarr.org/index.php/Portada';
|
||||
print '<br>'.$langs->trans("ForDocumentationSeeWiki",$urlwiki,$urlwiki);
|
||||
print '<br>';
|
||||
$urlforum='http://www.dolibarr.org/forum/';
|
||||
$urlforumlocal='http://www.dolibarr.org/forum/';
|
||||
$urlforum='https://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('/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/';
|
||||
@ -194,8 +194,7 @@ print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr><tr>';
|
||||
//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers';
|
||||
$urlwiki='http://partners.dolibarr.org';
|
||||
$urlwiki='https://partners.dolibarr.org';
|
||||
print '<td align="center" valign="top">';
|
||||
print '<table class="nocellnopadd">';
|
||||
print '<tr><td align="center">';
|
||||
@ -229,8 +228,7 @@ print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '</tr><tr>';
|
||||
//$urlwiki='http://wiki.dolibarr.org/index.php/List of Dolibarr partners and providers';
|
||||
$urlwiki='http://partners.dolibarr.org';
|
||||
$urlwiki='https://partners.dolibarr.org';
|
||||
print '<td align="center" valign="top">';
|
||||
print '<table class="nocellnopadd">';
|
||||
print '<tr><td align="center">';
|
||||
|
||||
@ -241,6 +241,7 @@ body {
|
||||
<?php } ?>
|
||||
color: rgb(<?php echo $colortext; ?>);
|
||||
font-size: <?php print $fontsize ?>px;
|
||||
line-height: 130%;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
@ -261,7 +262,8 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, button:focus, select:focus {
|
||||
box-shadow: 0 0 4px #8091BF;
|
||||
/* box-shadow: 0 0 4px #8091BF; */
|
||||
border-bottom: 1px solid #8091BF !important;
|
||||
}
|
||||
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=image] { background-color: transparent; border: none; box-shadow: none; }
|
||||
input:-webkit-autofill {
|
||||
background-color: #FBFFEA !important;
|
||||
background-color: #FDFFF0 !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; }
|
||||
:-moz-placeholder { color:#bbb; } /* firefox 18- */
|
||||
@ -593,6 +595,7 @@ div.myavailability {
|
||||
.div-table-responsive {
|
||||
overflow-x: auto;
|
||||
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) */
|
||||
div.fiche>form>div.div-table-responsive {
|
||||
@ -790,6 +793,7 @@ td.showDragHandle {
|
||||
.side-nav {
|
||||
display: table-cell;
|
||||
border-right: 1px solid #d0d0d0;
|
||||
box-shadow: 3px 0 6px -2px #eee;
|
||||
}
|
||||
div.blockvmenulogo
|
||||
{
|
||||
@ -1375,6 +1379,7 @@ foreach($mainmenuusedarray as $val)
|
||||
.bodylogin
|
||||
{
|
||||
background: #f0f0f0;
|
||||
/* background: linear-gradient(to left top, rgb(255,255,255), rgb(240,240,240)) fixed; */
|
||||
}
|
||||
.login_vertical_align {
|
||||
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);
|
||||
-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);
|
||||
|
||||
/*-moz-box-shadow: 3px 2px 20px #CCC;
|
||||
-webkit-box-shadow: 3px 2px 20px #CCC;
|
||||
box-shadow: 3px 2px 20px #CCC;*/
|
||||
|
||||
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 {
|
||||
text-align: center;
|
||||
@ -1448,8 +1470,8 @@ table.login_table_securitycode tr td {
|
||||
border: 1px solid #DDDDDD;
|
||||
}
|
||||
#img_logo, .img_logo {
|
||||
max-width: 200px;
|
||||
max-height: 100px;
|
||||
max-width: 170px;
|
||||
max-height: 90px;
|
||||
}
|
||||
|
||||
div.login_block {
|
||||
@ -1523,18 +1545,18 @@ img.loginphoto {
|
||||
height: 16px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
|
||||
/*
|
||||
.span-icon-user input, .span-icon-password input {
|
||||
/* margin-left: 18px; */
|
||||
margin-left: 0px;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* ============================================================================== */
|
||||
/* Menu gauche */
|
||||
@ -3050,7 +3072,7 @@ div.info {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
background: #E0EAE4;
|
||||
background: #EaE4Ea;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -242,6 +242,7 @@ body {
|
||||
color: rgb(<?php echo $colortext; ?>);
|
||||
font-size: <?php print $fontsize ?>px;
|
||||
font-family: <?php print $fontlist ?>;
|
||||
line-height: 130%;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-right: 0;
|
||||
@ -261,7 +262,8 @@ input, input.flat, textarea, textarea.flat, form.flat select, select, select.fla
|
||||
}
|
||||
|
||||
input:focus, textarea:focus, button:focus, select:focus {
|
||||
box-shadow: 0 0 4px #8091BF;
|
||||
/* box-shadow: 0 0 4px #8091BF; */
|
||||
border-bottom: 1px solid #8091BF !important;
|
||||
}
|
||||
textarea.cke_source:focus
|
||||
{
|
||||
@ -598,6 +600,7 @@ div.myavailability {
|
||||
.div-table-responsive {
|
||||
overflow-x: auto;
|
||||
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) */
|
||||
div.fiche>form>div.div-table-responsive {
|
||||
@ -805,6 +808,7 @@ td.showDragHandle {
|
||||
<?php } else { ?>
|
||||
background: #FFF;
|
||||
border-right: 1px solid rgba(0,0,0,0.2);
|
||||
box-shadow: 3px 0 6px -2px #eee;
|
||||
bottom: 0;
|
||||
color: #333;
|
||||
display: block;
|
||||
@ -1453,6 +1457,19 @@ form#login {
|
||||
|
||||
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 {
|
||||
text-align: center;
|
||||
max-width: 560px;
|
||||
@ -1488,8 +1505,8 @@ table.login_table_securitycode tr td {
|
||||
border: 1px solid #f4f4f4;
|
||||
}
|
||||
#img_logo, .img-logo {
|
||||
max-width: 200px;
|
||||
max-height: 100px;
|
||||
max-width: 170px;
|
||||
max-height: 90px;
|
||||
}
|
||||
|
||||
div.login_block {
|
||||
@ -1567,7 +1584,8 @@ img.loginphoto {
|
||||
}
|
||||
|
||||
.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 {
|
||||
background-image: url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/lock.png',1); ?>);
|
||||
@ -2976,7 +2994,7 @@ div.info {
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
background: #E0EAE4;
|
||||
background: #EaE4Ea;
|
||||
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
|
||||
@ -2600,8 +2600,9 @@ class User extends CommonObject
|
||||
|
||||
/**
|
||||
* Return list of all child users id in herarchy (all sublevels).
|
||||
* Note: Calling this function also reste full list of users into $this->users.
|
||||
*
|
||||
* @return array Array of user id lower than user. This overwrite this->users.
|
||||
* @return array Array of user id lower than user (all levels under user).
|
||||
* @see get_children
|
||||
*/
|
||||
function getAllChildIds()
|
||||
|
||||
@ -38,20 +38,20 @@ class UserGroup extends CommonObject
|
||||
public $table_element='usergroup';
|
||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||
|
||||
var $entity; // Entity of group
|
||||
public $entity; // Entity of group
|
||||
/**
|
||||
* @deprecated
|
||||
* @see name
|
||||
*/
|
||||
var $nom; // Name of group
|
||||
var $globalgroup; // Global group
|
||||
var $datec; // Creation date of group
|
||||
var $datem; // Modification date of group
|
||||
var $members=array(); // Array of users
|
||||
public $nom; // Name of group
|
||||
public $globalgroup; // Global group
|
||||
public $datec; // Creation date of group
|
||||
public $datem; // Modification date of group
|
||||
public $members=array(); // Array of users
|
||||
|
||||
private $_tab_loaded=array(); // Array of cache of already loaded permissions
|
||||
|
||||
var $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
public $oldcopy; // To contains a clone of this when we need to save old properties of object
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -286,7 +286,6 @@ class Website extends CommonObject
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.entity,";
|
||||
$sql .= " t.ref,";
|
||||
$sql .= " t.description,";
|
||||
@ -296,7 +295,6 @@ class Website extends CommonObject
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_modification,";
|
||||
$sql .= " t.tms";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
|
||||
// Manage filter
|
||||
@ -314,7 +312,7 @@ class Website extends CommonObject
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
$this->records = array();
|
||||
|
||||
@ -323,7 +321,7 @@ class Website extends CommonObject
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$line = new WebsiteLine();
|
||||
$line = new self($this->db);
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
|
||||
@ -650,50 +648,3 @@ class Website extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WebsiteLine
|
||||
*/
|
||||
class WebsiteLine
|
||||
{
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $entity;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $ref;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $description;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $status;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $fk_default_home;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $virtualhost;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $date_creation;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $date_modification;
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $tms = '';
|
||||
|
||||
}
|
||||
|
||||
@ -57,7 +57,6 @@ class WebsitePage extends CommonObject
|
||||
public $status;
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
public $tms;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -203,8 +202,7 @@ class WebsitePage extends CommonObject
|
||||
$sql .= " t.content,";
|
||||
$sql .= " t.status,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_modification,";
|
||||
$sql .= " t.tms";
|
||||
$sql .= " t.tms as date_modification";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
if (null !== $website_id) {
|
||||
@ -231,9 +229,6 @@ class WebsitePage extends CommonObject
|
||||
$this->status = $obj->status;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -278,8 +273,7 @@ class WebsitePage extends CommonObject
|
||||
$sql .= " t.content,";
|
||||
$sql .= " t.status,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_modification,";
|
||||
$sql .= " t.tms";
|
||||
$sql .= " t.tms as date_modification";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
|
||||
$sql .= ' WHERE t.fk_website = '.$websiteid;
|
||||
// Manage filter
|
||||
@ -301,9 +295,8 @@ class WebsitePage extends CommonObject
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -311,7 +304,7 @@ class WebsitePage extends CommonObject
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$record = new WebsitePage($this->db);
|
||||
$record = new self($this->db);
|
||||
|
||||
$record->id = $obj->rowid;
|
||||
$record->fk_website = $obj->fk_website;
|
||||
@ -323,7 +316,6 @@ class WebsitePage extends CommonObject
|
||||
$record->status = $obj->status;
|
||||
$record->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$record->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$record->tms = $this->db->jdate($obj->tms);
|
||||
//var_dump($record->id);
|
||||
$records[$record->id] = $record;
|
||||
}
|
||||
@ -389,8 +381,7 @@ class WebsitePage extends CommonObject
|
||||
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").',';
|
||||
$sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
|
||||
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').',';
|
||||
$sql .= ' date_modification = '.(! isset($this->date_modification) || dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : 'null').',';
|
||||
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'");
|
||||
$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
@ -633,18 +624,17 @@ class WebsitePage extends CommonObject
|
||||
{
|
||||
$this->id = 0;
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
$this->fk_website = '';
|
||||
$this->pageurl = '';
|
||||
$this->title = '';
|
||||
$this->description = '';
|
||||
$this->keywords = '';
|
||||
$this->content = '';
|
||||
$this->title = 'My Page';
|
||||
$this->description = 'This is my page';
|
||||
$this->keywords = 'keyword1, keyword2';
|
||||
$this->content = '<html><body>This is a html content</body></html>';
|
||||
$this->status = '';
|
||||
$this->date_creation = '';
|
||||
$this->date_modification = '';
|
||||
$this->tms = '';
|
||||
|
||||
|
||||
$this->date_creation = $now - (24 * 30 * 3600);
|
||||
$this->date_modification = $now - (24 * 7 * 3600);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user