Merge branch 'develop' of https://github.com/Dolibarr/dolibarr.git into dev_resource_extrafields
This commit is contained in:
commit
5f3eb9097e
@ -164,10 +164,14 @@ class Skeleton_Class extends CommonObject
|
||||
$sql .= ' t.field2';
|
||||
//...
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")";
|
||||
}
|
||||
if (null !== $ref) {
|
||||
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
|
||||
$sql .= ' AND t.ref = ' . '\'' . $ref . '\'';
|
||||
} else {
|
||||
$sql .= ' WHERE t.rowid = ' . $id;
|
||||
$sql .= ' AND t.rowid = ' . $id;
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -236,16 +240,20 @@ class Skeleton_Class extends CommonObject
|
||||
$sqlwhere [] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("skeleton", 1) . ")";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield,$sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -491,7 +499,7 @@ class Skeleton_Class extends CommonObject
|
||||
* Return the status
|
||||
*
|
||||
* @param int $status Id status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
static function LibStatut($status,$mode=0)
|
||||
@ -529,6 +537,11 @@ class Skeleton_Class extends CommonObject
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
if ($mode == 6)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4');
|
||||
if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ if (! $user->rights->accounting->bind->write)
|
||||
accessforbidden();
|
||||
|
||||
// search & action GETPOST
|
||||
$action = GETPOST('action');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$codeventil_buy = GETPOST('codeventil_buy', 'array');
|
||||
$codeventil_sell = GETPOST('codeventil_sell', 'array');
|
||||
$chk_prod = GETPOST('chk_prod', 'array');
|
||||
@ -65,28 +65,34 @@ $accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||
$btn_changeaccount = GETPOST('changeaccount');
|
||||
$btn_changetype = GETPOST('changetype');
|
||||
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
if ($page < 0)
|
||||
$page = 0;
|
||||
$limit = GETPOST("limit")?GETPOST("limit","int"):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if ($page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
// bug in page limit if ACCOUNTING_LIMIT_LIST_VENTILATION < $conf->liste_limit there is no pagination displayed !
|
||||
if (! empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) && $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION >= $conf->liste_limit) {
|
||||
$limit = $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION;
|
||||
} else {
|
||||
$limit = GETPOST('limit') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
}
|
||||
$offset = $limit * $page;
|
||||
if (! $sortfield) $sortfield="p.ref";
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
|
||||
if (! $sortfield) {
|
||||
$sortfield = "p.ref";
|
||||
if (empty($action)) $action='list';
|
||||
|
||||
$arrayfields=array();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
}
|
||||
if (! $sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
|
||||
// Sales or Purchase mode ?
|
||||
if ($action == 'update') {
|
||||
if (! empty($btn_changetype)) {
|
||||
@ -158,6 +164,12 @@ if ($action == 'update') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new FormVentilation($db);
|
||||
|
||||
// Defaut AccountingAccount RowId Product / Service
|
||||
@ -175,44 +187,13 @@ $aacompta_prodbuy = (! empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $c
|
||||
$aacompta_servsell = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
$aacompta_prodsell = (! empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
||||
|
||||
// Purge search criteria
|
||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_label = '';
|
||||
$search_desc = '';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ProductsBinding"));
|
||||
|
||||
print '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(\'#select-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = true;
|
||||
});
|
||||
});
|
||||
$(\'#unselect-all\').click(function(event) {
|
||||
// Iterate each checkbox
|
||||
$(\':checkbox\').each(function() {
|
||||
this.checked = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT p.rowid, p.ref, p.label, p.description , p.accountancy_code_sell, p.accountancy_code_buy, p.tms, p.fk_product_type as product_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p";
|
||||
$sql .= " WHERE (";
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$sql .= " p.accountancy_code_buy ='' OR p.accountancy_code_buy IS NULL";
|
||||
$sql .= " OR (p.accountancy_code_buy IS NOT NULL AND p.accountancy_code_buy != '' AND p.accountancy_code_buy NOT IN
|
||||
@ -222,39 +203,58 @@ if ($accounting_product_mode == 'ACCOUNTANCY_BUY' ? ' checked' : '') {
|
||||
$sql .= " OR (p.accountancy_code_sell IS NOT NULL AND p.accountancy_code_sell != '' AND p.accountancy_code_sell NOT IN
|
||||
(SELECT aa.account_number FROM " . MAIN_DB_PREFIX . "accounting_account as aa , " . MAIN_DB_PREFIX . "accounting_system as asy WHERE fk_pcg_version = asy.pcg_version AND asy.rowid = " . $pcgver . "))";
|
||||
}
|
||||
|
||||
$sql .= ")";
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql.= ' AND p.entity IN ('.getEntity('product', 1).')';
|
||||
}
|
||||
// Add search filter like
|
||||
if (strlen(trim($search_ref))) {
|
||||
$sql .= " AND (p.ref like '" . $search_ref . "%')";
|
||||
$sql .= natural_search("p.ref",$search_ref);
|
||||
}
|
||||
if (strlen(trim($search_label))) {
|
||||
$sql .= " AND (p.label like '" . $search_label . "%')";
|
||||
$sql .= natural_search("p.label",$search_label);
|
||||
}
|
||||
if (strlen(trim($search_desc))) {
|
||||
$sql .= " AND (p.description like '%" . $search_desc . "%')";
|
||||
$sql .= natural_search("p.description",$search_desc);
|
||||
}
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
}
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
dol_syslog("/accountancy/admin/productaccount.php:: sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num_lines = $db->num_rows($result);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_ref > 0) $param.="&search_desc=".urlencode($search_ref);
|
||||
if ($search_label > 0) $param.="&search_desc=".urlencode($search_label);
|
||||
if ($search_desc > 0) $param.="&search_desc=".urlencode($search_desc);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy');
|
||||
print '<br>';
|
||||
|
||||
print $langs->trans("InitAccountancyDesc") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
// Select mode
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>' . $langs->trans('Options') . '</td><td>' . $langs->trans('Description') . '</td>';
|
||||
@ -270,11 +270,17 @@ if ($result) {
|
||||
print '<div align="center"><input type="submit" class="button" value="' . $langs->trans('Refresh') . '" name="changetype"></div>';
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
// Filter on categories
|
||||
$moreforfilter='';
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print_barre_liste($langs->trans("ListOfProductsWithoutAccountingAccount"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines, '', '');
|
||||
$texte=$langs->trans("ListOfProductsWithoutAccountingAccount");
|
||||
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="liste '.($moreforfilter?"listwithfilterbefore":"").'">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
@ -292,12 +298,11 @@ if ($result) {
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . $search_ref . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . $search_label . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>';
|
||||
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="10" name="search_ref" value="' . dol_escape_htmltag($search_ref) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_label" value="' . dol_escape_htmltag($search_label) . '"></td>';
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . dol_escape_htmltag($search_desc) . '"></td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td align="center" class="liste_titre">';
|
||||
print '<td align="right" class="liste_titre">';
|
||||
$searchpitco=$form->showFilterAndCheckAddButtons(1, 'checkforselect', 1);
|
||||
print $searchpitco;
|
||||
print '</td>';
|
||||
@ -305,7 +310,8 @@ if ($result) {
|
||||
|
||||
$var = true;
|
||||
|
||||
while ( $i < min($num_lines, 250) ) {
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var = ! $var;
|
||||
|
||||
@ -374,14 +380,15 @@ if ($result) {
|
||||
}
|
||||
|
||||
// Checkbox select
|
||||
print '<td align="center">';
|
||||
print '<td align="right">';
|
||||
print '<input type="checkbox" class="checkforselect" name="chk_prod[]" value="' . $obj->rowid . '"/></td>';
|
||||
|
||||
print "</tr>";
|
||||
$i ++;
|
||||
}
|
||||
print '</table>';
|
||||
print '<br><div align="right"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
|
||||
|
||||
print '<br><div align="center"><input type="submit" class="butAction" name="changeaccount" value="' . $langs->trans("Save") . '"></div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -110,7 +110,7 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false) {
|
||||
global $langs;
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -184,6 +184,9 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sql .= " AND fk_docdet = " . $this->fk_docdet;
|
||||
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -197,6 +200,9 @@ class BookKeeping extends CommonObject
|
||||
$sqlnum .= " WHERE doc_type = '" . $this->doc_type . "'";
|
||||
$sqlnum .= " AND fk_docdet = '" . $this->fk_docdet . "'";
|
||||
$sqlnum .= " AND doc_ref = '" . $this->doc_ref . "'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
@ -208,7 +214,10 @@ class BookKeeping extends CommonObject
|
||||
if (empty($this->piece_num)) {
|
||||
$sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum";
|
||||
$sqlnum .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . ":: create sqlnum=" . $sqlnum, LOG_DEBUG);
|
||||
$resqlnum = $this->db->query($sqlnum);
|
||||
if ($resqlnum) {
|
||||
@ -470,11 +479,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null) {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -491,7 +501,6 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
$sql .= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
@ -556,11 +565,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -577,9 +587,6 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -601,7 +608,6 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
@ -672,11 +678,12 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
@ -693,9 +700,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.piece_num";
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -715,7 +720,6 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
@ -784,16 +788,15 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllBalance($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') {
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " SUM(t.debit) as debit,";
|
||||
$sql .= " SUM(t.credit) as credit";
|
||||
|
||||
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
|
||||
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
@ -813,11 +816,14 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
$sql.= ' WHERE 1 = 1';
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
|
||||
}
|
||||
|
||||
$sql .= ' GROUP BY t.numero_compte';
|
||||
|
||||
if (! empty($sortfield)) {
|
||||
@ -917,7 +923,6 @@ class BookKeeping extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . ' SET';
|
||||
|
||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ',';
|
||||
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
|
||||
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
|
||||
@ -934,7 +939,6 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' import_key = ' . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null") . ',';
|
||||
$sql .= ' code_journal = ' . (isset($this->code_journal) ? "'" . $this->db->escape($this->code_journal) . "'" : "null") . ',';
|
||||
$sql .= ' piece_num = ' . (isset($this->piece_num) ? $this->piece_num : "null");
|
||||
|
||||
$sql .= ' WHERE rowid=' . $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1049,11 +1053,13 @@ class BookKeeping extends CommonObject
|
||||
/**
|
||||
* Delete bookkepping by year
|
||||
*
|
||||
* @param string $delyear Year to delete
|
||||
* @param string $journal Journal to delete
|
||||
* @return int Result
|
||||
* @param string $delyear Year to delete
|
||||
* @param string $journal Journal to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function deleteByYearAndJournal($delyear='', $journal='') {
|
||||
global $conf;
|
||||
|
||||
if (empty($delyear) && empty($journal))
|
||||
{
|
||||
return -1;
|
||||
@ -1067,6 +1073,9 @@ class BookKeeping extends CommonObject
|
||||
$sql.= " WHERE 1 = 1";
|
||||
if (! empty($delyear)) $sql.= " AND YEAR(doc_date) = " . $delyear; // FIXME Must use between
|
||||
if (! empty($journal)) $sql.= " AND code_journal = '".$journal."'";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
@ -1090,12 +1099,17 @@ class BookKeeping extends CommonObject
|
||||
* @return int Result
|
||||
*/
|
||||
function deleteMvtNum($piecenum) {
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
$sql = "DELETE";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@ -1193,9 +1207,14 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchPerMvt($piecenum) {
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,doc_ref,doc_type";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1223,8 +1242,13 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function getNextNumMvt()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
@ -1247,12 +1271,17 @@ class BookKeeping extends CommonObject
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all_per_mvt($piecenum) {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
$sql .= " WHERE piece_num = " . $piecenum;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
@ -1297,11 +1326,16 @@ class BookKeeping extends CommonObject
|
||||
* @return int Result
|
||||
*/
|
||||
function export_bookkeping($model = 'ebp') {
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
$sql .= " doc_ref, fk_doc, fk_docdet, code_tiers,";
|
||||
$sql .= " numero_compte, label_compte, debit, credit,";
|
||||
$sql .= " montant, sens, fk_user_author, import_key, code_journal, piece_num";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::export_bookkeping", LOG_DEBUG);
|
||||
|
||||
@ -1345,75 +1379,76 @@ class BookKeeping extends CommonObject
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
*
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '') {
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
$sql = "SELECT DISTINCT ab.numero_compte as account_number, aa.label as label, aa.rowid as rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ab.numero_compte";
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND ab.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
$sql .= " ORDER BY account_number ASC";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', 'maxwidth300');
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1421,25 +1456,26 @@ class BookKeeping extends CommonObject
|
||||
* Description of a root accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string
|
||||
* @return string Root account
|
||||
*/
|
||||
function get_compte_racine($account = null)
|
||||
{
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
|
||||
$sql = "SELECT root.account_number, root.label as label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND parent.active = 1";
|
||||
$sql .= " AND root.active = 1";
|
||||
|
||||
|
||||
|
||||
$sql = "SELECT root.account_number, root.label as label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as parent ON aa.account_parent = parent.rowid";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as root ON parent.account_parent = root.rowid";
|
||||
$sql .= " WHERE aa.account_number = '" . $account . "'";
|
||||
$sql .= " AND parent.active = 1";
|
||||
$sql .= " AND root.active = 1";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " AND aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1463,11 +1499,12 @@ class BookKeeping extends CommonObject
|
||||
* Description of accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string
|
||||
* @return string Account desc
|
||||
*/
|
||||
function get_compte_desc($account = null)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
$sql = "SELECT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version, cat.label as category";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa ";
|
||||
@ -1476,6 +1513,10 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " AND asy.rowid = " . $pcgver;
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid";
|
||||
if (! empty($conf->multicompany->enabled)) {
|
||||
$sql .= " WHERE aa.entity IN (" . getEntity("accountancy", 1) . ")";
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -1499,6 +1540,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class BookKeepingLine
|
||||
*/
|
||||
|
||||
@ -377,92 +377,16 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
||||
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
$marge_basse=$this->marge_basse;
|
||||
$marge_gauche=$this->marge_gauche;
|
||||
$page_hauteur=$this->page_hauteur;
|
||||
|
||||
// Line of free text
|
||||
$line=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 3);
|
||||
$pdf->SetDrawColor(224,224,224);
|
||||
|
||||
// The start of the bottom of this page footer is positioned according to # of lines
|
||||
$freetextheight=0;
|
||||
if ($line) // Free text
|
||||
{
|
||||
//$line="eee<br>\nfd<strong>sf</strong>sdf<br>\nghfghg<br>";
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) // by default
|
||||
{
|
||||
$width=20000; $align='L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
|
||||
if (! empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) {
|
||||
$width=200; $align='C';
|
||||
}
|
||||
$freetextheight=$pdf->getStringHeight($width,$line);
|
||||
}
|
||||
else
|
||||
{
|
||||
$freetextheight=pdfGetHeightForHtmlContent($pdf,dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content)
|
||||
//print '<br>'.$freetextheight;exit;
|
||||
}
|
||||
}
|
||||
|
||||
$marginwithfooter=$marge_basse + $freetextheight;
|
||||
$posy=$marginwithfooter+0;
|
||||
|
||||
if ($line) // Free text
|
||||
{
|
||||
$pdf->SetXY($dims['lm'],-$posy);
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) // by default
|
||||
{
|
||||
$pdf->MultiCell(0, 3, $line, 0, $align, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk']-$marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 0));
|
||||
}
|
||||
$posy-=$freetextheight;
|
||||
}
|
||||
|
||||
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
|
||||
/*
|
||||
$nbofline=dol_nboflines_bis($line,0,$outputlangs->charset_output);
|
||||
//print 'e'.$line.'t'.dol_nboflines($line);exit;
|
||||
$posy=$marge_basse + ($nbofline*3);
|
||||
|
||||
if ($line) // Free text
|
||||
$newfreetext='';
|
||||
$paramfreetext='BANK_CHEQUERECEIPT_FREE_TEXT';
|
||||
if (! empty($conf->global->$paramfreetext))
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(20000, 3, $line, 0, 'L', 0); // Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
|
||||
$posy-=($nbofline*3); // 6 of ligne + 3 of MultiCell
|
||||
}*/
|
||||
|
||||
$pdf->SetY(-$posy);
|
||||
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
|
||||
$posy--;
|
||||
|
||||
/*if ($line1)
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
|
||||
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||
}
|
||||
|
||||
if ($line2)
|
||||
{
|
||||
$posy-=3;
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
|
||||
}*/
|
||||
|
||||
// Show page nb only on iso languages (so default Helvetica font)
|
||||
if (pdf_getPDFFont($outputlangs) == 'Helvetica')
|
||||
{
|
||||
$pdf->SetXY(-20,-$posy);
|
||||
$pdf->MultiCell(11, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
|
||||
}
|
||||
|
||||
return pdf_pagefoot($pdf,$outputlangs,$newfreetext,$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object,$showdetails,$hidefreetext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -590,8 +590,6 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","COMMANDE_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -406,8 +406,6 @@ class pdf_strato extends ModelePDFContract
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","CONTRACT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -269,8 +269,6 @@ class html_cerfafr extends ModeleDon
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","DON_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Error by default
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -482,8 +482,6 @@ class pdf_standard extends ModeleExpenseReport
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","EXPENSEREPORT_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -405,8 +405,6 @@ class pdf_soleil extends ModelePDFFicheinter
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","FICHEINTER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -763,9 +763,6 @@ class pdf_azur extends ModelePDFPropales
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -549,8 +549,6 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -572,8 +572,6 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","SUPPLIER_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -198,8 +198,6 @@ class InterfaceLogevents extends DolibarrTriggers
|
||||
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -335,23 +335,23 @@ else
|
||||
}
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($search_categ > 0) $param.="&search_categ=".$search_categ;
|
||||
if ($sref) $param="&sref=".$sref;
|
||||
if ($search_ref_supplier) $param="&search_ref_supplier=".$search_ref_supplier;
|
||||
if ($sbarcode) $param.=($sbarcode?"&sbarcode=".$sbarcode:"");
|
||||
if ($snom) $param.="&snom=".$snom;
|
||||
if ($sall) $param.="&sall=".$sall;
|
||||
if ($tosell != '') $param.="&tosell=".$tosell;
|
||||
if ($tobuy != '') $param.="&tobuy=".$tobuy;
|
||||
if ($fourn_id) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
if ($seach_categ) $param.=($search_categ?"&search_categ=".$search_categ:"");
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_categ > 0) $param.="&search_categ=".urlencode($search_categ);
|
||||
if ($sref) $param="&sref=".urlencode($sref);
|
||||
if ($search_ref_supplier) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
if ($sbarcode) $param.=($sbarcode?"&sbarcode=".urlencode($sbarcode):"");
|
||||
if ($snom) $param.="&snom=".urlencode($snom);
|
||||
if ($sall) $param.="&sall=".urlencode($sall);
|
||||
if ($tosell != '') $param.="&tosell=".urlencode($tosell);
|
||||
if ($tobuy != '') $param.="&tobuy=".urlencode($tobuy);
|
||||
if ($fourn_id > 0) $param.=($fourn_id?"&fourn_id=".$fourn_id:"");
|
||||
if ($seach_categ) $param.=($search_categ?"&search_categ=".urlencode($search_categ):"");
|
||||
if ($type != '') $param.='&type='.urlencode($type);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_tobatch) $param="&search_ref_supplier=".$search_ref_supplier;
|
||||
if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".$search_accountancy_code_sell;
|
||||
if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".$search_accountancy_code_buy;
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($search_tobatch) $param="&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
if ($search_accountancy_code_sell) $param="&search_accountancy_code_sell=".urlencode($search_accountancy_code_sell);
|
||||
if ($search_accountancy_code_buy) $param="&search_accountancy_code_buy=".urlencode($search_accountancy_code_buy);
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
|
||||
@ -260,7 +260,6 @@ abstract class ActionsCardCommon
|
||||
return;
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user