Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into Add_param_color_button_action
This commit is contained in:
commit
78861c1743
@ -134,6 +134,7 @@ NEW: Use lang selector when using a field key 'lang' in modulebuilder
|
||||
NEW: we need to be able to put more filters on deleteByParentField() function
|
||||
NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object
|
||||
NEW: Experimental feature to manage user sessions in database
|
||||
NEW: Hidden option API_DISABLE_COMPRESSION is now visible in API setup page.
|
||||
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
@ -147,6 +148,8 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* Class file expeditionbatch.class.php renamed to expeditionlinebatch.class.php
|
||||
* ExpeditionLineBatch::fetchAll is not static anymore and first parameter $db is removed
|
||||
* ExtraFields->showOutputField parameter 4 'extrafieldsobjectkey' is now required
|
||||
* CommonObject method add_object_linked now sets targettype to 'mymodule_myobject' instead of 'myobject',
|
||||
you can use hook 'setLinkedObjectSourceTargetType' to set your usual targettype
|
||||
|
||||
|
||||
|
||||
|
||||
@ -363,7 +363,7 @@ if ($resql) {
|
||||
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans("New"), $langs->trans("Addanaccount"), 'fa fa-plus-circle', './card.php?action=create');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
print_barre_liste($langs->trans('ListAccounts'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accounting_account', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
// Box to select active chart of account
|
||||
print $langs->trans("Selectchartofaccounts")." : ";
|
||||
@ -404,6 +404,11 @@ if ($resql) {
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
@ -466,11 +471,6 @@ if ($resql) {
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$accountstatic = new AccountingAccount($db);
|
||||
$accountparent = new AccountingAccount($db);
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
@ -615,8 +615,13 @@ if ($resql) {
|
||||
}
|
||||
|
||||
if ($num == 0) {
|
||||
$totalarray['nbfield']++;
|
||||
print '<tr><td colspan="'.$totalarray['nbfield'].'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
@ -417,13 +417,13 @@ if ($action == 'create') {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=update&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
if (!empty($user->rights->accounting->chartofaccount)) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ if ($action != 'export_csv') {
|
||||
|
||||
// Show first line of a break
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '<td colspan="'.($colspan+1).'" class="tdforbreak">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$displayed_account = $root_account_number;
|
||||
|
||||
@ -674,7 +674,7 @@ if ($action == 'create') {
|
||||
$resultfetch = $accountingaccount->fetch(null, $line->numero_compte, true);
|
||||
print '<td>';
|
||||
if ($resultfetch > 0) {
|
||||
$accountingaccount->getNomUrl(0, 1, 1, '', 0);
|
||||
print $accountingaccount->getNomUrl(0, 1, 1, '', 0);
|
||||
} else {
|
||||
print $line->numero_compte.' <span class="warning">('.$langs->trans("AccountRemovedFromCurrentChartOfAccount").')</span>';
|
||||
}
|
||||
|
||||
@ -711,8 +711,8 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Show the break account
|
||||
print "<tr>";
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
|
||||
if ($line->numero_compte != "" && $line->numero_compte != '-1') {
|
||||
print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
|
||||
} else {
|
||||
|
||||
@ -713,8 +713,8 @@ while ($i < min($num, $limit)) {
|
||||
}
|
||||
|
||||
// Show the break account
|
||||
print "<tr>";
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" style="font-weight:bold; border-bottom: 1pt solid black;">';
|
||||
print '<tr class="trforbreak">';
|
||||
print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : 10).'" class="tdforbreak">';
|
||||
if ($line->subledger_account != "" && $line->subledger_account != '-1') {
|
||||
print $line->subledger_label.' : '.length_accounta($line->subledger_account);
|
||||
} else {
|
||||
|
||||
@ -915,7 +915,7 @@ class AccountancyExport
|
||||
print "Montantdevise".$separator;
|
||||
print "Idevise".$separator;
|
||||
print "DateLimitReglmt".$separator;
|
||||
print "NumFacture".$separator;
|
||||
print "NumFacture";
|
||||
print $end_line;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
@ -997,13 +997,13 @@ class AccountancyExport
|
||||
print $line->multicurrency_amount . $separator;
|
||||
|
||||
// FEC:Idevise
|
||||
print $line->multicurrency_code.$separator;
|
||||
print $line->multicurrency_code . $separator;
|
||||
|
||||
// FEC_suppl:DateLimitReglmt
|
||||
print $date_limit_payment;
|
||||
print $date_limit_payment . $separator;
|
||||
|
||||
// FEC_suppl:NumFacture
|
||||
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator;
|
||||
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
|
||||
|
||||
print $end_line;
|
||||
}
|
||||
@ -1042,7 +1042,7 @@ class AccountancyExport
|
||||
print "Montantdevise".$separator;
|
||||
print "Idevise".$separator;
|
||||
print "DateLimitReglmt".$separator;
|
||||
print "NumFacture".$separator;
|
||||
print "NumFacture";
|
||||
print $end_line;
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
@ -1127,10 +1127,10 @@ class AccountancyExport
|
||||
print $line->multicurrency_code . $separator;
|
||||
|
||||
// FEC_suppl:DateLimitReglmt
|
||||
print $date_limit_payment;
|
||||
print $date_limit_payment . $separator;
|
||||
|
||||
// FEC_suppl:NumFacture
|
||||
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1) . $separator;
|
||||
print dol_trunc(self::toAnsi($refInvoice), 17, 'right', 'UTF-8', 1);
|
||||
|
||||
|
||||
print $end_line;
|
||||
|
||||
@ -108,6 +108,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
public $account_category;
|
||||
|
||||
/**
|
||||
* @var int Label category account
|
||||
*/
|
||||
public $account_category_label;
|
||||
|
||||
/**
|
||||
* @var int Status
|
||||
*/
|
||||
@ -148,6 +153,11 @@ class AccountingAccount extends CommonObject
|
||||
*/
|
||||
private $accountingaccount_codetotid_cache = array();
|
||||
|
||||
|
||||
const STATUS_ENABLED = 1;
|
||||
const STATUS_DISABLED = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -166,7 +176,7 @@ class AccountingAccount extends CommonObject
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active char of account
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
|
||||
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
|
||||
* @return int <0 if KO, 0 if not found, Id of record if OK and found
|
||||
*/
|
||||
@ -193,7 +203,8 @@ class AccountingAccount extends CommonObject
|
||||
$sql .= " AND a.fk_pcg_version = '".$this->db->escape($limittoachartaccount)."'";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::fetch rowid=".$rowid." account_number=".$account_number, LOG_DEBUG);
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
@ -495,7 +506,7 @@ class AccountingAccount extends CommonObject
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
|
||||
$picto = 'billr';
|
||||
$picto = 'accounting_account';
|
||||
$label = '';
|
||||
|
||||
if (empty($this->labelshort) || $withcompletelabel == 1) {
|
||||
@ -685,49 +696,22 @@ class AccountingAccount extends CommonObject
|
||||
public function LibStatut($status, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->loadLangs(array("users"));
|
||||
|
||||
if ($mode == 0) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 1) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 2) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 3) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
} elseif ($mode == 4) {
|
||||
if ($status == 1) {
|
||||
return img_picto($langs->trans('Enabled'), 'statut4') . ' ' . $langs->trans('Enabled');
|
||||
} elseif ($status == 0) {
|
||||
return img_picto($langs->trans('Disabled'), 'statut5') . ' ' . $langs->trans('Disabled');
|
||||
}
|
||||
} elseif ($mode == 5) {
|
||||
if ($status == 1) {
|
||||
return $langs->trans('Enabled') . ' ' . img_picto($langs->trans('Enabled'), 'statut4');
|
||||
} elseif ($status == 0) {
|
||||
return $langs->trans('Disabled') . ' ' . img_picto($langs->trans('Disabled'), 'statut5');
|
||||
}
|
||||
if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
|
||||
global $langs;
|
||||
$langs->load("users");
|
||||
$this->labelStatus[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
$this->labelStatus[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
|
||||
$this->labelStatusShort[self::STATUS_ENABLED] = $langs->transnoentitiesnoconv('Enabled');
|
||||
$this->labelStatusShort[self::STATUS_DISABLED] = $langs->transnoentitiesnoconv('Disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
$statusType = 'status4';
|
||||
if ($status == self::STATUS_DISABLED) {
|
||||
$statusType = 'status5';
|
||||
}
|
||||
|
||||
return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return Suggest accounting accounts to bind
|
||||
|
||||
@ -1013,7 +1013,7 @@ class BookKeeping extends CommonObject
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->escape($value).'\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key.'='.$value;
|
||||
$sqlwhere[] = $key.'='.((int) $value);
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key.' LIKE \''.$this->db->escape($value).'%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
|
||||
@ -31,7 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta", "bills", "other", "accountancy"));
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
$validatemonth = GETPOST('validatemonth', 'int');
|
||||
$validateyear = GETPOST('validateyear', 'int');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
@ -68,52 +69,47 @@ if (empty($user->rights->accounting->fiscalyear->write)) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) {
|
||||
$result = $object->fetchAll();
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
|
||||
$date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int'));
|
||||
$date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int'));
|
||||
$db->begin();
|
||||
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $movement) {
|
||||
$now = dol_now();
|
||||
// Specify as export : update field date_validated on selected month/year
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE entity = " . ((int) $conf->entity);
|
||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||
$sql .= " AND date_validated IS NULL";
|
||||
|
||||
$sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " SET date_validated = '".$db->idate($now)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $movement->id);
|
||||
$sql .= " AND doc_date >= '" . $db->idate($date_start) . "'";
|
||||
$sql .= " AND doc_date <= '" . $db->idate($date_end) . "'";
|
||||
dol_syslog("/accountancy/closure/index.php action=validate_movement_confirm -> Set movements as validated", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
dol_syslog("/accountancy/closure/index.php :: Function validate_movement_confirm Specify movements as validated", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("AllMovementsWereRecordedAsValidated"), null, 'mesgs');
|
||||
} else {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
}
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?year=".$year_start);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($langs->trans("NotAllMovementsCouldBeRecordedAsValidated"), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -120,6 +120,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -156,14 +157,13 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_sell as company_code_sell";
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."facturedet as l ON f.rowid = l.fk_facture"; // the main table
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
|
||||
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity);
|
||||
@ -174,8 +174,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_sell_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_sell_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_sell = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
@ -256,7 +255,7 @@ if ($action == 'validatehistory') {
|
||||
$suggestedid = 0;
|
||||
|
||||
$return=$accountingAccount->getAccountingCodeToBind($thirdpartystatic, $mysoc, $product_static, $facture_static, $facture_static_det, $accountingAccountArray, 'customer');
|
||||
if (!is_array($return) && $return<0) {
|
||||
if (!is_array($return) && $return < 0) {
|
||||
setEventMessage($accountingAccount->error, 'errors');
|
||||
} else {
|
||||
$suggestedid = $return['suggestedid'];
|
||||
@ -282,17 +281,22 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,16 +632,22 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
print '<td width="60" class="right">'.$langs->trans('MonthShort'.str_pad($j, 2, '0', STR_PAD_LEFT)).'</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>'.$langs->trans("Total").'</b></td></tr>';
|
||||
|
||||
$sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,";
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1;
|
||||
if ($j > 12) {
|
||||
$j -= 12;
|
||||
}
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j, "(fd.total_ht-(fd.qty * fd.buy_price_ht))", "0").") AS month".str_pad($j, 2, "0", STR_PAD_LEFT).",";
|
||||
$sql .= " SUM(".$db->ifsql("MONTH(f.datef)=".$j,
|
||||
" (".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").")",
|
||||
0).") AS month".str_pad($j, 2, '0', STR_PAD_LEFT).",";
|
||||
}
|
||||
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
|
||||
$sql .= " SUM(".$db->ifsql("fd.total_ht < 0",
|
||||
" (-1 * (abs(fd.total_ht) - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100))))",
|
||||
" (fd.total_ht - (fd.buy_price_ht * fd.qty * (fd.situation_percent / 100)))").") 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($search_date_start)."'";
|
||||
@ -654,7 +664,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) { // This part of code looks strange
|
||||
} 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) {
|
||||
|
||||
@ -99,42 +99,69 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Now make the binding
|
||||
if ($db->type == 'pgsql') {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sql1 .= " SET fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " WHERE ".MAIN_DB_PREFIX."expensereport_det.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code = accnt.account_number";
|
||||
$sql1 .= " AND ".MAIN_DB_PREFIX."expensereport_det.fk_code_ventilation = 0";
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql1 .= dolSqlDateFilter('date', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
} else {
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."expensereport_det as erd, ".MAIN_DB_PREFIX."c_type_fees as t, ".MAIN_DB_PREFIX."accounting_account as accnt , ".MAIN_DB_PREFIX."accounting_system as syst";
|
||||
$sql1 .= " SET erd.fk_code_ventilation = accnt.rowid";
|
||||
$sql1 .= " WHERE erd.fk_c_type_fees = t.id AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND accnt.entity = '.((int) $conf->entity);
|
||||
$sql1 .= " AND accnt.active = 1 AND t.accountancy_code=accnt.account_number";
|
||||
$sql1 .= " AND erd.fk_code_ventilation = 0";
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
$sql1 = "SELECT erd.rowid, accnt.rowid as suggestedid";
|
||||
$sql1 .= " FROM ".MAIN_DB_PREFIX."expensereport_det as erd";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_fees as t ON erd.fk_c_type_fees = t.id";
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as accnt ON t.accountancy_code = accnt.account_number AND accnt.active = 1 AND accnt.entity =".((int) $conf->entity);
|
||||
$sql1 .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as syst ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid = ".((int) $conf->global->CHARTOFACCOUNTS).' AND syst.active = 1,';
|
||||
$sql1 .= " ".MAIN_DB_PREFIX."expensereport as er";
|
||||
$sql1 .= " WHERE erd.fk_expensereport = er.rowid AND er.entity = ".((int) $conf->entity);
|
||||
$sql1 .= " AND er.fk_statut IN (".ExpenseReport::STATUS_APPROVED.", ".ExpenseReport::STATUS_CLOSED.") AND erd.fk_code_ventilation <= 0";
|
||||
if ($validatemonth && $validateyear) {
|
||||
$sql1 .= dolSqlDateFilter('erd.date', 0, $validatemonth, $validateyear);
|
||||
}
|
||||
|
||||
dol_syslog('htdocs/accountancy/expensereport/index.php');
|
||||
|
||||
$resql1 = $db->query($sql1);
|
||||
if (!$resql1) {
|
||||
$result = $db->query($sql1);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$nbbinddone = $db->affected_rows($resql1);
|
||||
$num_lines = $db->num_rows($result);
|
||||
|
||||
$i = 0;
|
||||
while ($i < min($num_lines, 10000)) { // No more than 10000 at once
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$lineid = $objp->rowid;
|
||||
$suggestedid = $objp->suggestedid;
|
||||
|
||||
if ($suggestedid > 0) {
|
||||
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."expensereport_det";
|
||||
$sqlupdate .= " SET fk_code_ventilation = ".((int) $suggestedid);
|
||||
$sqlupdate .= " WHERE fk_code_ventilation <= 0 AND rowid = ".((int) $lineid);
|
||||
|
||||
$resqlupdate = $db->query($sqlupdate);
|
||||
if (!$resqlupdate) {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
break;
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
@ -157,7 +184,7 @@ print '</span><br>';
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
$buttonbind = '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=validatehistory&token='.newToken().'&year='.$year_current.'">'.$langs->trans("ValidateHistory").'</a>';
|
||||
|
||||
|
||||
print_barre_liste(img_picto('', 'unlink', 'class="paddingright fa-color-unset"').$langs->trans("OverviewOfAmountOfLinesNotBound"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
|
||||
@ -394,11 +394,12 @@ if ($result) {
|
||||
print '<td class="center">'.vatrate($objp->tva_tx.($objp->vat_src_code ? ' ('.$objp->vat_src_code.')' : '')).'</td>';
|
||||
|
||||
// Accounting account affected
|
||||
print '<td class="center">';
|
||||
print '<td>';
|
||||
print $accountingaccountstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
print ' <a class="editfielda reposition marginleftonly marginrightonly" href="./card.php?id='.$objp->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($param ? '?'.$param : '')).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
|
||||
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="'.$objp->rowid.'"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
|
||||
@ -118,6 +118,7 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
|
||||
if ($action == 'validatehistory') {
|
||||
$error = 0;
|
||||
$nbbinddone = 0;
|
||||
$notpossible = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -154,7 +155,6 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$sql .= " s.accountancy_code_buy as company_code_buy";
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
|
||||
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
|
||||
@ -172,8 +172,7 @@ if ($action == 'validatehistory') {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa2 ON " . $alias_product_perentity . ".accountancy_code_buy_intra = aa2.account_number AND aa2.active = 1 AND aa2.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa2.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa3 ON " . $alias_product_perentity . ".accountancy_code_buy_export = aa3.account_number AND aa3.active = 1 AND aa3.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa3.entity = ".$conf->entity;
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa4 ON " . $alias_societe_perentity . ".accountancy_code_buy = aa4.account_number AND aa4.active = 1 AND aa4.fk_pcg_version = '".$db->escape($chartaccountcode)."' AND aa4.entity = ".$conf->entity;
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0";
|
||||
$sql .= " AND l.product_type <= 2";
|
||||
$sql .= " WHERE f.fk_statut > 0 AND l.fk_code_ventilation <= 0 AND l.product_type <= 2 AND f.entity = ".((int) $conf->entity);
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'";
|
||||
}
|
||||
@ -278,17 +277,22 @@ if ($action == 'validatehistory') {
|
||||
} else {
|
||||
$nbbinddone++;
|
||||
}
|
||||
} else {
|
||||
$notpossible++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
if ($num_lines > 10000) {
|
||||
$notpossible += ($num_lines - 10000);
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
|
||||
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone, $notpossible), null, 'mesgs');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -136,7 +136,11 @@ if ($object->id > 0) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
@ -918,12 +918,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// When used in standard mode
|
||||
// -----------------------------------------
|
||||
|
||||
// Create mode
|
||||
if ($action == 'create') {
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
$object->canvas = $canvas;
|
||||
$object->state_id = GETPOST('state_id', 'int');
|
||||
|
||||
@ -1145,13 +1141,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
// Edit mode
|
||||
if ($action == 'edit') {
|
||||
/********************************************
|
||||
*
|
||||
* Edition mode
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$res = $object->fetch($id);
|
||||
if ($res < 0) {
|
||||
dol_print_error($db, $object->error); exit;
|
||||
@ -1412,13 +1403,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// View
|
||||
if ($id > 0 && $action != 'edit') {
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
$res = $object->fetch($id);
|
||||
if ($res < 0) {
|
||||
dol_print_error($db, $object->error); exit;
|
||||
@ -1707,7 +1693,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
@ -1862,13 +1853,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '</td></tr>';
|
||||
|
||||
// VCard
|
||||
/*
|
||||
print '<tr><td>';
|
||||
print $langs->trans("VCard").'</td><td colspan="3">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">';
|
||||
print img_picto($langs->trans("Download"), 'vcard.png', 'class="paddingrightonly"');
|
||||
print img_picto($langs->trans("Download").' vcard', 'vcard.png', 'class="paddingrightonly"');
|
||||
print $langs->trans("Download");
|
||||
print img_picto($langs->trans("Download").' vcard', 'download', 'class="paddingleft"');
|
||||
print '</a>';
|
||||
print '</td></tr>';
|
||||
*/
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
||||
@ -237,8 +237,9 @@ class Members extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -102,8 +102,9 @@ class MembersTypes extends DolibarrApi
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -100,8 +100,9 @@ class Subscriptions extends DolibarrApi
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -138,7 +138,11 @@ if ($id > 0) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
@ -107,7 +107,11 @@ if ($id) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
|
||||
@ -485,7 +485,11 @@ if ($rowid > 0) {
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback);
|
||||
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'" class="refid">';
|
||||
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
|
||||
$morehtmlref .= '</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1, 'rowid', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
@ -292,7 +292,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
$membertype->amount = $objp->amount;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>';
|
||||
print '<td class="nowraponall">';
|
||||
print $membertype->getNomUrl(1);
|
||||
//<a href="'.$_SERVER["PHP_SELF"].'?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowType"),'group').' '.$objp->rowid.'</a>
|
||||
print '</td>';
|
||||
@ -340,12 +340,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Creation mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
// Creation
|
||||
if ($action == 'create') {
|
||||
$object = new AdherentType($db);
|
||||
|
||||
@ -416,11 +411,7 @@ if ($action == 'create') {
|
||||
print "</form>\n";
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* View mode */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
// View
|
||||
if ($rowid > 0) {
|
||||
if ($action != 'edit') {
|
||||
$object = new AdherentType($db);
|
||||
@ -455,8 +446,9 @@ if ($rowid > 0) {
|
||||
print yn($object->subscription);
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Amount").'</td><td>';
|
||||
print ((is_null($object->amount) || $object->amount === '') ? '' : price($object->amount));
|
||||
print ((is_null($object->amount) || $object->amount === '') ? '' : '<span class="amount">'.price($object->amount).'</span>');
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
|
||||
|
||||
@ -157,7 +157,7 @@ print '</td></tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td><label for="email">'.$langs->trans("EMail").'</label></td><td>';
|
||||
print img_picto('', 'object_email', '', false, 0, 0, '', 'pictofixedwidth');
|
||||
print '<input name="mail" id="email" class="maxwidth150 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
|
||||
print '<input name="mail" id="email" class="maxwidth300 widthcentpercentminusx" value="'.(GETPOSTISSET('mail') ? GETPOST('mail', 'alpha') : (!empty($conf->global->MAIN_INFO_ACCOUNTANT_MAIL) ? $conf->global->MAIN_INFO_ACCOUNTANT_MAIL : '')).'"></td></tr>';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
// Web
|
||||
|
||||
@ -123,12 +123,12 @@ if ($action == 'edit') {
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
foreach ($arrayofparameters as $key => $val) {
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<tr class="oddeven"><td class="titlefieldmiddle">';
|
||||
$tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : '');
|
||||
$label = $langs->trans($key);
|
||||
if ($key == 'DAV_RESTICT_ON_IP') {
|
||||
$label = $langs->trans("RESTRICT_ON_IP");
|
||||
$label .= ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
|
||||
$label .= ' <span class="opacitymedium">'.$langs->trans("Example").': '.$langs->trans("IPListExample").'</span>';
|
||||
}
|
||||
print $form->textwithpicto($label, $tooltiphelp);
|
||||
print '</td><td>';
|
||||
|
||||
@ -1834,6 +1834,7 @@ if ($id) {
|
||||
$class = '';
|
||||
$showfield = 1;
|
||||
$valuetoshow = empty($obj->{$value}) ? '' : $obj->{$value};
|
||||
$titletoshow = '';
|
||||
|
||||
if ($value == 'entity') {
|
||||
$withentity = $valuetoshow;
|
||||
@ -1965,6 +1966,11 @@ if ($id) {
|
||||
} elseif (in_array($value, array('recuperableonly'))) {
|
||||
$class = "center";
|
||||
} elseif ($value == 'accountancy_code' || $value == 'accountancy_code_sell' || $value == 'accountancy_code_buy') {
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$tmpaccountingaccount = new AccountingAccount($db);
|
||||
$tmpaccountingaccount->fetch(0, $valuetoshow, 1);
|
||||
$titletoshow = $langs->transnoentitiesnoconv("Pcgtype").': '.$tmpaccountingaccount->pcg_type;
|
||||
}
|
||||
$valuetoshow = length_accountg($valuetoshow);
|
||||
} elseif ($value == 'fk_tva') {
|
||||
foreach ($form->cache_vatrates as $key => $Tab) {
|
||||
@ -2012,7 +2018,7 @@ if ($id) {
|
||||
}
|
||||
// Show value for field
|
||||
if ($showfield) {
|
||||
print '<!-- '. $value .' --><td class="'.$class.'">'.$valuetoshow.'</td>';
|
||||
print '<!-- '. $value .' --><td class="'.$class.'"'.($titletoshow ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,11 +159,12 @@ if (empty($conf->use_javascript_ajax)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||
print '<!-- constant = '.$constante.' -->'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="16">'.img_object("", $picto[$const]).'</td>';
|
||||
print '<td>'.$langs->trans($desc).'</td>';
|
||||
print '<td class="center" width="100">';
|
||||
$constante = 'FCKEDITOR_ENABLE_'.$const;
|
||||
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0);
|
||||
if ($value == 0) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
|
||||
@ -204,6 +204,18 @@ if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->globa
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NotificationDisableConfirmMessageContact").'</td>';
|
||||
print '<td>';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT');
|
||||
} else {
|
||||
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
|
||||
print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NotificationDisableConfirmMessageUser").'</td>';
|
||||
print '<td>';
|
||||
@ -215,6 +227,7 @@ if ($conf->use_javascript_ajax) {
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NotificationDisableConfirmMessageFix").'</td>';
|
||||
print '<td>';
|
||||
@ -241,79 +254,68 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="settemplates">';
|
||||
|
||||
// Notification per contacts
|
||||
$title = $langs->trans("ListOfNotificationsPerUser");
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
$title = $langs->trans("ListOfNotificationsPerUserOrContact");
|
||||
}
|
||||
print load_fiche_titre($title, '', '');
|
||||
$title = $langs->trans("TemplatesForNotifications");
|
||||
|
||||
print load_fiche_titre($title, '', 'email');
|
||||
|
||||
// Load array of available notifications
|
||||
$notificationtrigger = new InterfaceNotification($db);
|
||||
$listofnotifiedevents = $notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
// Editing global variables not related to a specific theme
|
||||
$constantes = array();
|
||||
foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
// Editing global variables not related to a specific theme
|
||||
$constantes = array();
|
||||
foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$elementLabel = $langs->trans('SupplierOrder');
|
||||
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
||||
$elementLabel = $langs->trans('Proposal');
|
||||
} elseif ($notifiedevent['elementtype'] == 'facture') {
|
||||
$elementLabel = $langs->trans('Bill');
|
||||
} elseif ($notifiedevent['elementtype'] == 'commande') {
|
||||
$elementLabel = $langs->trans('Order');
|
||||
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
|
||||
$elementLabel = $langs->trans('Intervention');
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$elementLabel = $langs->trans('Shipping');
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
}
|
||||
|
||||
if ($notifiedevent['elementtype'] == 'propal') {
|
||||
$model = 'propal_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'commande') {
|
||||
$model = 'order_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'facture') {
|
||||
$model = 'facture_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$model = 'shipping_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
|
||||
$model = 'fichinter_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
|
||||
$model = 'expensereport_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$model = 'order_supplier_send';
|
||||
// } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'member') {
|
||||
$model = 'member';
|
||||
}
|
||||
|
||||
$constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label);
|
||||
if ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$elementLabel = $langs->trans('SupplierOrder');
|
||||
} elseif ($notifiedevent['elementtype'] == 'propal') {
|
||||
$elementLabel = $langs->trans('Proposal');
|
||||
} elseif ($notifiedevent['elementtype'] == 'facture') {
|
||||
$elementLabel = $langs->trans('Bill');
|
||||
} elseif ($notifiedevent['elementtype'] == 'commande') {
|
||||
$elementLabel = $langs->trans('Order');
|
||||
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
|
||||
$elementLabel = $langs->trans('Intervention');
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$elementLabel = $langs->trans('Shipping');
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport' || $notifiedevent['elementtype'] == 'expense_report') {
|
||||
$elementLabel = $langs->trans('ExpenseReport');
|
||||
}
|
||||
|
||||
$helptext = '';
|
||||
form_constantes($constantes, 3, $helptext, 'EmailTemplate');
|
||||
|
||||
print '<div class="opacitymedium">';
|
||||
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
if ($notifiedevent['elementtype'] == 'propal') {
|
||||
$model = 'propal_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'commande') {
|
||||
$model = 'order_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'facture') {
|
||||
$model = 'facture_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'shipping') {
|
||||
$model = 'shipping_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'ficheinter') {
|
||||
$model = 'fichinter_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'expensereport') {
|
||||
$model = 'expensereport_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'order_supplier') {
|
||||
$model = 'order_supplier_send';
|
||||
// } elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send';
|
||||
} elseif ($notifiedevent['elementtype'] == 'member') {
|
||||
$model = 'member';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
$constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label);
|
||||
}
|
||||
|
||||
$helptext = '';
|
||||
form_constantes($constantes, 3, $helptext, 'EmailTemplate');
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
/*
|
||||
} else {
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Label").'</td>';
|
||||
/*print '<td>'.$langs->trans("Code").'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td>';*/
|
||||
//print '<td class="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -359,6 +361,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
*/
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -371,7 +374,15 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setfixednotif">';
|
||||
print '<input type="hidden" name="page_y" value="">';
|
||||
|
||||
print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', '');
|
||||
print load_fiche_titre($langs->trans("ListOfFixedNotifications"), '', 'email');
|
||||
|
||||
print '<div class="info">';
|
||||
print $langs->trans("Note").':<br>';
|
||||
print '* '.$langs->trans("GoOntoUserCardToAddMore").'<br>';
|
||||
if (!empty($conf->societe->enabled)) {
|
||||
print '** '.$langs->trans("GoOntoContactCardToAddMore").'<br>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -488,8 +499,6 @@ foreach ($listofnotifiedevents as $notifiedevent) {
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $form->buttonsSaveCancel("Save", '');
|
||||
|
||||
print '</form>';
|
||||
|
||||
@ -43,6 +43,7 @@ $langcode = GETPOST('langcode', 'alphanohtml');
|
||||
$transkey = GETPOST('transkey', 'alphanohtml');
|
||||
$transvalue = GETPOST('transvalue', 'restricthtml');
|
||||
|
||||
|
||||
$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'searchkey';
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -477,9 +478,9 @@ if ($mode == 'searchkey') {
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidth250', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.dol_escape_htmltag($transkey).'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($transvalue).'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
|
||||
@ -38,7 +38,7 @@ if (!$user->admin) {
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
//Activate ProfId
|
||||
// Activate Production mode
|
||||
if ($action == 'setproductionmode') {
|
||||
$status = GETPOST('status', 'alpha');
|
||||
|
||||
@ -69,6 +69,18 @@ if ($action == 'setproductionmode') {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable compression mode
|
||||
if ($action == 'setdisablecomprssion') {
|
||||
$status = GETPOST('status', 'alpha');
|
||||
|
||||
if (dolibarr_set_const($db, 'API_DISABLE_COMPRESSION', $status, 'chaine', 0, '', 0) > 0) {
|
||||
header("Location: ".$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'save') {
|
||||
dolibarr_set_const($db, 'API_RESTRICT_ON_IP', GETPOST('API_RESTRICT_ON_IP', 'alpha'));
|
||||
}
|
||||
@ -116,6 +128,21 @@ if ($production_mode) {
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("API_DISABLE_COMPRESSION").'</td>';
|
||||
$disable_compression = (empty($conf->global->API_DISABLE_COMPRESSION) ?false:true);
|
||||
if ($disable_compression) {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecomprssion&token='.newToken().'&value='.($i + 1).'&status=0">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setdisablecomprssion&token='.newToken().'&value='.($i + 1).'&status=1">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("RESTRICT_ON_IP");
|
||||
print ' '.$langs->trans("Example").': '.$langs->trans("IPListExample");
|
||||
|
||||
@ -110,6 +110,8 @@ class DolibarrApi
|
||||
unset($object->ismultientitymanaged);
|
||||
unset($object->restrictiononfksoc);
|
||||
unset($object->table_rowid);
|
||||
unset($object->pass);
|
||||
unset($object->pass_indatabase);
|
||||
|
||||
// Remove linkedObjects. We should already have linkedObjectsIds that avoid huge responses
|
||||
unset($object->linkedObjects);
|
||||
@ -292,17 +294,26 @@ class DolibarrApi
|
||||
/**
|
||||
* Return if a $sqlfilters parameter is valid
|
||||
*
|
||||
* @param string $sqlfilters sqlfilter string
|
||||
* @return boolean True if valid, False if not valid
|
||||
* @param string $sqlfilters sqlfilter string
|
||||
* @param string $error Error message
|
||||
* @return boolean|string True if valid, False if not valid
|
||||
*/
|
||||
protected function _checkFilters($sqlfilters)
|
||||
protected function _checkFilters($sqlfilters, &$error = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
|
||||
//$regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)';
|
||||
//$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters);
|
||||
$tmp = $sqlfilters;
|
||||
$ok = 0;
|
||||
$tmp = trim($sqlfilters);
|
||||
|
||||
$i = 0; $nb = strlen($tmp);
|
||||
|
||||
if ($nb > 0 && $tmp[0] != '(') {
|
||||
$error = "Bad sqlfilters (first and last characters must be open and closing parenthesis) = ".$sqlfilters;
|
||||
dol_syslog($error, LOG_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$counter = 0;
|
||||
while ($i < $nb) {
|
||||
if ($tmp[$i] == '(') {
|
||||
|
||||
@ -76,8 +76,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -139,8 +140,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -203,8 +205,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -267,8 +270,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE 1 = 1";
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -367,8 +371,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE 1 = 1";
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -542,10 +547,11 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
}
|
||||
|
||||
@ -657,8 +663,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -720,8 +727,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -787,8 +795,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -849,8 +858,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -921,8 +931,9 @@ class Setup extends DolibarrApi
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -991,8 +1002,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1064,8 +1076,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1128,8 +1141,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1186,8 +1200,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(400, 'error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1244,8 +1259,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1306,8 +1322,9 @@ class Setup extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1364,8 +1381,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1429,8 +1447,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1487,8 +1506,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1545,8 +1565,9 @@ class Setup extends DolibarrApi
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -1605,8 +1626,9 @@ class Setup extends DolibarrApi
|
||||
// if ($module) $sql .= " AND t.module LIKE '%".$this->db->escape($module)."%'";
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -343,14 +343,34 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
//exit;
|
||||
|
||||
// We do not want that restler outputs data if we use native compression (default behaviour) but we want to have it returned into a string.
|
||||
Luracast\Restler\Defaults::$returnResponse = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||
// If API_DISABLE_COMPRESSION is set, returnResponse is false => It use default handling so output result directly.
|
||||
$usecompression = (empty($conf->global->API_DISABLE_COMPRESSION) && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
|
||||
$foundonealgorithm = 0;
|
||||
if ($usecompression) {
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && is_callable('bzcompress')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||
$foundonealgorithm++;
|
||||
}
|
||||
if (!$foundonealgorithm) {
|
||||
$usecompression = false;
|
||||
}
|
||||
}
|
||||
|
||||
//dol_syslog('We found some compression algoithm: '.$foundonealgorithm.' -> usecompression='.$usecompression, LOG_DEBUG);
|
||||
|
||||
Luracast\Restler\Defaults::$returnResponse = $usecompression;
|
||||
|
||||
// Call API (we suppose we found it).
|
||||
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
|
||||
$result = $api->r->handle();
|
||||
|
||||
if (Luracast\Restler\Defaults::$returnResponse) {
|
||||
// We try to compress data
|
||||
// We try to compress the data received data
|
||||
if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && is_callable('brotli_compress')) {
|
||||
header('Content-Encoding: br');
|
||||
$result = brotli_compress($result, 11, BROTLI_TEXT);
|
||||
@ -360,6 +380,10 @@ if (Luracast\Restler\Defaults::$returnResponse) {
|
||||
} elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && is_callable('gzencode')) {
|
||||
header('Content-Encoding: gzip');
|
||||
$result = gzencode($result, 9);
|
||||
} else {
|
||||
header('Content-Encoding: text/html');
|
||||
print "No compression method found. Try to disable compression by adding API_DISABLE_COMPRESSION=1";
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Restler did not output data yet, we return it now
|
||||
|
||||
@ -796,7 +796,7 @@ class BlockedLog
|
||||
{
|
||||
|
||||
$res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".((int) $this->id));
|
||||
if ($res === false) {
|
||||
if (!$res) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -148,8 +148,9 @@ class Boms extends DolibarrApi
|
||||
$sql .= " AND sc.fk_user = ".((int) $search_sale);
|
||||
}
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -66,7 +66,7 @@ function printDropdownBookmarksList()
|
||||
|
||||
|
||||
// Url to list bookmark
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('AddThisPageToBookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$listbtn = '<a class="top-menu-dropdown-link" title="'.$langs->trans('Bookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$listbtn .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
|
||||
|
||||
// Url to go on create new bookmark page
|
||||
|
||||
@ -175,7 +175,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
print "<tr class=\"liste_titre\">";
|
||||
print '<tr class="liste_titre">';
|
||||
//print "<td> </td>";
|
||||
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], "b.title", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
@ -199,7 +199,7 @@ while ($i < min($num, $limit)) {
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Id
|
||||
print '<td class="left">';
|
||||
print '<td class="nowraponall">';
|
||||
print $object->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
@ -268,14 +268,12 @@ while ($i < min($num, $limit)) {
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
|
||||
// Actions
|
||||
print '<td class="nowrap right">';
|
||||
print '<td class="nowraponall right">';
|
||||
if ($canedit) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
|
||||
print '<a class="editfielda marginleftonly" href="'.DOL_URL_ROOT.'/bookmarks/card.php?action=edit&token='.newToken().'&id='.$obj->rowid.'&backtopage='.urlencode($_SERVER["PHP_SELF"]).'">'.img_edit()."</a>";
|
||||
}
|
||||
if ($candelete) {
|
||||
print '<a class="marginleftonly" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$obj->rowid.'">'.img_delete().'</a>';
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
print "</td>";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -145,8 +145,9 @@ class Categories extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -1262,7 +1262,7 @@ if ($action == 'create') {
|
||||
if ($user->hasRight($origin, 'read')) {
|
||||
$hasPermissionOnLinkedObject = 1;
|
||||
}
|
||||
//var_dump('origin='.$origin.' originid='.$originid.' $hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);
|
||||
//var_dump('origin='.$origin.' originid='.$originid.' hasPermissionOnLinkedObject='.$hasPermissionOnLinkedObject);
|
||||
|
||||
if (! in_array($origin, array('societe', 'project', 'task', 'user'))) {
|
||||
// We do not use link for object that already contains a hard coded field to make links with agenda events
|
||||
|
||||
@ -158,8 +158,9 @@ class AgendaEvents extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -465,7 +465,7 @@ if ($object->id > 0) {
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
|
||||
@ -478,7 +478,7 @@ if ($object->id > 0) {
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
@ -488,7 +488,7 @@ if ($object->id > 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
if ($amount_discount > 0) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'&action=create&token='.newToken().'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
}
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
@ -399,8 +399,8 @@ if (empty($reshook)) {
|
||||
$object->cond_reglement_id = GETPOST('cond_reglement_id');
|
||||
$object->mode_reglement_id = GETPOST('mode_reglement_id');
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2); // deprecated
|
||||
$object->remise_percent = price2num(GETPOST('remise_percent'), '', 2);
|
||||
$object->remise_absolue = price2num(GETPOST('remise_absolue'), 'MU', 2);
|
||||
$object->socid = GETPOST('socid', 'int');
|
||||
$object->contact_id = GETPOST('contactid', 'int');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
@ -817,7 +817,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '') {
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha') !== '' && $usercancreate) {
|
||||
// Define vat_rate
|
||||
$vat_rate = (GETPOST('vatforalllines') ? GETPOST('vatforalllines') : 0);
|
||||
$vat_rate = str_replace('*', '', $vat_rate);
|
||||
@ -835,7 +835,7 @@ if (empty($reshook)) {
|
||||
$prod_entry_mode = GETPOST('prod_entry_mode');
|
||||
if ($prod_entry_mode == 'free') {
|
||||
$idprod = 0;
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx') ? price2num(GETPOST('tva_tx')) : 0);
|
||||
} else {
|
||||
$idprod = GETPOST('idprod', 'int');
|
||||
$tva_tx = '';
|
||||
@ -1522,8 +1522,8 @@ if ($action == 'create') {
|
||||
|
||||
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); // TODO maybe add default value option
|
||||
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); // deprecated
|
||||
$remise_percent = (!empty($objectsrc->remise_percent) ? $objectsrc->remise_percent : (!empty($soc->remise_percent) ? $soc->remise_percent : 0));
|
||||
$remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0));
|
||||
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
|
||||
$dateinvoice = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $dateinvoice);
|
||||
|
||||
@ -1646,7 +1646,7 @@ if ($action == 'create') {
|
||||
// Terms of payment
|
||||
print '<tr><td class="nowrap">'.$langs->trans('PaymentConditionsShort').'</td><td>';
|
||||
print img_picto('', 'paiment');
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id), 'cond_reglement_id', -1, 1);
|
||||
$form->select_conditions_paiements((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0) ? GETPOST('cond_reglement_id', 'int') : $soc->cond_reglement_id, 'cond_reglement_id', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Mode of payment
|
||||
@ -1779,7 +1779,7 @@ if ($action == 'create') {
|
||||
// TODO for compatibility
|
||||
if ($origin == 'contrat') {
|
||||
// Calcul contrat->price (HT), contrat->total (TTC), contrat->tva
|
||||
$objectsrc->remise_absolue = $remise_absolue;
|
||||
$objectsrc->remise_absolue = $remise_absolue; // deprecated
|
||||
$objectsrc->remise_percent = $remise_percent;
|
||||
$objectsrc->update_price(1, - 1, 1);
|
||||
}
|
||||
@ -2680,7 +2680,7 @@ if ($action == 'create') {
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, $compatibleImportElementsList);
|
||||
|
||||
// Show online signature link
|
||||
$useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok
|
||||
$useonlinesignature = 1;
|
||||
|
||||
if ($object->statut != Propal::STATUS_DRAFT && $useonlinesignature) {
|
||||
print '<br><!-- Link to sign -->';
|
||||
|
||||
@ -196,8 +196,9 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -204,9 +204,16 @@ class Propal extends CommonObject
|
||||
|
||||
public $cond_reglement_code;
|
||||
public $mode_reglement_code;
|
||||
public $remise = 0;
|
||||
public $remise_percent = 0;
|
||||
public $remise_absolue = 0;
|
||||
public $remise_percent;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $remise;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public $remise_absolue;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -299,7 +306,7 @@ class Propal extends CommonObject
|
||||
'fk_user_cloture' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user cloture', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'price' =>array('type'=>'double', 'label'=>'Price', 'enabled'=>1, 'visible'=>-1, 'position'=>105),
|
||||
'remise_percent' =>array('type'=>'double', 'label'=>'RelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>110),
|
||||
'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise_absolue' =>array('type'=>'double', 'label'=>'CustomerRelativeDiscount', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
//'remise' =>array('type'=>'double', 'label'=>'Remise', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>125, 'isameasure'=>1),
|
||||
'total_tva' =>array('type'=>'double(24,8)', 'label'=>'VAT', 'enabled'=>1, 'visible'=>-1, 'position'=>130, 'isameasure'=>1),
|
||||
@ -1099,9 +1106,9 @@ class Propal extends CommonObject
|
||||
$sql .= " VALUES (";
|
||||
$sql .= $this->socid;
|
||||
$sql .= ", 0";
|
||||
$sql .= ", ".((float) $this->remise);
|
||||
$sql .= ", ".((float) $this->remise); // deprecated
|
||||
$sql .= ", ".($this->remise_percent ? ((float) $this->remise_percent) : 'NULL');
|
||||
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL');
|
||||
$sql .= ", ".($this->remise_absolue ? ((float) $this->remise_absolue) : 'NULL'); // deprecated
|
||||
$sql .= ", 0";
|
||||
$sql .= ", 0";
|
||||
$sql .= ", '".$this->db->idate($this->date)."'";
|
||||
@ -2420,7 +2427,6 @@ class Propal extends CommonObject
|
||||
|
||||
if (!$error) {
|
||||
$this->oldcopy = clone $this;
|
||||
$this->remise_absolue = $remise;
|
||||
$this->update_price(1);
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2021 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
|
||||
@ -38,18 +38,30 @@ if ($user->socid > 0) {
|
||||
}
|
||||
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aplha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
$id = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
if ($cancel) {
|
||||
if (!empty($backtopage)) {
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOST('action', 'aZ09') == 'setremise') {
|
||||
if ($action == 'setremise') {
|
||||
$object = new Societe($db);
|
||||
$object->fetch($id);
|
||||
|
||||
@ -74,11 +86,6 @@ if (GETPOST('action', 'aZ09') == 'setremise') {
|
||||
}
|
||||
}
|
||||
|
||||
// Security check
|
||||
if ($user->socid > 0) {
|
||||
$id = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'societe', $id, '&societe', '', 'fk_soc', 'rowid', 0);
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@ -199,8 +199,9 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -386,9 +386,6 @@ class Commande extends CommonOrder
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->remise = 0;
|
||||
$this->remise_percent = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -132,11 +132,19 @@ class Account extends CommonObject
|
||||
public $bic;
|
||||
|
||||
/**
|
||||
* IBAN number (International Bank Account Number). Stored into iban_prefix field into database
|
||||
* IBAN number (International Bank Account Number). Stored into iban_prefix field into database (TODO Rename field in database)
|
||||
* @var string
|
||||
*/
|
||||
public $iban;
|
||||
|
||||
/**
|
||||
* IBAN number
|
||||
*
|
||||
* @var string
|
||||
* @deprecated see $iban
|
||||
*/
|
||||
public $iban_prefix;
|
||||
|
||||
/**
|
||||
* Name of account holder
|
||||
* @var string
|
||||
|
||||
@ -81,8 +81,9 @@ class BankAccounts extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
@ -438,8 +439,9 @@ class BankAccounts extends DolibarrApi
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -34,10 +34,12 @@ $ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
$fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
|
||||
|
||||
$fieldtype = (!empty($ref) ? 'ref' : 'rowid');
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
||||
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
|
||||
@ -51,7 +51,7 @@ if (!empty($conf->salaries->enabled)) {
|
||||
}
|
||||
|
||||
|
||||
$id = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||
$id = (GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('account', 'int'));
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
@ -67,6 +67,7 @@ $socid = 0;
|
||||
if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account', '', '', $fieldtype);
|
||||
if (empty($user->rights->banque->lire) && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
@ -256,10 +257,14 @@ $form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("BankTransaction"));
|
||||
|
||||
$arrayselected = array();
|
||||
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($rowid, Categorie::TYPE_BANK_LINE);
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
if (is_array($cats)) {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
}
|
||||
|
||||
$head = bankline_prepare_head($rowid);
|
||||
@ -569,11 +574,15 @@ if ($result) {
|
||||
// Bank line
|
||||
print '<tr><td class="toptd">'.$form->editfieldkey('RubriquesTransactions', 'custcats', '', $object, 0).'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_BANK_LINE, null, 'parent', null, null, 1);
|
||||
|
||||
$arrayselected = array();
|
||||
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($bankline->id, Categorie::TYPE_BANK_LINE);
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
if (is_array($cats)) {
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
}
|
||||
print img_picto('', 'category', 'class="paddingright"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, null, null, null, null, "90%");
|
||||
print "</td></tr>";
|
||||
|
||||
@ -987,10 +987,13 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0) {
|
||||
$paiement = new Paiement($db);
|
||||
$result = $paiement->fetch(GETPOST('paiement_id'));
|
||||
$result = $paiement->fetch(GETPOST('paiement_id', 'int'));
|
||||
if ($result > 0) {
|
||||
$result = $paiement->delete(); // If fetch ok and found
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($result < 0) {
|
||||
setEventMessages($paiement->error, $paiement->errors, 'errors');
|
||||
@ -3871,7 +3874,6 @@ if ($action == 'create') {
|
||||
// For example print 239.2 - 229.3 - 9.9; does not return 0.
|
||||
// $resteapayer=bcadd($object->total_ttc,$totalpaye,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
// $resteapayer=bcadd($resteapayer,$totalavoir,$conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
$resteapayer = price2num($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits, 'MT');
|
||||
|
||||
// Multicurrency
|
||||
@ -3880,7 +3882,10 @@ if ($action == 'create') {
|
||||
$multicurrency_totalcreditnotes = $object->getSumCreditNotesUsed(1);
|
||||
$multicurrency_totaldeposits = $object->getSumDepositsUsed(1);
|
||||
$multicurrency_resteapayer = price2num($object->multicurrency_total_ttc - $multicurrency_totalpaye - $multicurrency_totalcreditnotes - $multicurrency_totaldeposits, 'MT');
|
||||
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
||||
// Code to fix case of corrupted data
|
||||
if ($resteapayer == 0 && $multicurrency_resteapayer != 0) {
|
||||
$resteapayer = price2num($multicurrency_resteapayer / $object->multicurrency_tx, 'MT');
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->paye) {
|
||||
@ -5356,7 +5361,7 @@ if ($action == 'create') {
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, $object->id);
|
||||
|
||||
// Reopen a standard paid invoice
|
||||
// Reopen an invoice
|
||||
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|
||||
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
|
||||
|| ($object->type == Facture::TYPE_DEPOSIT && empty($discount->id))
|
||||
@ -5421,14 +5426,18 @@ if ($action == 'create') {
|
||||
if ($objectidnext) {
|
||||
print '<span class="butActionRefused classfortooltip" title="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</span>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused classfortooltip" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} else {
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $resteapayer == 0) {
|
||||
// For down payment, we refuse to receive more than amount to pay.
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</span>';
|
||||
} else {
|
||||
// Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement.php?facid='.$object->id.'&action=create&accountid='.$object->fk_account.'">'.$langs->trans('DoPayment').'</a>';
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sumofpayment = $object->getSommePaiement();
|
||||
|
||||
// Reverse back money or convert to reduction
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_SITUATION) {
|
||||
// For credit note only
|
||||
@ -5446,13 +5455,18 @@ if ($action == 'create') {
|
||||
}
|
||||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
||||
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $object->getSommePaiement() == 0)
|
||||
&& (!empty($conf->global->INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED) || $sumofpayment == 0)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For deposit invoice
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && $usercancreate && $object->statut > 0 && empty($discount->id)) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
if (price2num($object->total_ttc, 'MT') == price2num($sumofpayment, 'MT')) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
} else {
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ConvertToReduc').'</span>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5460,10 +5474,15 @@ if ($action == 'create') {
|
||||
if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercanissuepayment && (
|
||||
($object->type != Facture::TYPE_CREDIT_NOTE && $object->type != Facture::TYPE_DEPOSIT && ($resteapayer <= 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer))) ||
|
||||
($object->type == Facture::TYPE_CREDIT_NOTE && $resteapayer >= 0) ||
|
||||
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0 && ($resteapayer == 0 || (!empty($conf->global->INVOICE_CAN_ADD_PAYMENT_EVEN_IF_ALREADY_PAID) && $object->total_ttc == $resteapayer)))
|
||||
($object->type == Facture::TYPE_DEPOSIT && $object->total_ttc > 0)
|
||||
)
|
||||
) {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||
if ($object->type == Facture::TYPE_DEPOSIT && price2num($object->total_ttc, 'MT') != price2num($sumofpayment, 'MT')) {
|
||||
// We can close a down payment only if paid amount is same than amount of down payment (by definition)
|
||||
print '<span class="butActionRefused" title="'.$langs->trans("AmountPaidMustMatchAmountOfDownPayment").'">'.$langs->trans('ClassifyPaid').'</span>';
|
||||
} else {
|
||||
print '<a class="butAction'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Classify 'closed not completely paid' (possible if validated and not yet filed paid)
|
||||
|
||||
@ -221,8 +221,9 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -1977,7 +1977,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.((int) $this->id);
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res === false) {
|
||||
if (!$res) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
|
||||
@ -147,14 +147,15 @@ class Facture extends CommonInvoice
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
|
||||
//var $amount;
|
||||
// Warning: Do not set default value into property defintion. it must stay null.
|
||||
// For example to avoid to have substition done when object is generic and not yet defined.
|
||||
public $remise_absolue;
|
||||
public $remise_percent;
|
||||
public $total_ht = 0;
|
||||
public $total_tva = 0;
|
||||
public $total_localtax1 = 0;
|
||||
public $total_localtax2 = 0;
|
||||
public $total_ttc = 0;
|
||||
public $total_ht;
|
||||
public $total_tva;
|
||||
public $total_localtax1;
|
||||
public $total_localtax2;
|
||||
public $total_ttc;
|
||||
public $revenuestamp;
|
||||
|
||||
/**
|
||||
@ -5613,17 +5614,17 @@ class FactureLigne extends CommonInvoiceLine
|
||||
$sql .= " description='".$this->db->escape($this->desc)."'";
|
||||
$sql .= ", ref_ext='".$this->db->escape($this->ref_ext)."'";
|
||||
$sql .= ", label=".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : "null");
|
||||
$sql .= ", subprice=".price2num($this->subprice)."";
|
||||
$sql .= ", remise_percent=".price2num($this->remise_percent)."";
|
||||
$sql .= ", subprice=".price2num($this->subprice);
|
||||
$sql .= ", remise_percent=".price2num($this->remise_percent);
|
||||
if ($this->fk_remise_except) {
|
||||
$sql .= ", fk_remise_except=".$this->fk_remise_except;
|
||||
} else {
|
||||
$sql .= ", fk_remise_except=null";
|
||||
}
|
||||
$sql .= ", vat_src_code = '".(empty($this->vat_src_code) ? '' : $this->db->escape($this->vat_src_code))."'";
|
||||
$sql .= ", tva_tx=".price2num($this->tva_tx)."";
|
||||
$sql .= ", localtax1_tx=".price2num($this->localtax1_tx)."";
|
||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx)."";
|
||||
$sql .= ", tva_tx=".price2num($this->tva_tx);
|
||||
$sql .= ", localtax1_tx=".price2num($this->localtax1_tx);
|
||||
$sql .= ", localtax2_tx=".price2num($this->localtax2_tx);
|
||||
$sql .= ", localtax1_type='".$this->db->escape($this->localtax1_type)."'";
|
||||
$sql .= ", localtax2_type='".$this->db->escape($this->localtax2_type)."'";
|
||||
$sql .= ", qty=".price2num($this->qty);
|
||||
@ -5645,15 +5646,15 @@ class FactureLigne extends CommonInvoiceLine
|
||||
if (!empty($this->rang)) {
|
||||
$sql .= ", rang=".((int) $this->rang);
|
||||
}
|
||||
$sql .= ", situation_percent=".$this->situation_percent;
|
||||
$sql .= ", fk_unit=".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql .= ", fk_user_modif =".$user->id;
|
||||
$sql .= ", situation_percent = ".((float) $this->situation_percent);
|
||||
$sql .= ", fk_unit = ".(!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||
$sql .= ", fk_user_modif = ".((int) $user->id);
|
||||
|
||||
// Multicurrency
|
||||
$sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
|
||||
$sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
|
||||
$sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
|
||||
$sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
|
||||
$sql .= ", multicurrency_subprice=".price2num($this->multicurrency_subprice);
|
||||
$sql .= ", multicurrency_total_ht=".price2num($this->multicurrency_total_ht);
|
||||
$sql .= ", multicurrency_total_tva=".price2num($this->multicurrency_total_tva);
|
||||
$sql .= ", multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc);
|
||||
|
||||
$sql .= " WHERE rowid = ".((int) $this->rowid);
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ $id = GETPOST("facid", "int");
|
||||
$ref = GETPOST("ref", 'alpha');
|
||||
|
||||
$object = new Facture($db);
|
||||
|
||||
$extrafields = new ExtraFields($db);
|
||||
|
||||
// Fetch optionals attributes and labels
|
||||
@ -62,14 +63,6 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
||||
@ -77,6 +70,13 @@ $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
if (empty($object->id)) {
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
@ -726,7 +726,31 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '</span></td>';
|
||||
|
||||
// Remain to take or to pay back
|
||||
print '<td class="right">'.price($sign * $remaintopay).'</td>';
|
||||
print '<td class="right">';
|
||||
print price($sign * $remaintopay);
|
||||
if (!empty($conf->prelevement->enabled)) {
|
||||
$numdirectdebitopen = 0;
|
||||
$totaldirectdebit = 0;
|
||||
$sql = "SELECT COUNT(pfd.rowid) as nb, SUM(pfd.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd";
|
||||
$sql .= " WHERE fk_facture = ".((int) $objp->facid);
|
||||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
|
||||
$result_sql = $db->query($sql);
|
||||
if ($result_sql) {
|
||||
$obj = $db->fetch_object($result_sql);
|
||||
$numdirectdebitopen = $obj->nb;
|
||||
$totaldirectdebit = $obj->amount;
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
if ($numdirectdebitopen) {
|
||||
$langs->load("withdrawals");
|
||||
print img_warning($langs->trans("WarningSomeDirectDebitOrdersAlreadyExists", $numdirectdebitopen, price(price2num($totaldirectdebit, 'MT'), 0, $langs, 1, -1, -1, $conf->currency)), '', 'classfortooltip');
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
//$test= price(price2num($objp->total_ttc - $paiement - $creditnotes - $deposits));
|
||||
|
||||
// Amount
|
||||
|
||||
@ -483,7 +483,7 @@ class Paiement extends CommonObject
|
||||
|
||||
// Verifier si paiement porte pas sur une facture classee
|
||||
// Si c'est le cas, on refuse la suppression
|
||||
$billsarray = $this->getBillsArray('fk_statut > 1');
|
||||
$billsarray = $this->getBillsArray('f.fk_statut > 1');
|
||||
if (is_array($billsarray)) {
|
||||
if (count($billsarray)) {
|
||||
$this->error = "ErrorDeletePaymentLinkedToAClosedInvoiceNotPossible";
|
||||
|
||||
@ -43,6 +43,8 @@ if ($user->socid) {
|
||||
}
|
||||
$result = restrictedArea($user, 'paymentbybanktransfer', '', '');
|
||||
|
||||
$usercancreate = $user->rights->paymentbybanktransfer->create;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -62,7 +64,12 @@ if (prelevement_check_config('bank-transfer') < 0) {
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("PaymentByBankTransfer")), null, 'errors');
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"));
|
||||
$newcardbutton = '';
|
||||
if ($usercancreate) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=bank-transfer');
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("SuppliersStandingOrdersArea"), $newcardbutton);
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
@ -43,6 +43,8 @@ if ($user->socid) {
|
||||
}
|
||||
$result = restrictedArea($user, 'prelevement', '', 'bons');
|
||||
|
||||
$usercancreate = $user->rights->prelevement->bons->creer;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -62,7 +64,12 @@ if (prelevement_check_config() < 0) {
|
||||
setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("PaymentByDirectDebit")), null, 'errors');
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"));
|
||||
$newcardbutton = '';
|
||||
if ($usercancreate) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewStandingOrder'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/prelevement/create.php?type=');
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"), $newcardbutton);
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
@ -212,7 +212,7 @@ if ($result) {
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
print $bon->LibStatut($obj->statut, 3);
|
||||
print $bon->LibStatut($obj->statut, 5);
|
||||
print '</td>';
|
||||
|
||||
print '<td class="right"></td>'."\n";
|
||||
|
||||
@ -49,7 +49,7 @@ $date_startyear = GETPOST('date_startyear', 'int');
|
||||
$date_endmonth = GETPOST('date_endmonth', 'int');
|
||||
$date_endday = GETPOST('date_endday', 'int');
|
||||
$date_endyear = GETPOST('date_endyear', 'int');
|
||||
$showaccountdetail = GETPOST('showaccountdetail', 'aZ09') ?GETPOST('showaccountdetail', 'aZ09') : 'no';
|
||||
$showaccountdetail = GETPOST('showaccountdetail', 'aZ09') ? GETPOST('showaccountdetail', 'aZ09') : 'yes';
|
||||
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
@ -210,9 +210,9 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
$calcmode .= '<br>('.$langs->trans("SeeReportInDueDebtMode", '{s1}', '{s2}').')';
|
||||
$calcmode = str_replace(array('{s1}', '{s2}'), array('<a href="'.$_SERVER["PHP_SELF"].'?date_startyear='.$tmps['year'].'&date_startmonth='.$tmps['mon'].'&date_startday='.$tmps['mday'].'&date_endyear='.$tmpe['year'].'&date_endmonth='.$tmpe['mon'].'&date_endday='.$tmpe['mday'].'&modecompta=CREANCES-DETTES">', '</a>'), $calcmode);
|
||||
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$arraylist = array('no'=>$langs->trans("No"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$arraylist = array('no'=>$langs->trans("CustomerCode"), 'yes'=>$langs->trans("AccountWithNonZeroValues"), 'all'=>$langs->trans("All"));
|
||||
$period .= ' '.$langs->trans("DetailByAccount").' '.$form->selectarray('showaccountdetail', $arraylist, $showaccountdetail, 0);
|
||||
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
|
||||
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] - 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($tmps['year'] + 1)."&modecompta=".$modecompta."&showaccountdetail=".$showaccountdetail."'>".img_next()."</a>" : "");
|
||||
$description = $langs->trans("RulesResultBookkeepingPredefined");
|
||||
$description .= ' ('.$langs->trans("SeePageForSetup", DOL_URL_ROOT.'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', $langs->transnoentitiesnoconv("Accountancy").' / '.$langs->transnoentitiesnoconv("Setup").' / '.$langs->transnoentitiesnoconv("Chartofaccounts")).')';
|
||||
$builddate = dol_now();
|
||||
@ -221,7 +221,7 @@ if ($modecompta == "CREANCES-DETTES") {
|
||||
|
||||
$hselected = 'report';
|
||||
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta), $calcmode);
|
||||
report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink, array('modecompta'=>$modecompta, 'showaccountdetail'=>$showaccountdetail), $calcmode);
|
||||
|
||||
if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') {
|
||||
print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1);
|
||||
@ -280,7 +280,10 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$charofaccountstring = $conf->global->CHARTOFACCOUNTS;
|
||||
$charofaccountstring = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version');
|
||||
|
||||
$sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, SUM(f.credit - f.debit) as amount";
|
||||
$sql = "SELECT -1 as socid, aa.pcg_type, SUM(f.credit - f.debit) as amount";
|
||||
if ($showaccountdetail == 'no') {
|
||||
$sql .= ", f.thirdparty_code as name";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."accounting_account as aa";
|
||||
$sql .= " WHERE f.numero_compte = aa.account_number";
|
||||
@ -290,11 +293,13 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY pcg_type DESC, name, socid";
|
||||
$sql .= " GROUP BY pcg_type DESC";
|
||||
if ($showaccountdetail == 'no') {
|
||||
$sql .= ", name, socid"; // group by "accounting group" (INCOME/EXPENSE), then "customer".
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$oldpcgtype = '';
|
||||
$oldpcgsubtype = '';
|
||||
|
||||
dol_syslog("get bookkeeping entries", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
@ -305,16 +310,30 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
if ($objp->pcg_type != $oldpcgtype) {
|
||||
print '<tr><td colspan="4">'.$objp->pcg_type.'</td></tr>';
|
||||
$oldpcgtype = $objp->pcg_type;
|
||||
if ($showaccountdetail == 'no') {
|
||||
if ($objp->pcg_type != $oldpcgtype) {
|
||||
print '<tr class="trforbreak"><td colspan="3" class="tdforbreak">'.$objp->pcg_type.'</td></tr>';
|
||||
$oldpcgtype = $objp->pcg_type;
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$objp->pcg_type.($objp->name ? ' ('.$objp->name.')' : '')."</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
if ($showaccountdetail == 'no') {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td></td>';
|
||||
print '<td>';
|
||||
print $objp->pcg_type;
|
||||
print ($objp->name ? ' ('.$objp->name.')' : ' ('.$langs->trans("Unknown").')');
|
||||
print "</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
} else {
|
||||
print '<tr class="oddeven trforbreak">';
|
||||
print '<td colspan="2" class="tdforbreak">';
|
||||
print $objp->pcg_type;
|
||||
print "</td>\n";
|
||||
print '<td class="right tdforbreak"><span class="amount">'.price($objp->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
$total_ht += (isset($objp->amount) ? $objp->amount : 0);
|
||||
$total_ttc += (isset($objp->amount) ? $objp->amount : 0);
|
||||
@ -333,7 +352,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($showaccountdetail != 'no') {
|
||||
$tmppredefinedgroupwhere = "pcg_type = '".$db->escape($objp->pcg_type)."'";
|
||||
$tmppredefinedgroupwhere .= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'";
|
||||
//$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'";
|
||||
//$tmppredefinedgroupwhere .= " AND thirdparty_code = '".$db->escape($objp->name)."'";
|
||||
|
||||
// Get cpts of category/group
|
||||
$cpts = $AccCat->getCptsCat(0, $tmppredefinedgroupwhere);
|
||||
@ -361,7 +380,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr><td colspan="4" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="3" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@ -418,12 +437,15 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$objp->socid.'">'.$objp->name."</td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
|
||||
print '<span class="amount">'.price($objp->amount_ht)."</span>";
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
@ -463,12 +485,15 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("Bills")." ".$langs->trans("Other")." (".$langs->trans("PaymentsNotLinkedToInvoice").")\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ht)."</span></td>\n";
|
||||
print '<span class="amount">'.price($objp->amount_ht)."</span></td>\n";
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price($objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht += (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
@ -485,7 +510,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
|
||||
if ($total_ttc == 0) {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -494,10 +520,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_income += $total_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price($total_ht).'</td>';
|
||||
print price($total_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price($total_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($total_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
/*
|
||||
@ -554,13 +584,16 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$subtotal_ht += $obj->amount;
|
||||
$subtotal_ttc += $obj->amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
|
||||
print "<td>".$langs->trans("Donation")." <a href=\"".DOL_URL_ROOT."/don/list.php?search_company=".$obj->name."&search_name=".$obj->firstname." ".$obj->lastname."\">".$obj->name." ".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
@ -578,10 +611,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_income += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
||||
print price($subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -636,12 +673,15 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$langs->trans("Bills")." <a href=\"".DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid."\">".$objp->name."</a></td>\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("Bills").' <a href="'.DOL_URL_ROOT."/fourn/facture/list.php?socid=".$objp->socid.'">'.$objp->name.'</a></td>'."\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$objp->amount_ht)."</span></td>\n";
|
||||
print '<span class="amount">'.price(-$objp->amount_ht)."</span>";
|
||||
}
|
||||
print "</td>\n";
|
||||
print '<td class="right"><span class="amount">'.price(-$objp->amount_ttc)."</span></td>\n";
|
||||
|
||||
$total_ht -= (isset($objp->amount_ht) ? $objp->amount_ht : 0);
|
||||
@ -653,7 +693,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -667,10 +708,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_outcome += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||
print price(-$subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -681,7 +726,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsNondeductibles").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
||||
$sql = "SELECT c.id, c.libelle as label, c.accountancy_code, sum(cs.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE cs.fk_type = c.id";
|
||||
@ -690,7 +735,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
||||
$sql = "SELECT c.id, c.libelle as label, c.accountancy_code, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
@ -702,7 +747,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
}
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
$sql .= " GROUP BY c.libelle, c.id";
|
||||
$sql .= " GROUP BY c.libelle, c.id, c.accountancy_code";
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'c.libelle, c.id';
|
||||
@ -732,17 +777,29 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$subtotal_ht += $obj->amount;
|
||||
$subtotal_ttc += $obj->amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
$titletoshow = '';
|
||||
if ($obj->accountancy_code) {
|
||||
$titletoshow = $langs->trans("AccountingCode").': '.$obj->accountancy_code;
|
||||
$tmpaccountingaccount = new AccountingAccount($db);
|
||||
$tmpaccountingaccount->fetch(0, $obj->accountancy_code, 1);
|
||||
$titletoshow .= ' - '.$langs->trans("AccountingCategory").': '.$tmpaccountingaccount->pcg_type;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td'.($obj->accountancy_code ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>'.dol_escape_htmltag($obj->label).'</td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<span class="amount">'.price(-$obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -754,10 +811,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_outcome += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||
print price(-$subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -768,7 +829,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
print '<tr class="trforbreak"><td colspan="4">'.$langs->trans("SocialContributionsDeductibles").'</td></tr>';
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT c.id, c.libelle as label, sum(cs.amount) as amount";
|
||||
$sql = "SELECT c.id, c.libelle as label, c.accountancy_code, sum(cs.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= " WHERE cs.fk_type = c.id";
|
||||
@ -778,7 +839,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
$sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount";
|
||||
$sql = "SELECT c.id, c.libelle as label, c.accountancy_code, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."chargesociales as cs";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."paiementcharge as p";
|
||||
@ -790,7 +851,7 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
}
|
||||
$sql .= " GROUP BY c.libelle, c.id";
|
||||
$sql .= " GROUP BY c.libelle, c.id, c.accountancy_code";
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'c.libelle, c.id';
|
||||
@ -819,17 +880,29 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$subtotal_ht += $obj->amount;
|
||||
$subtotal_ttc += $obj->amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<td>'.$obj->label.'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
$titletoshow = '';
|
||||
if ($obj->accountancy_code) {
|
||||
$titletoshow = $langs->trans("AccountingCode").': '.$obj->accountancy_code;
|
||||
$tmpaccountingaccount = new AccountingAccount($db);
|
||||
$tmpaccountingaccount->fetch(0, $obj->accountancy_code, 1);
|
||||
$titletoshow .= ' - '.$langs->trans("AccountingCategory").': '.$tmpaccountingaccount->pcg_type;
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td'.($obj->accountancy_code ? ' title="'.dol_escape_htmltag($titletoshow).'"' : '').'>'.dol_escape_htmltag($obj->label).'</td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<span class="amount">'.price(-$obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -841,10 +914,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_outcome += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||
print price(-$subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -857,7 +934,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'RECETTES-DEPENSES') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
//$column = 's.dateep'; // We use the date of salary
|
||||
$column = 'p.datep';
|
||||
} else {
|
||||
$column = 'p.datep';
|
||||
}
|
||||
@ -866,13 +944,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON s.rowid=p.fk_salary";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid=s.fk_user";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
$sql .= " WHERE s.entity IN (".getEntity('salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
$sql .= " GROUP BY u.rowid, u.firstname, u.lastname, s.fk_user, p.label, dm";
|
||||
|
||||
// For backward compatibility with old module salary
|
||||
$column = 'p.datep';
|
||||
$sql .= " UNION ";
|
||||
$sql .= " SELECT u.rowid, u.firstname, u.lastname, p.fk_user as fk_user, p.label as label, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
@ -918,16 +997,18 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$userstatic->fetch($obj->fk_user);
|
||||
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?search_user=".urlencode($userstatic->getFullName($langs))."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '<span class="amount">'.price(-$obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -939,10 +1020,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_outcome += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||
print price(-$subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1001,18 +1086,20 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$subtotal_ht += $obj->amount_ht;
|
||||
$subtotal_ttc += $obj->amount_ttc;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("ExpenseReport")." <a href=\"".DOL_URL_ROOT."/expensereport/list.php?search_user=".$obj->userid."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount_ht).'</span></td>';
|
||||
print '<span class="amount">'.price(-$obj->amount_ht).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount_ttc).'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1024,10 +1111,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_outcome += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ht).'</td>';
|
||||
print price(-$subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price(-$subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -1064,11 +1155,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht_outcome += $obj->amount;
|
||||
$total_ttc_outcome += $obj->amount;
|
||||
}
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("Debit")."</td>\n";
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount).'</span></td>';
|
||||
print '<span class="amount">'.price(-$obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price(-$obj->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1083,9 +1177,11 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
}
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print "<td>".$langs->trans("Credit")."</td>\n";
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount).'</span></td>';
|
||||
print '<span class="amount">'.price($obj->amount).'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="right"><span class="amount">'.price($obj->amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1093,10 +1189,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht += $subtotal_ht;
|
||||
$total_ttc += $subtotal_ttc;
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
||||
print price($subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@ -1148,10 +1248,14 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ttc_income += $subtotal_ttc;
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ht).'</td>';
|
||||
print price($subtotal_ht);
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</td>';
|
||||
print '<td class="right">'.price($subtotal_ttc).'</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
@ -1219,7 +1323,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht_outcome -= 0;
|
||||
$total_ttc_outcome -= $amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("VATToPay")."</td>\n";
|
||||
print '<td class="right"> </td>'."\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
@ -1277,7 +1382,8 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht_income += 0;
|
||||
$total_ttc_income += $amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print '<td>'.$langs->trans("VATToCollect")."</td>\n";
|
||||
print '<td class="right"> </td>'."\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
@ -1331,11 +1437,10 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht_outcome -= 0;
|
||||
$total_ttc_outcome -= $amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("VATPaid")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td <class="right"></td>'."\n";
|
||||
}
|
||||
print '<td <class="right"></td>'."\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1387,11 +1492,10 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$total_ht_income += 0;
|
||||
$total_ttc_income += $amount;
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td> </td>';
|
||||
print "<td>".$langs->trans("VATCollected")."</td>\n";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="right"></td>'."\n";
|
||||
}
|
||||
print '<td class="right"></td>'."\n";
|
||||
print '<td class="right"><span class="amount">'.price($amount)."</span></td>\n";
|
||||
print "</tr>\n";
|
||||
}
|
||||
@ -1399,10 +1503,10 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
|
||||
if ($mysoc->tva_assuj != '0') { // Assujetti
|
||||
print '<tr class="liste_total">';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td colspan="3" class="right"> </td>';
|
||||
}
|
||||
print '<td colspan="3" class="right">'.price(price2num($subtotal_ttc, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '<td class="right">'.price(price2num($subtotal_ttc, 'MT')).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,11 +60,11 @@ $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear);
|
||||
|
||||
// We define date_start and date_end
|
||||
if (empty($date_start) || empty($date_end)) { // We define date_start and date_end
|
||||
$q = GETPOST("q") ?GETPOST("q") : 0;
|
||||
$q = GETPOST("q") ? GETPOST("q", 'int') : 0;
|
||||
if ($q == 0) {
|
||||
// We define date_start and date_end
|
||||
$year_end = $year_start + ($nbofyear - 1);
|
||||
$month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
$month_start = GETPOST("month") ? GETPOST("month", 'int') : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
|
||||
if (!GETPOST('month')) {
|
||||
if (!GETPOST("year") && $month_start > $month_current) {
|
||||
$year_start--;
|
||||
@ -140,6 +140,11 @@ $form = new Form($db);
|
||||
|
||||
$exportlink = '';
|
||||
|
||||
$encaiss = array();
|
||||
$encaiss_ttc = array();
|
||||
$decaiss = array();
|
||||
$decaiss_ttc = array();
|
||||
|
||||
// Affiche en-tete du rapport
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear");
|
||||
@ -152,7 +157,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
}
|
||||
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
|
||||
$periodlink = ($year_start ? "<a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear - 2)."&modecompta=".$modecompta."'>".img_previous()."</a> <a href='".$_SERVER["PHP_SELF"]."?year=".($year_start + $nbofyear)."&modecompta=".$modecompta."'>".img_next()."</a>" : "");
|
||||
$description = $langs->trans("RulesAmountWithTaxIncluded");
|
||||
$description = $langs->trans("RulesAmountWithTaxExcluded");
|
||||
$description .= '<br>'.$langs->trans("RulesResultDue");
|
||||
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
|
||||
$description .= "<br>".$langs->trans("DepositsAreNotIncluded");
|
||||
@ -237,10 +242,9 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= " ORDER BY dm";
|
||||
@ -344,8 +348,8 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
}
|
||||
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) {
|
||||
$sql .= " AND f.fk_soc = ".((int) $socid);
|
||||
}
|
||||
@ -413,10 +417,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($decaiss[$obj->dm])) {
|
||||
/*if (!isset($decaiss[$obj->dm])) {
|
||||
$decaiss[$obj->dm] = 0;
|
||||
}
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($decaiss_ttc[$obj->dm])) {
|
||||
$decaiss_ttc[$obj->dm] = 0;
|
||||
@ -438,7 +442,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
} else {
|
||||
$sql .= " AND f.type IN (0,1,2,3)";
|
||||
}
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= " AND f.entity IN (".getEntity('supplier_invoice').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -453,10 +457,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($encaiss[$obj->dm])) {
|
||||
/*if (!isset($encaiss[$obj->dm])) {
|
||||
$encaiss[$obj->dm] = 0;
|
||||
}
|
||||
$encaiss[$obj->dm] += $obj->amount;
|
||||
$encaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($encaiss_ttc[$obj->dm])) {
|
||||
$encaiss_ttc[$obj->dm] = 0;
|
||||
@ -474,7 +478,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql .= " WHERE amount > 0";
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= " AND t.entity IN (".getEntity('vat').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -489,10 +493,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($decaiss[$obj->dm])) {
|
||||
/*if (!isset($decaiss[$obj->dm])) {
|
||||
$decaiss[$obj->dm] = 0;
|
||||
}
|
||||
$decaiss[$obj->dm] += $obj->amount;
|
||||
$decaiss[$obj->dm] += $obj->amount;*/
|
||||
|
||||
if (!isset($decaiss_ttc[$obj->dm])) {
|
||||
$decaiss_ttc[$obj->dm] = 0;
|
||||
@ -509,7 +513,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql .= " WHERE amount < 0";
|
||||
$sql .= " AND t.entity = ".$conf->entity;
|
||||
$sql .= " AND t.entity IN (".getEntity('vat').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND t.datev >= '".$db->idate($date_start)."' AND t.datev <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -524,10 +528,10 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (!isset($encaiss[$obj->dm])) {
|
||||
/*if (!isset($encaiss[$obj->dm])) {
|
||||
$encaiss[$obj->dm] = 0;
|
||||
}
|
||||
$encaiss[$obj->dm] += -$obj->amount;
|
||||
$encaiss[$obj->dm] += -$obj->amount;*/
|
||||
|
||||
if (!isset($encaiss_ttc[$obj->dm])) {
|
||||
$encaiss_ttc[$obj->dm] = 0;
|
||||
@ -572,7 +576,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= " AND cs.entity = ".$conf->entity;
|
||||
$sql .= " AND cs.entity IN (".getEntity('social_contributions').")";
|
||||
$sql .= " GROUP BY c.libelle, dm";
|
||||
|
||||
dol_syslog("get social contributions", LOG_DEBUG);
|
||||
@ -611,7 +615,8 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom
|
||||
|
||||
if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$column = 'p.datev';
|
||||
//$column = 's.dateep'; // we use the date of salary
|
||||
$column = 'p.datep';
|
||||
}
|
||||
if ($modecompta == "RECETTES-DEPENSES") {
|
||||
$column = 'p.datep';
|
||||
@ -620,8 +625,9 @@ if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo
|
||||
$subtotal_ht = 0;
|
||||
$subtotal_ttc = 0;
|
||||
$sql = "SELECT p.label as nom, date_format(".$column.",'%Y-%m') as dm, sum(p.amount) as amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('payment_salary').")";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as p, ".MAIN_DB_PREFIX."salary as s";
|
||||
$sql .= " WHERE p.fk_salary = s.rowid";
|
||||
$sql .= " AND s.entity IN (".getEntity('salary').")";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND ".$column." >= '".$db->idate($date_start)."' AND ".$column." <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -786,7 +792,8 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba
|
||||
// decaiss
|
||||
|
||||
$sql = "SELECT date_format(p.datep, '%Y-%m') AS dm, SUM(p.amount) AS amount FROM ".MAIN_DB_PREFIX."payment_various as p";
|
||||
$sql .= ' WHERE p.sens = 0';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('variouspayment').")";
|
||||
$sql .= ' AND p.sens = 0';
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -816,7 +823,8 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba
|
||||
// encaiss
|
||||
|
||||
$sql = "SELECT date_format(p.datep, '%Y-%m') AS dm, SUM(p.amount) AS amount FROM ".MAIN_DB_PREFIX."payment_various AS p";
|
||||
$sql .= ' WHERE p.sens = 1';
|
||||
$sql .= " WHERE p.entity IN (".getEntity('variouspayment').")";
|
||||
$sql .= ' AND p.sens = 1';
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -852,8 +860,10 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba
|
||||
*/
|
||||
|
||||
if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecompta == "RECETTES-DEPENSES")) {
|
||||
$sql = "SELECT date_format(p.datep, '%Y-%m') AS dm, SUM(p.amount_capital + p.amount_insurance + p.amount_interest) AS amount FROM ".MAIN_DB_PREFIX."payment_loan AS p";
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
$sql = "SELECT date_format(p.datep, '%Y-%m') AS dm, SUM(p.amount_capital + p.amount_insurance + p.amount_interest) AS amount";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_loan AS p, ".MAIN_DB_PREFIX."loan as l";
|
||||
$sql .= " WHERE l.entity IN (".getEntity('variouspayment').")";
|
||||
$sql .= " AND p.fk_loan = l.rowid";
|
||||
if (!empty($date_start) && !empty($date_end)) {
|
||||
$sql .= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
@ -1025,7 +1035,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
$case = strftime("%Y-%m", dol_mktime(12, 0, 0, $mois_modulo, 1, $annee_decalage));
|
||||
|
||||
print '<td class="right"> ';
|
||||
if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
|
||||
if (isset($decaiss[$case]) && $decaiss[$case] != 0) {
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($decaiss[$case], 'MT')).'</a>';
|
||||
if (!isset($totsorties[$annee])) {
|
||||
@ -1045,7 +1055,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
print "</td>";
|
||||
|
||||
print '<td class="borderrightlight nowrap right"> ';
|
||||
if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
|
||||
if (isset($encaiss[$case])) {
|
||||
print '<a href="clientfourn.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price(price2num($encaiss[$case], 'MT')).'</a>';
|
||||
if (!isset($totentrees[$annee])) {
|
||||
@ -1072,7 +1082,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
||||
|
||||
$nbcols = 0;
|
||||
print '<tr class="liste_total impair"><td>';
|
||||
if ($modecompta == 'BOOKKEEPING') {
|
||||
if ($modecompta == 'CREANCES-DETTES' || $modecompta == 'BOOKKEEPING') {
|
||||
print $langs->trans("Total");
|
||||
} else {
|
||||
print $langs->trans("TotalTTC");
|
||||
|
||||
@ -200,11 +200,11 @@ if (!empty($conf->projet->enabled)) {
|
||||
llxHeader('', $langs->trans("SocialContributions"));
|
||||
|
||||
$sql = "SELECT cs.rowid, cs.fk_type as type, cs.fk_user,";
|
||||
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,";
|
||||
$sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode, cs.fk_account,";
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
|
||||
}
|
||||
$sql .= " c.libelle as type_label, cs.fk_account,";
|
||||
$sql .= " c.libelle as type_label, c.accountancy_code as type_accountancy_code,";
|
||||
$sql .= " ba.label as blabel, ba.ref as bref, ba.number as bnumber, ba.account_number, ba.iban_prefix as iban, ba.bic, ba.currency_code, ba.clos,";
|
||||
$sql .= " SUM(pc.amount) as alreadypayed, pay.code as payment_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,";
|
||||
@ -260,7 +260,7 @@ if ($search_date_limit_end) {
|
||||
if ($search_typeid > 0) {
|
||||
$sql .= " AND cs.fk_type = ".((int) $search_typeid);
|
||||
}
|
||||
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, c.libelle, cs.fk_account, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
|
||||
$sql .= " GROUP BY cs.rowid, cs.fk_type, cs.fk_user, cs.amount, cs.date_ech, cs.libelle, cs.paye, cs.periode, cs.fk_account, c.libelle, c.accountancy_code, ba.label, ba.ref, ba.number, ba.account_number, ba.iban_prefix, ba.bic, ba.currency_code, ba.clos, pay.code, u.lastname";
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$sql .= ", p.rowid, p.ref, p.title";
|
||||
}
|
||||
@ -561,6 +561,7 @@ while ($i < min($num, $limit)) {
|
||||
$chargesociale_static->ref = $obj->rowid;
|
||||
$chargesociale_static->label = $obj->label;
|
||||
$chargesociale_static->type_label = $obj->type_label;
|
||||
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
$projectstatic->id = $obj->project_id;
|
||||
$projectstatic->ref = $obj->project_ref;
|
||||
@ -595,7 +596,12 @@ while ($i < min($num, $limit)) {
|
||||
|
||||
// Type
|
||||
if (!empty($arrayfields['cs.fk_type']['checked'])) {
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->type_label).'">'.dol_escape_htmltag($obj->type_label).'</td>';
|
||||
$typelabeltoshow = $obj->type_label;
|
||||
$typelabelpopup = $obj->type_label;
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
$typelabelpopup .= ' - '.$langs->trans("AccountancyCode").': '.$obj->type_accountancy_code;
|
||||
}
|
||||
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($typelabelpopup).'">'.dol_escape_htmltag($typelabeltoshow).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -147,8 +147,9 @@ class Contracts extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -51,11 +51,27 @@ if (!defined('NOBROWSERNOTIF')) {
|
||||
include '../../main.inc.php';
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$signature = GETPOST('signaturebase64');
|
||||
$ref = GETPOST('ref', 'aZ09');
|
||||
$mode = GETPOST('mode', 'aZ09');
|
||||
$SECUREKEY = GETPOST("securekey"); // Secure key
|
||||
|
||||
$error = 0;
|
||||
$response = "";
|
||||
|
||||
// Check securitykey
|
||||
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
|
||||
$type = $mode;
|
||||
$calculatedsecuritykey = dol_hash($securekeyseed.$type.$ref, '0');
|
||||
|
||||
if ($calculatedsecuritykey != $SECUREKEY) {
|
||||
http_response_code(403);
|
||||
print 'Bad value for securitykey. Value provided '.dol_escape_htmltag($SECUREKEY).' does not match expected value for ref='.dol_escape_htmltag($ref);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
@ -71,62 +87,76 @@ if ($action == "importSignature") {
|
||||
if (!empty($signature) && $signature[0] == "image/png;base64") {
|
||||
$signature = $signature[1];
|
||||
$data = base64_decode($signature);
|
||||
$upload_dir = DOL_DATA_ROOT."/".$mode."/".$ref."/";
|
||||
$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
|
||||
$filename = "signatures/".$date."_signature.png";
|
||||
if (!is_dir($upload_dir."signatures/")) {
|
||||
if (!mkdir($upload_dir."signatures/")) {
|
||||
$response ="error mkdir";
|
||||
$error++;
|
||||
|
||||
if ($mode == "propale" || $mode == 'proposal') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
$object = new Propal($db);
|
||||
$object->fetch(0, $ref);
|
||||
|
||||
$upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output;
|
||||
$upload_dir .= '/'.dol_sanitizeFileName($object->ref).'/';
|
||||
|
||||
$date = dol_print_date(dol_now(), "%Y%m%d%H%M%S");
|
||||
$filename = "signatures/".$date."_signature.png";
|
||||
if (!is_dir($upload_dir."signatures/")) {
|
||||
if (!dol_mkdir($upload_dir."signatures/")) {
|
||||
$response ="Error mkdir. Failed to create dir ".$upload_dir."signatures/";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$error) {
|
||||
$return = file_put_contents($upload_dir.$filename, $data);
|
||||
if ($return == false) {
|
||||
$response = 'error file_put_content';
|
||||
} else {
|
||||
if ($mode == "propale") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
$object = new Propal($db);
|
||||
$object->fetch(0, $ref);
|
||||
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf");
|
||||
if (!$error) {
|
||||
$return = file_put_contents($upload_dir.$filename, $data);
|
||||
if ($return == false) {
|
||||
$error++;
|
||||
$response = 'error file_put_content';
|
||||
}
|
||||
}
|
||||
|
||||
$tppl = $pdf->importPage(1);
|
||||
$pdf->useTemplate($tppl);
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15);
|
||||
$pdf->Close();
|
||||
$pdf->Output($upload_dir.$ref."_signed-".$date.".pdf", "F");
|
||||
if (!$error) {
|
||||
$pdf = pdf_getInstance();
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
$pagecount = $pdf->setSourceFile($upload_dir.$ref.".pdf");
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'";
|
||||
$sql .= " WHERE rowid = ".((int) $object->id);
|
||||
$tppl = $pdf->importPage(1);
|
||||
$pdf->useTemplate($tppl);
|
||||
$pdf->Image($upload_dir.$filename, 129, 239.6, 60, 15);
|
||||
$pdf->Close();
|
||||
$pdf->Output($upload_dir.$ref."_signed-".$date.".pdf", "F");
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
} else {
|
||||
$num = $db->affected_rows($resql);
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
|
||||
$sql .= " SET fk_statut = ".((int) $object::STATUS_SIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'";
|
||||
$sql .= " WHERE rowid = ".((int) $object->id);
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$response = "success";
|
||||
setEventMessage("PropalSigned");
|
||||
} else {
|
||||
$db->rollback();
|
||||
$response = "error sql";
|
||||
}
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++;
|
||||
} else {
|
||||
$num = $db->affected_rows($resql);
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
$response = "success";
|
||||
setEventMessages("PropalSigned", null, 'warnings');
|
||||
} else {
|
||||
$db->rollback();
|
||||
$error++;
|
||||
$response = "error sql";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
$response = 'error signature_not_found';
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
http_response_code(501);
|
||||
}
|
||||
|
||||
echo $response;
|
||||
|
||||
@ -111,12 +111,20 @@ if (empty($conf->bookmark->enabled)) {
|
||||
if ($i == 0) {
|
||||
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("NoBookmarks").'</span>';
|
||||
$bookmarkList .= '<br><br>';
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
|
||||
|
||||
$bookmarkList .= '<center>'.$newcardbutton.'</center>';
|
||||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
|
||||
|
||||
// Url to list bookmark
|
||||
$bookmarkList .= '<br>';
|
||||
$bookmarkList .= '<a class="top-menu-dropdown-link" title="'.$langs->trans('Bookmarks').'" href="'.DOL_URL_ROOT.'/bookmarks/list.php" >';
|
||||
$bookmarkList .= img_picto('', 'bookmark', 'class="paddingright"').$langs->trans('Bookmarks').'</a>';
|
||||
$bookmarkList .= '<br>';
|
||||
$bookmarkList .= '<br>';
|
||||
|
||||
$bookmarkList .= '<center>'.$newcardbutton.'</center>';
|
||||
|
||||
$bookmarkList .= '</div>';
|
||||
|
||||
|
||||
|
||||
@ -168,6 +168,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
|
||||
$discountstatic = new DiscountAbsolute($this->db);
|
||||
$result = $discountstatic->getSumDepositsUsed($this, $multicurrency);
|
||||
|
||||
if ($result >= 0) {
|
||||
return $result;
|
||||
} else {
|
||||
|
||||
@ -1273,7 +1273,7 @@ abstract class CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid";
|
||||
}
|
||||
$sql .= " WHERE ec.element_id = ".((int) $this->id);
|
||||
$sql .= " AND ec.fk_c_type_contact=tc.rowid";
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid";
|
||||
$sql .= " AND tc.element = '".$this->db->escape($this->element)."'";
|
||||
if ($code) {
|
||||
$sql .= " AND tc.code = '".$this->db->escape($code)."'";
|
||||
@ -1662,8 +1662,8 @@ abstract class CommonObject
|
||||
* Looks for an object with ref matching the wildcard provided
|
||||
* It does only work when $this->table_ref_field is set
|
||||
*
|
||||
* @param string $ref Wildcard
|
||||
* @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO
|
||||
* @param string $ref Wildcard
|
||||
* @return int >1 = OK, 0 = Not found or table_ref_field not defined, <0 = KO
|
||||
*/
|
||||
public function fetchOneLike($ref)
|
||||
{
|
||||
@ -4174,9 +4174,16 @@ abstract class CommonObject
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
|
||||
$sql .= " SET ".$fieldstatus." = ".((int) $status);
|
||||
// If status = 1 = validated, update also fk_user_valid
|
||||
if ($status == 1 && $elementTable == 'expensereport') {
|
||||
// TODO Replace the test on $elementTable by doing a test on existence of the field in $this->fields
|
||||
if ($status == 1 && in_array($elementTable, array('expensereport', 'inventory'))) {
|
||||
$sql .= ", fk_user_valid = ".((int) $user->id);
|
||||
}
|
||||
if ($status == 1 && in_array($elementTable, array('expensereport'))) {
|
||||
$sql .= ", date_valid = '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
if ($status == 1 && in_array($elementTable, array('inventory'))) {
|
||||
$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
$sql .= " WHERE rowid=".((int) $elementId);
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
|
||||
@ -4855,7 +4862,7 @@ abstract class CommonObject
|
||||
*/
|
||||
public function printOriginLinesList($restrictlist = '', $selectedLines = array())
|
||||
{
|
||||
global $langs, $hookmanager, $conf, $form;
|
||||
global $langs, $hookmanager, $conf, $form, $action;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
@ -4881,7 +4888,7 @@ abstract class CommonObject
|
||||
if (is_object($hookmanager)) { // Old code is commented on preceding line.
|
||||
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
|
||||
if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
|
||||
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
|
||||
@ -5301,7 +5308,7 @@ abstract class CommonObject
|
||||
// Set the public "share" key
|
||||
$setsharekey = false;
|
||||
if ($this->element == 'propal') {
|
||||
$useonlinesignature = $conf->global->MAIN_FEATURES_LEVEL; // Replace this with 1 when feature to make online signature is ok
|
||||
$useonlinesignature = 1; // Replace this with 1 when feature to make online signature is ok
|
||||
if ($useonlinesignature) {
|
||||
$setsharekey = true;
|
||||
}
|
||||
@ -8733,7 +8740,7 @@ abstract class CommonObject
|
||||
$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if ($res === false) {
|
||||
if (!$res) {
|
||||
$error++;
|
||||
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
$this->errors[] = "ErrorRefAlreadyExists";
|
||||
@ -8985,7 +8992,7 @@ abstract class CommonObject
|
||||
$this->db->begin();
|
||||
if (!$error) {
|
||||
$res = $this->db->query($sql);
|
||||
if ($res === false) {
|
||||
if (!$res) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
|
||||
@ -221,6 +221,7 @@ class dolReceiptPrinter extends Printer
|
||||
'dol_value_mysoc_idprof6' => 'ProfId6',
|
||||
'dol_value_mysoc_tva_intra' => 'VATIntra',
|
||||
'dol_value_mysoc_capital' => 'Capital',
|
||||
'dol_value_mysoc_url' => 'Web',
|
||||
'dol_value_vendor_lastname' => 'VendorLastname',
|
||||
'dol_value_vendor_firstname' => 'VendorFirstname',
|
||||
'dol_value_vendor_mail' => 'VendorEmail',
|
||||
@ -607,6 +608,7 @@ class dolReceiptPrinter extends Printer
|
||||
$this->template = str_replace('{dol_value_mysoc_idprof6}', $mysoc->idprof6, $this->template);
|
||||
$this->template = str_replace('{dol_value_mysoc_tva_intra}', $mysoc->tva_intra, $this->template);
|
||||
$this->template = str_replace('{dol_value_mysoc_capital}', $mysoc->capital, $this->template);
|
||||
$this->template = str_replace('{dol_value_mysoc_url}', $mysoc->url, $this->template);
|
||||
|
||||
$this->template = str_replace('{dol_value_vendor_firstname}', $user->firstname, $this->template);
|
||||
$this->template = str_replace('{dol_value_vendor_lastname}', $user->lastname, $this->template);
|
||||
@ -672,9 +674,9 @@ class dolReceiptPrinter extends Printer
|
||||
$vatarray[$line->tva_tx] += $line->total_tva;
|
||||
}
|
||||
foreach ($vatarray as $vatkey => $vatvalue) {
|
||||
$spacestoadd = $nbcharactbyline - strlen($vatkey) - 12;
|
||||
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
|
||||
$this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
$spacestoadd = $nbcharactbyline - strlen($vatkey) - 12;
|
||||
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
|
||||
$this->printer->text($spaces.$vatkey.'% '.str_pad(price($vatvalue), 10, ' ', STR_PAD_LEFT)."\n");
|
||||
}
|
||||
break;
|
||||
case 'DOL_PRINT_OBJECT_TAX1':
|
||||
|
||||
@ -347,8 +347,7 @@ class EmailSenderProfile extends CommonObject
|
||||
*/
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem,';
|
||||
$sql .= ' fk_user_creat, fk_user_modif';
|
||||
$sql = 'SELECT rowid, date_creation as datec, tms as datem';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
$sql .= ' WHERE t.rowid = '.((int) $id);
|
||||
$result = $this->db->query($sql);
|
||||
@ -356,27 +355,9 @@ class EmailSenderProfile extends CommonObject
|
||||
if ($this->db->num_rows($result)) {
|
||||
$obj = $this->db->fetch_object($result);
|
||||
$this->id = $obj->rowid;
|
||||
if ($obj->fk_user_author) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_author);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_valid) {
|
||||
$vuser = new User($this->db);
|
||||
$vuser->fetch($obj->fk_user_valid);
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_cloture) {
|
||||
$cluser = new User($this->db);
|
||||
$cluser->fetch($obj->fk_user_cloture);
|
||||
$this->user_cloture = $cluser;
|
||||
}
|
||||
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
|
||||
@ -925,6 +925,7 @@ class ExtraFields
|
||||
// Old usage
|
||||
$label = $this->attribute_label[$key];
|
||||
$type = $this->attribute_type[$key];
|
||||
$list = $this->attribute_list[$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
|
||||
|
||||
@ -2347,7 +2347,7 @@ class Form
|
||||
$out .= img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
}
|
||||
$out .= '<input type="text" class="minwidth100" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
|
||||
$out .= '<input type="text" class="minwidth100'.($morecss ? ' '.$morecss : '').'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->PRODUCT_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
|
||||
if ($hidelabel == 3) {
|
||||
$out .= img_picto($langs->trans("Search"), 'search');
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ class FormAdmin
|
||||
|
||||
// If the language to select is not inside the list of available language and empty value is not available, we must find
|
||||
// an alternative as the language code to pre-select (to avoid to have first element in list pre-selected).
|
||||
if ($selected && !in_array($selected, $langs_available) && empty($showempty)) {
|
||||
if ($selected && !array_key_exists($selected, $langs_available) && empty($showempty)) {
|
||||
$tmparray = explode('_', $selected);
|
||||
if (!empty($tmparray[1])) {
|
||||
$selected = getLanguageCodeFromCountryCode($tmparray[1]);
|
||||
|
||||
@ -761,7 +761,7 @@ class FormFile
|
||||
$arraykeys = array_keys($modellist);
|
||||
$modelselected = $arraykeys[0];
|
||||
}
|
||||
$morecss = 'maxwidth200';
|
||||
$morecss = 'minwidth75 maxwidth200';
|
||||
if ($conf->browser->layout == 'phone') {
|
||||
$morecss = 'maxwidth100';
|
||||
}
|
||||
@ -1646,6 +1646,7 @@ class FormFile
|
||||
print '</tr>'."\n";
|
||||
|
||||
// To show ref or specific information according to view to show (defined by $module)
|
||||
$object_instance = null;
|
||||
if ($modulepart == 'company') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
$object_instance = new Societe($this->db);
|
||||
@ -1813,21 +1814,26 @@ class FormFile
|
||||
if (!$id && !$ref) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$found = 0;
|
||||
if (!empty($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) {
|
||||
$found = 1;
|
||||
} else {
|
||||
//print 'Fetch '.$id." - ".$ref.' class='.get_class($object_instance).'<br>';
|
||||
|
||||
if ($id) {
|
||||
$result = $object_instance->fetch($id);
|
||||
} else {
|
||||
//fetchOneLike looks for objects with wildcards in its reference.
|
||||
//It is useful for those masks who get underscores instead of their actual symbols
|
||||
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
|
||||
//that's why we look only into fetchOneLike when fetch returns 0
|
||||
if (!$result = $object_instance->fetch('', $ref)) {
|
||||
$result = $object_instance->fetchOneLike($ref);
|
||||
$result = 0;
|
||||
if (is_object($object_instance)) {
|
||||
if ($id) {
|
||||
$result = $object_instance->fetch($id);
|
||||
} else {
|
||||
if (!($result = $object_instance->fetch('', $ref))) {
|
||||
//fetchOneLike looks for objects with wildcards in its reference.
|
||||
//It is useful for those masks who get underscores instead of their actual symbols (because the _ had replaced a forbiddn char)
|
||||
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
|
||||
//that's why we look only into fetchOneLike when fetch returns 0
|
||||
// TODO Remove this part ?
|
||||
$result = $object_instance->fetchOneLike($ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -213,7 +213,7 @@ class FormMargin
|
||||
|
||||
$marginInfo = $this->getMarginInfosArray($object, $force_price);
|
||||
|
||||
$parameters=array('marginInfo'=>$marginInfo);
|
||||
$parameters=array('marginInfo'=>&$marginInfo);
|
||||
$reshook = $hookmanager->executeHooks('displayMarginInfos', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
@ -57,13 +57,14 @@ class FormOther
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML code for scanner tool.
|
||||
* Return the HTML code for scanner tool.
|
||||
* This must be called into an existing <form>
|
||||
*
|
||||
* @param string $jstoexecuteonadd Name of javascript function to call
|
||||
* @param string $jstoexecuteonadd Name of javascript function to call once the barcode scanning session is complete and user has click on "Add".
|
||||
* @param string $mode 'all' (both product and lot barcode) or 'product' (product barcode only) or 'lot' (lot number only)
|
||||
* @return string HTML component
|
||||
*/
|
||||
public function getHTMLScannerForm($jstoexecuteonadd = 'barcodescannerjs')
|
||||
public function getHTMLScannerForm($jstoexecuteonadd = 'barcodescannerjs', $mode = 'all')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -71,17 +72,23 @@ class FormOther
|
||||
|
||||
$out .= '<!-- Popup for mass barcode scanning -->'."\n";
|
||||
$out .= '<div class="div-for-modal-topright" style="padding: 15px">';
|
||||
$out .= '<center><strong>Barcode scanner tool...</strong></center><br>';
|
||||
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforautodetect" checked="checked"> Autodetect if we scan a product barcode or a lot/serial barcode<br>';
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforproduct"> Scan a product barcode<br>';
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforlotserial"> Scan a product lot or serial number<br>';
|
||||
$out .= '<center>'.img_picto('', 'barcode', 'class="pictofixedwidth"').'<strong>Barcode scanner tool...</strong></center><br>';
|
||||
|
||||
if ($mode == 'product') {
|
||||
$out .= '<input type="hidden" name="barcodemode" value="barcodeforproduct" id="barcodeforproduct">';
|
||||
} elseif ($mode == 'lot') {
|
||||
$out .= '<input type="hidden" name="barcodemode" value="barcodeforlotserial" id="barcodeforlotserial">';
|
||||
} else { // $mode = 'all'
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforautodetect" id="barcodeforautodetect" checked="checked"> <label for="barcodeforautodetect">Autodetect if we scan a product barcode or a lot/serial barcode</label><br>';
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforproduct" id="barcodeforproduct"> <label for="barcodeforproduct">Scan a product barcode</label><br>';
|
||||
$out .= '<input type="radio" name="barcodemode" value="barcodeforlotserial" id="barcodeforlotserial"> <label for="barcodeforlotserial">Scan a product lot or serial number</label><br>';
|
||||
}
|
||||
$stringaddbarcode = $langs->trans("QtyToAddAfterBarcodeScan", "tmphtml");
|
||||
$htmltoreplaceby = '<select name="selectaddorreplace"><option selected value="add">'.$langs->trans("Add").'</option><option value="replace">'.$langs->trans("ToReplace").'</option></select>';
|
||||
$stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode);
|
||||
$out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
|
||||
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'"></textarea>';
|
||||
$out .= '<br>';
|
||||
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'" placeholder="'.dol_escape_htmltag($langs->trans("ScanOrTypeOrCopyPasteYouBarCode")).'"></textarea>';
|
||||
|
||||
/*print '<br>'.$langs->trans("or").'<br>';
|
||||
|
||||
@ -91,14 +98,21 @@ class FormOther
|
||||
*/
|
||||
$out .= '<br>';
|
||||
$out .= '<center>';
|
||||
$out .= '<input type="submit" class="button marginleftonly marginrightonly" id ="exec'.dol_escape_js($jstoexecuteonadd).'" name="addscan" value="'.$langs->trans("Add").'">';
|
||||
$out .= '<input type="submit" class="button marginleftonly marginrightonly" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
$out .= '<input type="submit" class="button marginleftonly marginrightonly" id ="exec'.dol_escape_js($jstoexecuteonadd).'" name="addscan" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
|
||||
$out .= '<input type="submit" class="button marginleftonly marginrightonly" name="cancel" value="'.dol_escape_htmltag($langs->trans("CloseWindow")).'">';
|
||||
$out .= '</center>';
|
||||
$out .= '<br>';
|
||||
$out .= '<div type="text" id="scantoolmessage" class="scantoolmessage ok nopadding"></div>';
|
||||
|
||||
$out .= '<script>';
|
||||
$out .= 'jQuery("#barcodeforautodetect, #barcodeforproduct, #barcodeforlotserial").click(function(){';
|
||||
$out .= 'console.log("select choice");';
|
||||
$out .= 'jQuery("#scantoolmessage").text("");';
|
||||
$out .= '});'."\n";
|
||||
$out .= '$("#exec'.dol_escape_js($jstoexecuteonadd).'").click(function(){
|
||||
console.log("We call js to execute '.dol_escape_js($jstoexecuteonadd).'");
|
||||
'.dol_escape_js($jstoexecuteonadd).'();
|
||||
return false; /* We want to stay on the scan tool */
|
||||
})';
|
||||
$out .= '</script>';
|
||||
|
||||
|
||||
@ -44,6 +44,41 @@ class FormSetup
|
||||
/** @var int */
|
||||
protected $maxItemRank;
|
||||
|
||||
/**
|
||||
* this is an html string display before output form
|
||||
* @var string
|
||||
*/
|
||||
public $htmlBeforeOutputForm = '';
|
||||
|
||||
/**
|
||||
* this is an html string display after output form
|
||||
* @var string
|
||||
*/
|
||||
public $htmlAfterOutputForm = '';
|
||||
|
||||
/**
|
||||
* this is an html string display on buttons zone
|
||||
* @var string
|
||||
*/
|
||||
public $htmlOutputMoreButton = '';
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $formAttributes = array(
|
||||
'action' => '', // set in __construct
|
||||
'method' => 'POST'
|
||||
);
|
||||
|
||||
/**
|
||||
* an list of hidden inputs used only in edit mode
|
||||
* @var array
|
||||
*/
|
||||
public $formHiddenInputs = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -55,6 +90,11 @@ class FormSetup
|
||||
global $langs;
|
||||
$this->db = $db;
|
||||
$this->form = new Form($this->db);
|
||||
$this->formAttributes['action'] = $_SERVER["PHP_SELF"];
|
||||
|
||||
$this->formHiddenInputs['token'] = newToken();
|
||||
$this->formHiddenInputs['action'] = 'update';
|
||||
|
||||
|
||||
if ($outputLangs) {
|
||||
$this->langs = $outputLangs;
|
||||
@ -64,8 +104,32 @@ class FormSetup
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $editMode true will display output on edit mod
|
||||
* @return string
|
||||
* Generate an attributes string form an input array
|
||||
*
|
||||
* @param array $attributes an array of attributes keys and values,
|
||||
* @return string attribute string
|
||||
*/
|
||||
static public function generateAttributesStringFromArray($attributes)
|
||||
{
|
||||
$Aattr = array();
|
||||
if (is_array($attributes)) {
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
if (is_array($value) || is_object($value)) {
|
||||
continue;
|
||||
}
|
||||
$Aattr[] = $attribute.'="'.dol_escape_htmltag($value).'"';
|
||||
}
|
||||
}
|
||||
|
||||
return !empty($Aattr)?implode(' ', $Aattr):'';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* generateOutput
|
||||
*
|
||||
* @param bool $editMode true will display output on edit mod
|
||||
* @return string html output
|
||||
*/
|
||||
public function generateOutput($editMode = false)
|
||||
{
|
||||
@ -83,12 +147,72 @@ class FormSetup
|
||||
if ($reshook > 0) {
|
||||
return $hookmanager->resPrint;
|
||||
} else {
|
||||
$out = '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
$out = '<!-- Start generateOutput from FormSetup class -->';
|
||||
$out.= $this->htmlBeforeOutputForm;
|
||||
|
||||
if ($editMode) {
|
||||
$out .= '<input type="hidden" name="action" value="update">';
|
||||
$out.= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';
|
||||
|
||||
// generate hidden values from $this->formHiddenInputs
|
||||
if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) {
|
||||
foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) {
|
||||
$out.= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$out .= '<table class="noborder centpercent">';
|
||||
// generate output table
|
||||
$out .= $this->generateTableOutput($editMode);
|
||||
|
||||
|
||||
$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateOutputButton', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($reshook > 0) {
|
||||
return $hookmanager->resPrint;
|
||||
} elseif ($editMode) {
|
||||
$out .= '<br>'; // Todo : remove this <br/> by adding style to form-setup-button-container css class in all themes
|
||||
$out .= '<div class="form-setup-button-container center">'; // Todo : remove .center by adding style to form-setup-button-container css class in all themes
|
||||
$out.= $this->htmlOutputMoreButton;
|
||||
$out .= '<input class="button button-save" type="submit" value="' . $this->langs->trans("Save") . '">'; // Todo fix dolibarr style for <button and use <button instead of input
|
||||
$out .= '</div>';
|
||||
}
|
||||
|
||||
if ($editMode) {
|
||||
$out .= '</form>';
|
||||
}
|
||||
|
||||
$out.= $this->htmlAfterOutputForm;
|
||||
|
||||
return $out;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* generateTableOutput
|
||||
*
|
||||
* @param bool $editMode true will display output on edit mod
|
||||
* @return string html output
|
||||
*/
|
||||
public function generateTableOutput($editMode = false)
|
||||
{
|
||||
global $hookmanager, $action;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
$parameters = array(
|
||||
'editMode' => $editMode
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateTableOutput', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($reshook > 0) {
|
||||
return $hookmanager->resPrint;
|
||||
} else {
|
||||
$out = '<table class="noborder centpercent">';
|
||||
$out .= '<thead>';
|
||||
$out .= '<tr class="liste_titre">';
|
||||
$out .= ' <td class="titlefield">' . $this->langs->trans("Parameter") . '</td>';
|
||||
@ -111,12 +235,13 @@ class FormSetup
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $noMessageInUpdate display event message on errors and success
|
||||
* @return void|null
|
||||
* saveConfFromPost
|
||||
*
|
||||
* @param bool $noMessageInUpdate display event message on errors and success
|
||||
* @return void|null
|
||||
*/
|
||||
public function saveConfFromPost($noMessageInUpdate = false)
|
||||
{
|
||||
|
||||
if (empty($this->items)) {
|
||||
return null;
|
||||
}
|
||||
@ -147,9 +272,11 @@ class FormSetup
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormSetupItem $item the setup item
|
||||
* @param bool $editMode Display as edit mod
|
||||
* @return string the html output for an setup item
|
||||
* generateLineOutput
|
||||
*
|
||||
* @param FormSetupItem $item the setup item
|
||||
* @param bool $editMode Display as edit mod
|
||||
* @return string the html output for an setup item
|
||||
*/
|
||||
public function generateLineOutput($item, $editMode = false)
|
||||
{
|
||||
@ -187,8 +314,9 @@ class FormSetup
|
||||
|
||||
|
||||
/**
|
||||
* @param array $params an array of arrays of params from old modulBuilder params
|
||||
* @deprecated was used to test module builder convertion to this form usage
|
||||
* Method used to test module builder convertion to this form usage
|
||||
*
|
||||
* @param array $params an array of arrays of params from old modulBuilder params
|
||||
* @return null
|
||||
*/
|
||||
public function addItemsFromParamsArray($params)
|
||||
@ -202,10 +330,11 @@ class FormSetup
|
||||
|
||||
/**
|
||||
* From old
|
||||
* @param string $confKey the conf name to store
|
||||
* @param array $params an array of params from old modulBuilder params
|
||||
* @deprecated was used to test module builder convertion to this form usage
|
||||
* @return bool
|
||||
* Method was used to test module builder convertion to this form usage.
|
||||
*
|
||||
* @param string $confKey the conf name to store
|
||||
* @param array $params an array of params from old modulBuilder params
|
||||
* @return bool
|
||||
*/
|
||||
public function addItemFromParams($confKey, $params)
|
||||
{
|
||||
@ -240,14 +369,15 @@ class FormSetup
|
||||
}
|
||||
|
||||
/**
|
||||
* used to export param array for /core/actions_setmoduleoptions.inc.php template
|
||||
* Used to export param array for /core/actions_setmoduleoptions.inc.php template
|
||||
* Method exists only for manage setup convertion
|
||||
*
|
||||
* @return array $arrayofparameters for /core/actions_setmoduleoptions.inc.php
|
||||
* @deprecated yes this method came deprecated because it exists only for manage setup convertion
|
||||
*/
|
||||
public function exportItemsAsParamsArray()
|
||||
{
|
||||
$arrayofparameters = array();
|
||||
foreach ($this->items as $key => $item) {
|
||||
foreach ($this->items as $item) {
|
||||
$arrayofparameters[$item->confKey] = array(
|
||||
'type' => $item->getType(),
|
||||
'enabled' => $item->enabled
|
||||
@ -260,6 +390,7 @@ class FormSetup
|
||||
/**
|
||||
* Reload for each item default conf
|
||||
* note: this will override custom configuration
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function reloadConfs()
|
||||
@ -277,9 +408,10 @@ class FormSetup
|
||||
/**
|
||||
* Create a new item
|
||||
* the tagret is useful with hooks : that allow externals modules to add setup items on good place
|
||||
* @param $confKey the conf key used in database
|
||||
* @param string $targetItemKey target item used to place the new item beside
|
||||
* @param bool $insertAfterTarget insert before or after target item ?
|
||||
*
|
||||
* @param string $confKey the conf key used in database
|
||||
* @param string $targetItemKey target item used to place the new item beside
|
||||
* @param bool $insertAfterTarget insert before or after target item ?
|
||||
* @return FormSetupItem the new setup item created
|
||||
*/
|
||||
public function newItem($confKey, $targetItemKey = false, $insertAfterTarget = false)
|
||||
@ -317,6 +449,7 @@ class FormSetup
|
||||
|
||||
/**
|
||||
* Sort items according to rank
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sortingItems()
|
||||
@ -326,6 +459,8 @@ class FormSetup
|
||||
}
|
||||
|
||||
/**
|
||||
* getCurentItemMaxRank
|
||||
*
|
||||
* @param bool $cache To use cache or not
|
||||
* @return int
|
||||
*/
|
||||
@ -350,8 +485,9 @@ class FormSetup
|
||||
|
||||
/**
|
||||
* set new max rank if needed
|
||||
* @param int $rank the item rank
|
||||
* @return int|void
|
||||
*
|
||||
* @param int $rank the item rank
|
||||
* @return int|void new max rank
|
||||
*/
|
||||
public function setItemMaxRank($rank)
|
||||
{
|
||||
@ -360,10 +496,10 @@ class FormSetup
|
||||
|
||||
|
||||
/**
|
||||
* get item position rank from item key
|
||||
* get item position rank from item key
|
||||
*
|
||||
* @param string $itemKey the item key
|
||||
* @return int rank on success and -1 on error
|
||||
* @param string $itemKey the item key
|
||||
* @return int rank on success and -1 on error
|
||||
*/
|
||||
public function getLineRank($itemKey)
|
||||
{
|
||||
@ -379,7 +515,7 @@ class FormSetup
|
||||
*
|
||||
* @param FormSetupItem $a formSetup item
|
||||
* @param FormSetupItem $b formSetup item
|
||||
* @return int Return compare result
|
||||
* @return int Return compare result
|
||||
*/
|
||||
public function itemSort(FormSetupItem $a, FormSetupItem $b)
|
||||
{
|
||||
@ -554,7 +690,7 @@ class FormSetupItem
|
||||
*/
|
||||
public function generateInputField()
|
||||
{
|
||||
global $conf, $user;
|
||||
global $conf;
|
||||
|
||||
if (!empty($this->fieldOverride)) {
|
||||
return $this->fieldOverride;
|
||||
|
||||
@ -108,7 +108,9 @@ class Notify
|
||||
global $conf, $langs;
|
||||
$langs->load("mails");
|
||||
|
||||
// Get full list of all notifications subscribed for $action, $socid and $object
|
||||
$listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
|
||||
|
||||
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
|
||||
foreach ($listofnotiftodo as $val) {
|
||||
if ($val['type'] == 'touser') {
|
||||
@ -117,6 +119,14 @@ class Notify
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT)) {
|
||||
foreach ($listofnotiftodo as $val) {
|
||||
if ($val['type'] == 'tocontact') {
|
||||
unset($listofnotiftodo[$val['email']]);
|
||||
//$listofnotiftodo = array_merge($listofnotiftodo);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
|
||||
foreach ($listofnotiftodo as $val) {
|
||||
if ($val['type'] == 'tofixedemail') {
|
||||
|
||||
@ -227,7 +227,7 @@ interface Database
|
||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @param int $result_mode Result mode
|
||||
* @return resource Resultset of answer
|
||||
* @return bool|resource Resultset of answer or false
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0);
|
||||
|
||||
|
||||
@ -495,7 +495,7 @@ class DoliDBPgsql extends DoliDB
|
||||
* @param int $usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @param int $result_mode Result mode (not used with pgsql)
|
||||
* @return false|resource Resultset of answer
|
||||
* @return bool|resource Resultset of answer
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
|
||||
{
|
||||
|
||||
@ -394,7 +394,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||
* @param int $result_mode Result mode (not used with sqlite)
|
||||
* @return SQLite3Result Resultset of answer
|
||||
* @return bool|SQLite3Result Resultset of answer
|
||||
*/
|
||||
public function query($query, $usesavepoint = 0, $type = 'auto', $result_mode = 0)
|
||||
{
|
||||
@ -407,6 +407,7 @@ class DoliDBSqlite3 extends DoliDB
|
||||
$this->error = '';
|
||||
|
||||
// Convert MySQL syntax to SQLite syntax
|
||||
$reg = array();
|
||||
if (preg_match('/ALTER\s+TABLE\s*(.*)\s*ADD\s+CONSTRAINT\s+(.*)\s*FOREIGN\s+KEY\s*\(([\w,\s]+)\)\s*REFERENCES\s+(\w+)\s*\(([\w,\s]+)\)/i', $query, $reg)) {
|
||||
// Ajout d'une clef étrangère à la table
|
||||
// procédure de remplacement de la table pour ajouter la contrainte
|
||||
|
||||
@ -277,7 +277,9 @@ function checkIbanForAccount($account)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
||||
|
||||
$iban = new IBAN($account->iban);
|
||||
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
|
||||
|
||||
$iban = new IBAN($ibantocheck);
|
||||
$check = $iban->Verify();
|
||||
|
||||
if ($check) {
|
||||
|
||||
@ -2104,7 +2104,7 @@ function addMailingEventTypeSQL($actioncode, $objcon, $filterobj)
|
||||
$langs->load("mails");
|
||||
|
||||
$sql2 = "SELECT m.rowid as id, m.titre as label, mc.date_envoi as dp, mc.date_envoi as dp2, '100' as percent, 'mailing' as type";
|
||||
$sql2 .= ", '' as fk_element, '' as elementtype, '' as contact_id";
|
||||
$sql2 .= ", null as fk_element, '' as elementtype, null as contact_id";
|
||||
$sql2 .= ", 'AC_EMAILING' as acode, '' as alabel, '' as apicto";
|
||||
$sql2 .= ", u.rowid as user_id, u.login as user_login, u.photo as user_photo, u.firstname as user_firstname, u.lastname as user_lastname"; // User that valid action
|
||||
if (is_object($filterobj) && get_class($filterobj) == 'Societe') {
|
||||
|
||||
@ -838,7 +838,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
|
||||
// We should also exclude non expected HTML attributes and clean content of some attributes.
|
||||
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
|
||||
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
|
||||
$out = trim(dol_string_onlythesehtmlattributes($out));
|
||||
$out = dol_string_onlythesehtmlattributes($out);
|
||||
}
|
||||
|
||||
// Restore entity ' into ' (restricthtml is for html content so we can use html entity)
|
||||
@ -3626,7 +3626,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
$pictowithouttext = str_replace('object_', '', $pictowithouttext);
|
||||
if (empty($srconly) && in_array($pictowithouttext, array(
|
||||
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
|
||||
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'accountancy', 'accounting_account', 'account', 'accountline', 'action', 'add', 'address', 'angle-double-down', 'angle-double-up', 'asset',
|
||||
'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'bug', 'building',
|
||||
'calendar', 'calendarmonth', 'calendarweek', 'calendarday', 'calendarperuser', 'calendarpertype',
|
||||
'cash-register', 'category', 'chart', 'check', 'clock', 'close_title', 'cog', 'collab', 'company', 'contact', 'country', 'contract', 'conversation', 'cron', 'cubes',
|
||||
@ -3667,7 +3667,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
|
||||
$arrayconvpictotofa = array(
|
||||
'account'=>'university', 'accountline'=>'receipt', 'accountancy'=>'search-dollar', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', 'asset'=>'money-check-alt', 'autofill'=>'fill',
|
||||
'account'=>'university', 'accounting_account'=>'clipboard-list', 'accountline'=>'receipt', 'accountancy'=>'search-dollar', 'action'=>'calendar-alt', 'add'=>'plus-circle', 'address'=> 'address-book', 'asset'=>'money-check-alt', 'autofill'=>'fill',
|
||||
'bank_account'=>'university',
|
||||
'bill'=>'file-invoice-dollar', 'billa'=>'file-excel', 'billr'=>'file-invoice-dollar', 'billd'=>'file-medical',
|
||||
'supplier_invoice'=>'file-invoice-dollar', 'supplier_invoicea'=>'file-excel', 'supplier_invoicer'=>'file-invoice-dollar', 'supplier_invoiced'=>'file-medical',
|
||||
@ -3755,7 +3755,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
|
||||
// Add CSS
|
||||
$arrayconvpictotomorcess = array(
|
||||
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account',
|
||||
'action'=>'infobox-action', 'account'=>'infobox-bank_account', 'accounting_account'=>'infobox-bank_account', 'accountline'=>'infobox-bank_account', 'accountancy'=>'infobox-bank_account', 'asset'=>'infobox-bank_account',
|
||||
'bank_account'=>'bg-infobox-bank_account',
|
||||
'bill'=>'infobox-commande', 'billa'=>'infobox-commande', 'billr'=>'infobox-commande', 'billd'=>'infobox-commande',
|
||||
'margin'=>'infobox-bank_account', 'conferenceorbooth'=>'infobox-project',
|
||||
@ -5396,7 +5396,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
} elseif ($rounding == 'MT') {
|
||||
$nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
} elseif ($rounding == 'MS') {
|
||||
$nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
|
||||
$nbofdectoround = isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? $conf->global->MAIN_MAX_DECIMALS_STOCK : 5;
|
||||
} elseif ($rounding == 'CU') {
|
||||
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency
|
||||
} elseif ($rounding == 'CT') {
|
||||
@ -5404,6 +5404,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
} elseif (is_numeric($rounding)) {
|
||||
$nbofdectoround = (int) $rounding;
|
||||
}
|
||||
|
||||
//print " RR".$amount.' - '.$nbofdectoround.'<br>';
|
||||
if (dol_strlen($nbofdectoround)) {
|
||||
$amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
|
||||
@ -6458,7 +6459,8 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
|
||||
/**
|
||||
* Clean a string from some undesirable HTML tags.
|
||||
* Note. Not as secured as dol_string_onlythesehtmltags().
|
||||
* Note: Complementary to dol_string_onlythesehtmltags().
|
||||
* This method is used for example when option MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES is set to 1.
|
||||
*
|
||||
* @param string $stringtoclean String to clean
|
||||
* @param array $allowed_attributes Array of tags not allowed
|
||||
@ -6469,10 +6471,11 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
|
||||
function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes = array("allow", "allowfullscreen", "alt", "class", "contenteditable", "data-html", "frameborder", "height", "href", "id", "name", "src", "style", "target", "title", "width"))
|
||||
{
|
||||
if (class_exists('DOMDocument') && !empty($stringtoclean)) {
|
||||
$stringtoclean = '<html><body>'.$stringtoclean.'</body></html>';
|
||||
$stringtoclean = '<?xml encoding="UTF-8"><html><body>'.$stringtoclean.'</body></html>';
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom = new DOMDocument(null, 'UTF-8');
|
||||
$dom->loadHTML($stringtoclean, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL);
|
||||
|
||||
if (is_object($dom)) {
|
||||
for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) {
|
||||
for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) {
|
||||
@ -6505,9 +6508,10 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
|
||||
$return = $dom->saveHTML();
|
||||
//$return = '<html><body>aaaa</p>bb<p>ssdd</p>'."\n<p>aaa</p>aa<p>bb</p>";
|
||||
|
||||
$return = preg_replace('/^<html><body>/', '', $return);
|
||||
$return = preg_replace('/<\/body><\/html>$/', '', $return);
|
||||
return $return;
|
||||
$return = preg_replace('/^'.preg_quote('<?xml encoding="UTF-8">', '/').'/', '', $return);
|
||||
$return = preg_replace('/^'.preg_quote('<html><body>', '/').'/', '', $return);
|
||||
$return = preg_replace('/'.preg_quote('</body></html>', '/').'$/', '', $return);
|
||||
return trim($return);
|
||||
} else {
|
||||
return $stringtoclean;
|
||||
}
|
||||
|
||||
@ -35,6 +35,8 @@
|
||||
* \ingroup core
|
||||
*/
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/signature.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations.
|
||||
@ -707,9 +709,12 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
|
||||
|
||||
// Add a background image on document only if good setup of const
|
||||
if (!empty($conf->global->MAIN_USE_BACKGROUND_ON_PDF) && ($conf->global->MAIN_USE_BACKGROUND_ON_PDF != '-1')) { // Warning, this option make TCPDF generation being crazy and some content disappeared behind the image
|
||||
$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
|
||||
$pdf->SetAutoPageBreak(1, 0); // Restore pagebreak
|
||||
$filepath = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF;
|
||||
if (file_exists($filepath)) {
|
||||
$pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image
|
||||
$pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height);
|
||||
$pdf->SetAutoPageBreak(1, 0); // Restore pagebreak
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2130,9 +2135,9 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
||||
return '';
|
||||
}
|
||||
if (empty($hidedetails) || $hidedetails > 1) {
|
||||
if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) {
|
||||
if (!empty($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)) {
|
||||
$prev_progress = 0;
|
||||
if (method_exists($object, 'get_prev_progress')) {
|
||||
if (method_exists($object->lines[$i], 'get_prev_progress')) {
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
}
|
||||
$result = round($object->lines[$i]->situation_percent - $prev_progress, 1).'%';
|
||||
|
||||
@ -270,6 +270,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
||||
$features = 'produit';
|
||||
}
|
||||
|
||||
|
||||
// Get more permissions checks from hooks
|
||||
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
|
||||
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Return string with full Url
|
||||
* Return string with full online Url to accept and sign a quote
|
||||
*
|
||||
* @param string $type Type of URL ('proposal', ...)
|
||||
* @param string $ref Ref of object
|
||||
@ -58,13 +58,27 @@ function showOnlineSignatureUrl($type, $ref)
|
||||
*/
|
||||
function getOnlineSignatureUrl($mode, $type, $ref = '')
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
global $conf, $db, $langs, $dolibarr_main_url_root;
|
||||
|
||||
$ref = str_replace(' ', '', $ref);
|
||||
$out = '';
|
||||
|
||||
// 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
|
||||
|
||||
$localorexternal = 1; // external
|
||||
|
||||
$urltouse = DOL_MAIN_URL_ROOT;
|
||||
if ($localorexternal) {
|
||||
$urltouse = $urlwithroot;
|
||||
}
|
||||
|
||||
$securekeyseed = $conf->global->PROPOSAL_ONLINE_SIGNATURE_SECURITY_TOKEN;
|
||||
|
||||
if ($type == 'proposal') {
|
||||
$out = DOL_MAIN_URL_ROOT.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<span style="color: #666666">' : '');
|
||||
$out = $urltouse.'/public/onlinesign/newonlinesign.php?source=proposal&ref='.($mode ? '<span style="color: #666666">' : '');
|
||||
if ($mode == 1) {
|
||||
$out .= 'proposal_ref';
|
||||
}
|
||||
@ -72,6 +86,12 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
|
||||
$out .= urlencode($ref);
|
||||
}
|
||||
$out .= ($mode ? '</span>' : '');
|
||||
if ($mode == 1) {
|
||||
$out .= "hash('".$securekeyseed."' + '".$type."' + proposal_ref)";
|
||||
} else {
|
||||
$out .= '&securekey='.dol_hash($securekeyseed.$type.$ref, '0');
|
||||
}
|
||||
/*
|
||||
if ($mode == 1) {
|
||||
$out .= '&hashp=<span style="color: #666666">hash_of_file</span>';
|
||||
} else {
|
||||
@ -94,13 +114,15 @@ function getOnlineSignatureUrl($mode, $type, $ref = '')
|
||||
} else {
|
||||
$out .= '&hashp='.$hashp;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// For multicompany
|
||||
/*
|
||||
if (!empty($out)) {
|
||||
$out .= "&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities
|
||||
}
|
||||
*/
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -283,6 +283,8 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)', __HANDLER__, 'left', 2420__+MAX_llx_menu__, 'accountancy', 'accountancy_dispatch_expensereport', 2400__+MAX_llx_menu__, '/accountancy/expensereport/index.php?mainmenu=accountancy&leftmenu=accountancy_dispatch_expensereport', 'ExpenseReportsVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 5, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2421__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/list.php?mainmenu=accountancy', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->expensereport->enabled && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS) && $leftmenu=="accountancy_dispatch_expensereport"', __HANDLER__, 'left', 2422__+MAX_llx_menu__, 'accountancy', '', 2420__+MAX_llx_menu__, '/accountancy/expensereport/lines.php?mainmenu=accountancy', 'Dispatched', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 7, __ENTITY__);
|
||||
-- Export accounting documents
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
||||
-- Journals
|
||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '', 'Journalization', 1, 'main', '$user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2705__+MAX_llx_menu__, '/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3', 'BankJournal', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__);
|
||||
@ -295,8 +297,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2432__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyaccount.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Bookkeeping', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__);
|
||||
-- Journals
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2434__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 2400__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?mainmenu=accountancy&leftmenu=accountancy_bookeeping', 'Journals', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 15, __ENTITY__);
|
||||
-- Export accounting documents
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2436__+MAX_llx_menu__, 'accountancy', 'accountancy_files', 2400__+MAX_llx_menu__, '/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files', 'AccountantFiles', 1, 'accountancy', '$user->rights->compta->resultat->lire || $user->rights->accounting->mouvements->lire', '', 0, 16, __ENTITY__);
|
||||
-- Closure
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2437__+MAX_llx_menu__, 'accountancy', 'accountancy_closure', 2400__+MAX_llx_menu__, '/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure', 'MenuAccountancyClosure', 1, 'accountancy', '$user->rights->accounting->fiscalyear->write', '', 0, 17, __ENTITY__);
|
||||
-- Reports
|
||||
|
||||
@ -1348,6 +1348,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
// Files
|
||||
if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) {
|
||||
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
|
||||
}
|
||||
|
||||
|
||||
// Accounting
|
||||
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_accountancy", $langs->trans("MenuAccountancy"), 0, $user->rights->accounting->mouvements->lire || $user->rights->accounting->comptarapport->lire, '', $mainmenu, 'accountancy', 1, '', '', '', img_picto('', 'accountancy', 'class="paddingright pictofixedwidth"'));
|
||||
|
||||
@ -1360,11 +1366,6 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
// Account Balance
|
||||
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
|
||||
|
||||
// Files
|
||||
if (empty($conf->global->ACCOUNTANCY_HIDE_EXPORT_FILES_MENU)) {
|
||||
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
|
||||
}
|
||||
|
||||
// Closure
|
||||
$newmenu->add("/accountancy/closure/index.php?mainmenu=accountancy&leftmenu=accountancy_closure", $langs->trans("MenuAccountancyClosure"), 1, $user->rights->accounting->fiscalyear->write, '', $mainmenu, 'closure');
|
||||
|
||||
@ -1618,7 +1619,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/product/card.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer);
|
||||
$newmenu->add("/product/list.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire);
|
||||
if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->facture->enabled) || (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_proposal->enabled) || !empty($conf->supplier_oder->enabled) || !empty($conf->supplier_invoice->enabled)) {
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire && $user->rights->propale->lire);
|
||||
$newmenu->add("/product/stats/card.php?id=all&leftmenu=stats&type=1", $langs->trans("Statistics"), 1, $user->rights->service->lire || $user->rights->product->lire);
|
||||
}
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
use Stripe\BankAccount;
|
||||
|
||||
/* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
*
|
||||
@ -236,8 +238,15 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
$posY = $pdf->GetY();
|
||||
$posY += 2;
|
||||
$pdf->SetXY($this->marge_gauche, $posY);
|
||||
|
||||
$ics = '';
|
||||
if (!empty($conf->global->PRELEVEMENT_ICS)) {
|
||||
$idbankfordirectdebit = getDolGlobalInt('PRELEVEMENT_ID_BANKACCOUNT');
|
||||
if ($idbankfordirectdebit > 0) {
|
||||
$tmpbankfordirectdebit = new Account($this->db);
|
||||
$tmpbankfordirectdebit->fetch($idbankfordirectdebit);
|
||||
$ics = $tmpbankfordirectdebit->ics; // ICS for direct debit
|
||||
}
|
||||
if (empty($ics) && !empty($conf->global->PRELEVEMENT_ICS)) {
|
||||
$ics = $conf->global->PRELEVEMENT_ICS;
|
||||
}
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L');
|
||||
@ -251,7 +260,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
$posY += 1;
|
||||
$pdf->SetXY($this->marge_gauche, $posY);
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("Address").' : ', 0, 'L');
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(), 0, 'L');
|
||||
$pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $mysoc->getFullAddress(1), 0, 'L');
|
||||
|
||||
$posY = $pdf->GetY();
|
||||
$posY += 3;
|
||||
@ -304,7 +313,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
|
||||
$address = '______________________________________________';
|
||||
if ($thirdparty->id > 0) {
|
||||
$address = $thirdparty->getFullAddress();
|
||||
$tmpaddresswithoutcountry = $thirdparty->getFullAddress(); // we test on address without country
|
||||
if ($tmpaddresswithoutcountry) {
|
||||
$address = $thirdparty->getFullAddress(1); // full address
|
||||
}
|
||||
}
|
||||
$posY = $pdf->GetY();
|
||||
$posY += 1;
|
||||
@ -490,7 +502,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - $diffsizetitle);
|
||||
$pdf->MultiCell(100, 6, $mysoc->name, 0, 'L', 0);
|
||||
$pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress()), 0, 'L', 0);
|
||||
$pdf->MultiCell(100, 6, $outputlangs->convToOutputCharset($mysoc->getFullAddress(1)), 0, 'L', 0);
|
||||
$posy = $pdf->GetY() + 2;
|
||||
|
||||
return $posy;
|
||||
|
||||
@ -69,8 +69,8 @@ class modFckeditor extends DolibarrModules
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
$this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for description and note (except products/services)");
|
||||
$this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for products/services description and note");
|
||||
$this->const[0] = array("FCKEDITOR_ENABLE_SOCIETE", "yesno", "1", "WYSIWIG for the fields descriptions of elements (except products/services)");
|
||||
$this->const[1] = array("FCKEDITOR_ENABLE_PRODUCTDESC", "yesno", "1", "WYSIWIG for the fields description of products/services");
|
||||
$this->const[2] = array("FCKEDITOR_ENABLE_MAILING", "yesno", "1", "WYSIWIG for mass emailings");
|
||||
$this->const[3] = array("FCKEDITOR_ENABLE_DETAILS", "yesno", "1", "WYSIWIG for products details lines for all entities");
|
||||
$this->const[4] = array("FCKEDITOR_ENABLE_USERSIGN", "yesno", "1", "WYSIWIG for user signature");
|
||||
|
||||
@ -814,7 +814,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
$pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L');
|
||||
|
||||
// Show default IBAN account
|
||||
$sql = "SELECT iban_prefix";
|
||||
$sql = "SELECT iban_prefix as iban";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe_rib as rib";
|
||||
$sql .= " WHERE fk_soc = ".($object->thirdparty->id);
|
||||
$sql .= " AND rib.default_rib = 1";
|
||||
@ -823,7 +823,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$iban = $obj->iban_prefix;
|
||||
$iban = $obj->iban;
|
||||
}
|
||||
|
||||
if (!empty($iban)) {
|
||||
|
||||
@ -99,16 +99,26 @@ if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_
|
||||
} else {
|
||||
$typeofdata = 'textarea:12:95%';
|
||||
}
|
||||
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC)) {
|
||||
$typeofdatapub = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
} else {
|
||||
$typeofdatapub = 'textarea:12:95%';
|
||||
}
|
||||
if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_NOTE_PRIVATE)) {
|
||||
$typeofdatapriv = 'ckeditor:dolibarr_notes:100%:200::1:12:95%:0'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
} else {
|
||||
$typeofdatapriv = 'textarea:12:95%';
|
||||
}
|
||||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
print '<div class="tagtable border table-border tableforfield centpercent">'."\n";
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_public);
|
||||
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
|
||||
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam, 1)."\n";
|
||||
print $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdatapub, '', null, null, $moreparam, 1)."\n";
|
||||
print '</div>'."\n";
|
||||
print '</div>'."\n";
|
||||
if (empty($user->socid)) {
|
||||
@ -116,10 +126,10 @@ if (empty($user->socid)) {
|
||||
print '<div class="tagtr table-border-row">'."\n";
|
||||
$editmode = (GETPOST('action', 'aZ09') == 'edit'.$note_private);
|
||||
print '<div class="tagtd tagtdnote tdtop'.($editmode ? '' : ' sensiblehtmlcontent').' table-key-border-col'.(empty($cssclass) ? '' : ' '.$cssclass).'"'.($colwidth ? ' style="width: '.$colwidth.'%"' : '').'>'."\n";
|
||||
print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam, '', 0);
|
||||
print $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, $moreparam, '', 0);
|
||||
print '</div>'."\n";
|
||||
print '<div class="tagtd wordbreak table-val-border-col'.($editmode ? '' : ' sensiblehtmlcontent').'">'."\n";
|
||||
print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam, 1);
|
||||
print $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdatapriv, '', null, null, $moreparam, 1);
|
||||
print '</div>'."\n";
|
||||
print '</div>'."\n";
|
||||
}
|
||||
|
||||
@ -40,8 +40,8 @@ if (!isset($absolute_creditnote)) {
|
||||
}
|
||||
|
||||
// Relative and absolute discounts
|
||||
$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditRelativeDiscount").'</a>';
|
||||
$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("EditGlobalDiscounts").'</a>';
|
||||
$addrelativediscount = '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'&action=create&token='.newToken().'">'.$langs->trans("EditRelativeDiscount").'</a>';
|
||||
$addabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'&action=create&token='.newToken().'">'.$langs->trans("EditGlobalDiscounts").'</a>';
|
||||
$viewabsolutediscount = '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$thirdparty->id.'&backtopage='.$backtopage.'">'.$langs->trans("ViewAvailableGlobalDiscounts").'</a>';
|
||||
|
||||
$fixedDiscount = $thirdparty->remise_percent;
|
||||
|
||||
@ -128,8 +128,9 @@ class Donations extends DolibarrApi
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -144,8 +144,9 @@ class Shipments extends DolibarrApi
|
||||
}
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
@ -2094,8 +2094,23 @@ if ($action == 'create') {
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
$titlealt = '';
|
||||
if (!empty($conf->accounting->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php';
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$resaccountingaccount = $accountingaccount->fetch(0, $line->type_fees_accountancy_code, 1);
|
||||
//$titlealt .= '<span class="opacitymedium">';
|
||||
$titlealt .= $langs->trans("AccountancyCode").': ';
|
||||
if ($resaccountingaccount > 0) {
|
||||
$titlealt .= $accountingaccount->account_number;
|
||||
} else {
|
||||
$titlealt .= $langs->trans("NotFound");
|
||||
}
|
||||
//$titlealt .= '</span>';
|
||||
}
|
||||
|
||||
// Type of fee
|
||||
print '<td class="center">';
|
||||
print '<td class="center" title="'.dol_escape_htmltag($titlealt).'">';
|
||||
$labeltype = ($langs->trans(($line->type_fees_code)) == $line->type_fees_code ? $line->type_fees_libelle : $langs->trans($line->type_fees_code));
|
||||
print $labeltype;
|
||||
print '</td>';
|
||||
@ -2109,8 +2124,10 @@ if ($action == 'create') {
|
||||
|
||||
// Comment
|
||||
print '<td class="left">'.dol_nl2br($line->comments).'</td>';
|
||||
|
||||
// VAT rate
|
||||
print '<td class="right">'.vatrate($line->vatrate.($line->vat_src_code ? ' ('.$line->vat_src_code.')' : ''), true).'</td>';
|
||||
|
||||
// Unit price HT
|
||||
print '<td class="right">';
|
||||
if (!empty($line->value_unit_ht)) {
|
||||
|
||||
@ -117,8 +117,9 @@ class ExpenseReports extends DolibarrApi
|
||||
|
||||
// Add sql filters
|
||||
if ($sqlfilters) {
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters);
|
||||
$errormessage = '';
|
||||
if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
|
||||
throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
|
||||
}
|
||||
$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
|
||||
$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user