develop_dict
This commit is contained in:
Regis Houssin 2017-06-29 08:51:42 +02:00
commit fa247ffd98
177 changed files with 3087 additions and 2107 deletions

View File

@ -31,10 +31,17 @@ Following changes may create regression for some external modules, but were nece
content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow content by doing a print into function, sometimes by returning content into "resprint". This has been fixed to follow
hook specifications so you must return output into "resprint". hook specifications so you must return output into "resprint".
***** ChangeLog for 5.0.4 compared to 5.0.3 ***** ***** ChangeLog for 5.0.4 compared to 5.0.3 *****
FIX: #6880 FIX: #5640 Prices of a predefined product/service were incorrect under certain circumstances
FIX: #6925 FIX: #6541 since 4.0.4 to 5.0.0 autofill zip/town not working
FIX: #6880 #6925
FIX: #6885
FIX: #6926 FIX: #6926
FIX: #7003
FIX: #7012
FIX: #7040
FIX: #7048 #6075
FIX: Can set supplier invoice to billed. FIX: Can set supplier invoice to billed.
FIX: Can't create invoice if PO disapproved FIX: Can't create invoice if PO disapproved
FIX: contratligne update FIX: contratligne update
@ -46,6 +53,7 @@ FIX: Redirect to payment page from member subscription page failed if a unique s
FIX: REST api to get project when user has permission to read all. FIX: REST api to get project when user has permission to read all.
FIX: situation_progress param default value must be 100 and not 0 FIX: situation_progress param default value must be 100 and not 0
FIX: SQL injection on user/index.php parameter search_statut. FIX: SQL injection on user/index.php parameter search_statut.
FIX: vat code not saved during product creation.
FIX: Warnings FIX: Warnings
***** ChangeLog for 5.0.3 compared to 5.0.2 ***** ***** ChangeLog for 5.0.3 compared to 5.0.2 *****

View File

@ -5,7 +5,7 @@
// during install process to be used. // during install process to be used.
// //
// //
$force_install_noedit=2; $force_install_noedit=2; // 1=To block vars specific to distrib, 2 to block all technical parameters
$force_install_message='KeepDefaultValuesWamp'; $force_install_message='KeepDefaultValuesWamp';
$force_install_main_data_root='WAMPROOT/dolibarr_documents'; $force_install_main_data_root='WAMPROOT/dolibarr_documents';
$force_install_type='mysqli'; $force_install_type='mysqli';

View File

@ -1,7 +1,7 @@
<?php <?php
$force_install_packager='rpmfedora'; $force_install_packager='rpmfedora';
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters $force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='/var/lib/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents';
$force_install_type='mysqli'; $force_install_type='mysqli';

View File

@ -1,7 +1,7 @@
<?php <?php
$force_install_packager='rpmgeneric'; $force_install_packager='rpmgeneric';
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters $force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='/var/lib/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents';
$force_install_type='mysqli'; $force_install_type='mysqli';

View File

@ -1,7 +1,7 @@
<?php <?php
$force_install_packager='rpmmandriva'; $force_install_packager='rpmmandriva';
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters $force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='/var/lib/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents';
$force_install_type='mysqli'; $force_install_type='mysqli';

View File

@ -1,7 +1,7 @@
<?php <?php
$force_install_packager='rpmopensuse'; $force_install_packager='rpmopensuse';
$force_install_noedit=1; # 1 to block var specific to distrib, 2 to block every technical parameters $force_install_noedit=1; // 1 to block var specific to distrib, 2 to block every technical parameters
$force_install_message='KeepDefaultValuesDeb'; $force_install_message='KeepDefaultValuesDeb';
$force_install_main_data_root='/var/lib/dolibarr/documents'; $force_install_main_data_root='/var/lib/dolibarr/documents';
$force_install_type='mysqli'; $force_install_type='mysqli';

View File

@ -68,7 +68,7 @@ $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
@ -1148,7 +1148,6 @@ else
* Show list of dictionary to show * Show list of dictionary to show
*/ */
$var=true;
$lastlineisempty=false; $lastlineisempty=false;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';

View File

@ -74,7 +74,7 @@ $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -1,11 +1,11 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com> * Copyright (C) 2014-2015 Ari Elbaz (elarifr) <github@accedinfo.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -23,7 +23,7 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/index.php * \file htdocs/accountancy/admin/defaultaccounts.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Setup page to configure accounting expert module * \brief Setup page to configure accounting expert module
*/ */
@ -53,10 +53,10 @@ $action = GETPOST('action', 'alpha');
$list_account_main = array ( $list_account_main = array (
'ACCOUNTING_ACCOUNT_CUSTOMER', 'ACCOUNTING_ACCOUNT_CUSTOMER',
'ACCOUNTING_ACCOUNT_SUPPLIER', 'ACCOUNTING_ACCOUNT_SUPPLIER',
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
); );
$list_account = array ( $list_account = array (
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_BUY_ACCOUNT',
'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT',
'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT',

View File

@ -51,8 +51,8 @@ $action = GETPOST('action', 'alpha');
$list = array ( $list = array (
'ACCOUNTING_LENGTH_GACCOUNT', 'ACCOUNTING_LENGTH_GACCOUNT',
'ACCOUNTING_LENGTH_AACCOUNT' , 'ACCOUNTING_LENGTH_AACCOUNT' ,
'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc // 'ACCOUNTING_LENGTH_DESCRIPTION', // adjust size displayed for lines description for dol_trunc
'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc // 'ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT', // adjust size displayed for select account description for dol_trunc
); );

View File

@ -58,7 +58,7 @@ $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -397,7 +397,7 @@ if ($result)
// TODO ADJUST DESCRIPTION SIZE // TODO ADJUST DESCRIPTION SIZE
// print '<td align="left">' . $obj->description . '</td>'; // print '<td align="left">' . $obj->description . '</td>';
// TODO: we shoul set a user defined value to adjust user square / wide screen size // TODO: we shoul set a user defined value to adjust user square / wide screen size
$trunclengh = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 64; $trunclengh = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>'; print '<td style="' . $code_sell_p_l_differ . '">' . nl2br(dol_trunc($obj->description, $trunclengh)) . '</td>';
} }

View File

@ -37,7 +37,7 @@ $id = GETPOST('id', 'int');
if ($user->societe_id > 0) { if ($user->societe_id > 0) {
accessforbidden(); accessforbidden();
} }
$action = GETPOST('action'); $action = GETPOST('action','aZ09');
$mode = GETPOST('mode'); $mode = GETPOST('mode');
$piece_num = GETPOST("piece_num"); $piece_num = GETPOST("piece_num");
@ -500,8 +500,7 @@ if ($action == 'create') {
print "</tr>\n"; print "</tr>\n";
foreach ( $book->linesmvt as $line ) { foreach ( $book->linesmvt as $line ) {
$var = ! $var; print '<tr class="oddeven">';
print '<tr' . $bc[$var] . '>';
$total_debit += $line->debit; $total_debit += $line->debit;
$total_credit += $line->credit; $total_credit += $line->credit;

View File

@ -438,7 +438,6 @@ $total_debit = 0;
$total_credit = 0; $total_credit = 0;
foreach ($object->lines as $line ) { foreach ($object->lines as $line ) {
$var = ! $var;
$total_debit += $line->debit; $total_debit += $line->debit;
$total_credit += $line->credit; $total_credit += $line->credit;

View File

@ -429,4 +429,158 @@ class AccountancyCategory
return - 1; return - 1;
} }
} }
public function getCats() {
global $db, $langs, $user, $mysoc;
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
if (! empty($mysoc->country_id)) {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c";
$sql .= " WHERE c.active = 1 ";
$sql .= " AND c.fk_country = " . $mysoc->country_id;
$sql .= " ORDER BY c.position ASC";
} else {
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type";
$sql .= " FROM " . MAIN_DB_PREFIX . "c_accounting_category as c, " . MAIN_DB_PREFIX . "c_country as co";
$sql .= " WHERE c.active = 1 AND c.fk_country = co.rowid";
$sql .= " AND co.code = '" . $mysoc->country_code . "'";
$sql .= " ORDER BY c.position ASC";
}
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$data[] = array (
'rowid' => $obj->rowid,
'code' => $obj->code,
'position' => $obj->position,
'label' => $obj->label,
'formula' => $obj->formula,
'category_type' => $obj->category_type
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
$this->errors[] = $this->error;
dol_syslog(__METHOD__ . " " . implode(',', $this->errors), LOG_ERR);
return - 1;
}
}
// calcule
const PATTERN = '/(?:\-?\d+(?:\.?\d+)?[\+\-\*\/])+\-?\d+(?:\.?\d+)?/';
const PARENTHESIS_DEPTH = 10;
public function calculate($input){
if(strpos($input, '+') != null || strpos($input, '-') != null || strpos($input, '/') != null || strpos($input, '*') != null){
// Remove white spaces and invalid math chars
$input = str_replace(',', '.', $input);
$input = preg_replace('[^0-9\.\+\-\*\/\(\)]', '', $input);
// Calculate each of the parenthesis from the top
$i = 0;
while(strpos($input, '(') || strpos($input, ')')){
$input = preg_replace_callback('/\(([^\(\)]+)\)/', 'self::callback', $input);
$i++;
if($i > self::PARENTHESIS_DEPTH){
break;
}
}
// Calculate the result
if(preg_match(self::PATTERN, $input, $match)){
return $this->compute($match[0]);
}
return 0;
}
return $input;
}
private function compute($input){
$compute = create_function('', 'return '.$input.';');
return 0 + $compute();
}
private function callback($input){
if(is_numeric($input[1])){
return $input[1];
}
elseif(preg_match(self::PATTERN, $input[1], $match)){
return $this->compute($match[0]);
}
return 0;
}
/**
* get cpts of category
*
* @return array Result in table
*/
public function getCptsCat($cat_id) {
global $mysoc;
$sql = "";
if (empty($mysoc->country_id) && empty($mysoc->country_code)) {
dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined');
exit();
}
$sql = "SELECT t.rowid, t.account_number, t.label as name_cpt";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as t";
$sql .= " WHERE t.fk_accounting_category = ".$cat_id;
$sql .= " ORDER BY t.account_number ";
//echo $sql;
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$obj = '';
$num = $this->db->num_rows($resql);
$data = array ();
if ($num) {
while ( $obj = $this->db->fetch_object($resql) ) {
$name_cat = $obj->name_cat;
$data[] = array (
'id' => $obj->rowid,
'account_number' => $obj->account_number,
'name_cpt' => $obj->name_cpt,
);
$i ++;
}
}
return $data;
} else {
$this->error = "Error " . $this->db->lasterror();
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
return -1;
}
}
} }

View File

@ -270,7 +270,7 @@ class BookKeeping extends CommonObject
$sql .= ", montant"; $sql .= ", montant";
$sql .= ", sens"; $sql .= ", sens";
$sql .= ", fk_user_author"; $sql .= ", fk_user_author";
$sql .= ", import_key"; $sql .= ", date_creation";
$sql .= ", code_journal"; $sql .= ", code_journal";
$sql .= ", journal_label"; $sql .= ", journal_label";
$sql .= ", piece_num"; $sql .= ", piece_num";
@ -430,6 +430,11 @@ class BookKeeping extends CommonObject
if (empty($this->debit)) $this->debit = 0; if (empty($this->debit)) $this->debit = 0;
if (empty($this->credit)) $this->credit = 0; if (empty($this->credit)) $this->credit = 0;
$now = dol_now();
if (empty($this->date_create)) {
$this->date_create = $now;
}
// Check parameters // Check parameters
// Put here code to add control on parameters values // Put here code to add control on parameters values
@ -451,7 +456,7 @@ class BookKeeping extends CommonObject
$sql .= 'montant,'; $sql .= 'montant,';
$sql .= 'sens,'; $sql .= 'sens,';
$sql .= 'fk_user_author,'; $sql .= 'fk_user_author,';
$sql .= 'import_key,'; $sql .= 'date_creation,';
$sql .= 'code_journal,'; $sql .= 'code_journal,';
$sql .= 'journal_label,'; $sql .= 'journal_label,';
$sql .= 'piece_num,'; $sql .= 'piece_num,';
@ -473,7 +478,7 @@ class BookKeeping extends CommonObject
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ','; $sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ','; $sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
$sql .= ' ' . $user->id . ','; $sql .= ' ' . $user->id . ',';
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . "'" . $this->db->idate($this->date_create) . "',";
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ','; $sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).','; $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,7 +40,7 @@ $langs->load("accountancy");
// Security check // Security check
if (empty($conf->accounting->enabled)) { if (empty($conf->accounting->enabled)) {
accessforbidden(); accessforbidden();
} }
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
@ -187,7 +187,7 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
} else { } else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
} }
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
@ -203,10 +203,6 @@ $buttonbind = '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' .
$buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>'; $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=cleanaccountancycode">' . $langs->trans("CleanHistory", $year_current) . '</a>';
$var = true;
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -269,14 +265,14 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200">' . $langs->trans("Account") . '</td>';
print '<td width="200" align="left">' . $langs->trans("Label") . '</td>'; print '<td width="200" align="left">' . $langs->trans("Label") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>'; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
} }
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,"; $sql = "SELECT " . $db->ifsql('aa.account_number IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.account_number') . " AS codecomptable,";
$sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,"; $sql .= " " . $db->ifsql('aa.label IS NULL', "'".$langs->trans('NotMatch')."'", 'aa.label') . " AS intitule,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
} }
$sql .= " SUM(fd.total_ht) as total"; $sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
@ -296,22 +292,22 @@ $sql .= " GROUP BY fd.fk_code_ventilation,aa.account_number,aa.label";
dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG); dol_syslog("htdocs/accountancy/customer/index.php sql=" . $sql, LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ( $row = $db->fetch_row($resql)) { while ( $row = $db->fetch_row($resql)) {
print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>'; print '<tr class="oddeven"><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
for($i = 2; $i <= 12; $i ++) { for($i = 2; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>'; print '<td align="right">' . price($row[$i]) . '</td>';
} }
print '<td align="right">' . price($row[13]) . '</td>'; print '<td align="right">' . price($row[13]) . '</td>';
print '<td align="right"><b>' . price($row[14]) . '</b></td>'; print '<td align="right"><b>' . price($row[14]) . '</b></td>';
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
@ -319,101 +315,101 @@ print "</table>\n";
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ? if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. Why showing a report that should rely on result of this step ?
{ {
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OtherInfo"), '', ''); print_fiche_titre($langs->trans("OtherInfo"), '', '');
print "<br>\n"; print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("TotalVente") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>'; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
} }
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,"; $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
} }
$sql .= " SUM(fd.total_ht) as total"; $sql .= " SUM(fd.total_ht) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else { } else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.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'); dol_syslog('htdocs/accountancy/customer/index.php');
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$i = 0; $i = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>'; print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td align="right">' . price($row[$i]) . '</td>'; print '<td align="right">' . price($row[$i]) . '</td>';
} }
print '<td align="right"><b>' . price($row[13]) . '</b></td>'; print '<td align="right"><b>' . price($row[13]) . '</b></td>';
print '</tr>'; print '</tr>';
$i ++; $i ++;
} }
$db->free($resql); $db->free($resql);
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
print "<br>\n"; print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>'; print '<tr class="liste_titre"><td width="400">' . $langs->trans("TotalMarge") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>'; print '<td width="60" align="right">' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '</td>';
} }
print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,"; $sql = "SELECT '" . $langs->trans("Vide") . "' AS marge,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
$sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, '(fd.total_ht-(fd.qty * fd.buy_price_ht))', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
} }
$sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total"; $sql .= " SUM((fd.total_ht-(fd.qty * fd.buy_price_ht))) as total";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd"; $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
$sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'"; $sql .= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($y, 1, false)) . "'";
$sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND f.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'";
$sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity('facture', 0) . ")"; // We don't share object for accountancy
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_SITUATION . ")";
} else { } else {
$sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")"; $sql .= " AND f.type IN (" . Facture::TYPE_STANDARD . "," . Facture::TYPE_REPLACEMENT . "," . Facture::TYPE_CREDIT_NOTE . "," . Facture::TYPE_DEPOSIT . "," . Facture::TYPE_SITUATION . ")";
} }
dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql); dol_syslog('htdocs/accountancy/customer/index.php:: $sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($row = $db->fetch_row($resql)) { while ($row = $db->fetch_row($resql)) {
print '<tr><td>' . $row[0] . '</td>'; print '<tr><td>' . $row[0] . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td align="right">' . price(price2num($row[$i])) . '</td>'; print '<td align="right">' . price(price2num($row[$i])) . '</td>';
} }
print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>'; print '<td align="right"><b>' . price(price2num($row[13])) . '</b></td>';
print '</tr>'; print '</tr>';
} }
$db->free($resql); $db->free($resql);
} else { } else {
print $db->lasterror(); // Show last sql error print $db->lasterror(); // Show last sql error
} }
print "</table>\n"; print "</table>\n";
} }
} }

View File

@ -327,7 +327,7 @@ if ($result) {
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
print '</td>'; print '</td>';

View File

@ -375,7 +375,7 @@ if ($result) {
print '<td class="tdoverflowonsmartphone">'; print '<td class="tdoverflowonsmartphone">';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
print '</td>'; print '</td>';

View File

@ -178,9 +178,6 @@ $buttonreset = '<a class="butActionDelete" href="' . $_SERVER['PHP_SELF'] . '?ye
$y = $year_current; $y = $year_current;
$var = true;
print '<br>'; print '<br>';
print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, '');

View File

@ -287,7 +287,7 @@ if ($result) {
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
print '</td>'; print '</td>';

View File

@ -323,7 +323,7 @@ if ($result) {
// Fees description -- Can be null // Fees description -- Can be null
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->comments);
print '</td>'; print '</td>';

View File

@ -72,10 +72,10 @@ $date_startyear = GETPOST('date_startyear');
$date_endmonth = GETPOST('date_endmonth'); $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday'); $date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear'); $date_endyear = GETPOST('date_endyear');
$action = GETPOST('action','aZ09'); $in_bookkeeping = GETPOST('in_bookkeeping');
$now = dol_now(); $now = dol_now();
$action = GETPOST('action','aZ09'); $action = GETPOST('action','alpha');
// Security check // Security check
if ($user->societe_id > 0 && empty($id_journal)) if ($user->societe_id > 0 && empty($id_journal))
@ -121,6 +121,8 @@ $sql .= " WHERE ba.fk_accountancy_journal=" . $id_journal;
$sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy $sql .= ' AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'"; $sql .= " AND b.dateo >= '" . $db->idate($date_start) . "' AND b.dateo <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
$sql .= " AND (b.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='bank') )";
$sql .= " ORDER BY b.datev"; $sql .= " ORDER BY b.datev";
$object = new Account($db); $object = new Account($db);
@ -366,6 +368,7 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->fk_docdet = $val["fk_bank"];
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$bookkeeping->label_operation = $val["label"]; $bookkeeping->label_operation = $val["label"];
$bookkeeping->label_compte = $langs->trans("Bank");
$bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->montant = ($mt < 0 ? - $mt : $mt);
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0 ? $mt : 0); $bookkeeping->debit = ($mt >= 0 ? $mt : 0);
@ -473,6 +476,18 @@ if (! $error && $action == 'writebookkeeping') {
$bookkeeping->date_create = $now; $bookkeeping->date_create = $now;
if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution
$sqlmid = 'SELECT ch.libelle, t.libelle as labelc';
$sqlmid .= " FROM " . MAIN_DB_PREFIX . "chargesociales ch ";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementcharge as paych ON paych.fk_charge=ch.rowid";
$sqlmid .= " INNER JOIN " . MAIN_DB_PREFIX . "c_chargesociales as t ON ch.fk_type=t.id";
$sqlmid .= " WHERE paych.fk_bank=" . $key;
dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG);
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$bookkeeping->label_compte = $objmid->labelc;
$bookkeeping->doc_ref = $objmid->libelle ;
}
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
} else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice } else if ($tabtype[$key] == 'payment') { // If payment is payment of customer invoice, we get ref of invoice
@ -597,7 +612,6 @@ if (! $error && $action == 'writebookkeeping') {
} }
// Export // Export
/*
if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
@ -606,165 +620,101 @@ if ($action == 'export_csv') {
$companystatic = new Client($db); $companystatic = new Client($db);
$userstatic = new User($db); $userstatic = new User($db);
// Model Cegid Expert Export // Bank
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) foreach ( $tabpay as $key => $val ) {
{ $date = dol_print_date($db->jdate($val["date"]), 'day');
$sep = ";";
foreach ( $tabpay as $key => $val ) { $reflabel = $val["ref"];
$date = dol_print_date($db->jdate($val["date"]), '%d%m%Y'); if ($reflabel == '(SupplierInvoicePayment)') {
$reflabel = $langs->trans('Supplier');
$reflabel = $val["ref"]; }
if ($reflabel == '(SupplierInvoicePayment)') { if ($reflabel == '(CustomerInvoicePayment)') {
$reflabel = $langs->trans('Supplier'); $reflabel = $langs->trans('Customer');
} }
if ($reflabel == '(CustomerInvoicePayment)') { if ($reflabel == '(SocialContributionPayment)') {
$reflabel = $langs->trans('Customer'); $reflabel = $langs->trans('SocialContribution');
} }
if ($reflabel == '(SocialContributionPayment)') { if ($reflabel == '(DonationPayment)') {
$reflabel = $langs->trans('SocialContribution'); $reflabel = $langs->trans('Donation');
} }
if ($reflabel == '(DonationPayment)') { if ($reflabel == '(SubscriptionPayment)') {
$reflabel = $langs->trans('Donation'); $reflabel = $langs->trans('Subscription');
} }
if ($reflabel == '(SubscriptionPayment)') { if ($reflabel == '(ExpenseReportPayment)') {
$reflabel = $langs->trans('Subscription'); $reflabel = $langs->trans('Employee');
}
if ($reflabel == '(ExpenseReportPayment)') {
$reflabel = $langs->trans('Employee');
}
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$userstatic->id = $tabuser[$key]['id'];
$userstatic->lastname = $tabuser[$key]['lastname'];
$userstatic->firstname = $tabuser[$key]['firstname'];
// Bank
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
if ($companystatic->name == '') {
print $langs->trans('Bank')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans("Bank") .' - '.utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $journal . $sep;
if ($tabtype[$key] == 'payment') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
} else if ($tabtype[$key] == 'payment_supplier') {
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
} else {
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
}
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
if ($companystatic->name == '') {
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
}
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print $date . $sep;
print $journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
if ($companystatic->name == '') {
print $langs->trans('ThirdParty')." - ". utf8_decode($val["ref"]) . $sep;
} else {
print $langs->trans('ThirdParty')." - ". utf8_decode($companystatic->name) . $sep;
}
print utf8_decode($reflabel) . $sep;
print "\n";
}
}
} }
} else {
// Model Classic Export
foreach ( $tabpay as $key => $val ) {
$date = dol_print_date($db->jdate($val["date"]), 'day');
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
// Bank // Bank
foreach ( $tabbq[$key] as $k => $mt ) { foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $journal . '"' . $sep; print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') { print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans('Bank') . " - " . utf8_decode($val["ref"]) . '"' . $sep; print " " . $sep;
} else { if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . $langs->trans('Bank') . " - " . utf8_decode($reflabel) . '"' . $sep;
}
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($val["ref"]) . '"' . $sep;
} else {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
}
} else { } else {
foreach ( $tabbq[$key] as $k => $mt ) { print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n";
}
// Third party
if (is_array($tabtp[$key])) {
foreach ( $tabtp[$key] as $k => $mt ) {
if ($mt) {
print '"' . $journal . '"' . $sep; print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["type_payment"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($val["ref"]) . '"' . $sep; if ($tabtype[$key] == 'payment_supplier') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
} else if($tabtype[$key] == 'payment') {
print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
} else { } else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
}
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $langs->trans('ThirdParty') . " - " . utf8_decode($companystatic->name) . '"' . $sep;
} }
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n"; print "\n";
} }
} }
} else {
foreach ( $tabbq[$key] as $k => $mt ) {
print '"' . $journal . '"' . $sep;
print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print '"' . length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE) . '"' . $sep;
print " " . $sep;
if ($companystatic->name == '') {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($reflabel) . '"' . $sep;
} else {
print '"' . $langs->trans("Bank") . ' - ' . utf8_decode($companystatic->name) . '"' . $sep;
}
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"';
print "\n";
}
} }
} }
} }
*/
/* /*
@ -788,7 +738,7 @@ if (empty($action) || $action == 'view') {
$builddate = time(); $builddate = time();
//$description = $langs->trans("DescFinanceJournal") . '<br>'; //$description = $langs->trans("DescFinanceJournal") . '<br>';
$description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description.= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$varlink = 'id_journal=' . $id_journal; $varlink = 'id_journal=' . $id_journal;
@ -802,6 +752,7 @@ if (empty($action) || $action == 'view') {
print '<div class="tabsAction tabsActionNoBottom">'; print '<div class="tabsAction tabsActionNoBottom">';
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
print '</div>'; print '</div>';
// TODO Avoid using js. We can use a direct link with $param // TODO Avoid using js. We can use a direct link with $param
@ -863,6 +814,9 @@ if (empty($action) || $action == 'view') {
if ($reflabel == '(ExpenseReportPayment)') { if ($reflabel == '(ExpenseReportPayment)') {
$reflabel = $langs->trans('Employee'); $reflabel = $langs->trans('Employee');
} }
if ($reflabel == '(payment_salary)') {
$reflabel = $langs->trans('Employee');
}
$ref=$reflabel; $ref=$reflabel;
if ($tabtype[$key] == 'payment') if ($tabtype[$key] == 'payment')

View File

@ -43,7 +43,7 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$id_journal = GETPOST('id_journal', 'int'); $id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','aZ09'); $action = GETPOST('action','alpha');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
@ -51,6 +51,7 @@ $date_startyear = GETPOST('date_startyear');
$date_endmonth = GETPOST('date_endmonth'); $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday'); $date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear'); $date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
$now = dol_now(); $now = dol_now();
@ -108,6 +109,8 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
} }
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='supplier_invoice') )";
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql); dol_syslog('accountancy/journal/purchasesjournal.php:: $sql=' . $sql);
@ -385,69 +388,15 @@ if ($action == 'writebookkeeping') {
$form = new Form($db); $form = new Form($db);
$companystatic = new Fournisseur($db); $companystatic = new Fournisseur($db);
$invoicestatic = new FactureFournisseur($db);
// Export // Export
/*if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL; $journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
// Model Cegid Expert Export
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$date = dol_print_date($val["date"], '%d%m%Y');
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($val["description"], 32) . $sep;
print $val["ref"];
print "\n";
}
}
// VAT
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $purchase_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print $companystatic->name . $sep;
print $val["ref"];
print "\n";
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) { foreach ( $tabfac as $key => $val ) {
$invoicestatic->id = $key; $invoicestatic->id = $key;
@ -468,44 +417,60 @@ $companystatic = new Fournisseur($db);
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["refsuppliersologest"] . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
// print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print " " . $sep;
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
print '"' . $journal_label . '"' ;
print "\n"; print "\n";
} }
} }
// VAT // VAT
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["refsuppliersologest"] . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
// print '"' . $langs->trans("VAT") . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep; print " " . $sep;
print '"' . $langs->trans("VAT") . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"'. $sep;
print '"' . $journal_label . '"' ;
print "\n"; print "\n";
} }
} }
// Third party // Third party
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $key . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["refsuppliersologest"] . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("subledger_account") . '"' . $sep; print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $val["refsuppliersologest"] . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"'. $sep;
print '"' . $journal_label . '"' ;
print "\n";
} }
print "\n";
} }
} }
}
*/
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
@ -524,7 +489,7 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
} }
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$varlink = 'id_journal=' . $id_journal; $varlink = 'id_journal=' . $id_journal;
@ -548,6 +513,7 @@ if (empty($action) || $action == 'view') {
else { else {
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
} }
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
print '</div>'; print '</div>';
print ' print '

View File

@ -46,7 +46,7 @@ $langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$id_journal = GETPOST('id_journal', 'int'); $id_journal = GETPOST('id_journal', 'int');
$action = GETPOST('action','aZ09'); $action = GETPOST('action','alpha');
$date_startmonth = GETPOST('date_startmonth'); $date_startmonth = GETPOST('date_startmonth');
$date_startday = GETPOST('date_startday'); $date_startday = GETPOST('date_startday');
@ -54,6 +54,7 @@ $date_startyear = GETPOST('date_startyear');
$date_endmonth = GETPOST('date_endmonth'); $date_endmonth = GETPOST('date_endmonth');
$date_endday = GETPOST('date_endday'); $date_endday = GETPOST('date_endday');
$date_endyear = GETPOST('date_endyear'); $date_endyear = GETPOST('date_endyear');
$in_bookkeeping = GETPOST('in_bookkeeping');
$now = dol_now(); $now = dol_now();
@ -113,6 +114,8 @@ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql .= " AND fd.product_type IN (0,1)"; $sql .= " AND fd.product_type IN (0,1)";
if ($date_start && $date_end) if ($date_start && $date_end)
$sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'";
if ($in_bookkeeping == 'yes')
$sql .= " AND (f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice') )";
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG); dol_syslog('accountancy/journal/sellsjournal.php', LOG_DEBUG);
@ -401,76 +404,18 @@ if ($action == 'writebookkeeping') {
$form = new Form($db); $form = new Form($db);
// Export // Export
/*if ($action == 'export_csv') { if ($action == 'export_csv') {
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL; $sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
$companystatic = new Client($db); $companystatic = new Client($db);
$invoicestatic = new Facture($db);
// Model Cegid Expert Export foreach ( $tabfac as $key => $val ) {
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) {
$sep = ";";
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client'];
$invoicestatic->id = $key;
$invoicestatic->ref = $val["ref"];
$date = dol_print_date($val["date"], '%d%m%Y');
foreach ( $tabttc[$key] as $k => $mt ) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) . $sep;
print length_accounta(html_entity_decode($k)) . $sep;
print ($mt < 0 ? 'C' : 'D') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . $sep;
print $val["ref"];
print "\n";
}
// Product / Service
foreach ( $tabht[$key] as $k => $mt ) {
$accountingaccount_static = new AccountingAccount($db);
if ($accountingaccount_static->fetch(null, $k, true)) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount_static->label . $sep;
print $val["ref"];
print "\n";
}
}
// TVA
foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) {
print $date . $sep;
print $sell_journal . $sep;
print length_accountg(html_entity_decode($k)) . $sep;
print $sep;
print ($mt < 0 ? 'D' : 'C') . $sep;
print ($mt <= 0 ? price(- $mt) : $mt) . $sep;
print dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . $sep;
// print $langs->trans("VAT") . $sep;
print $val["ref"];
print "\n";
}
}
}
} elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) {
// Model Classic Export
foreach ( $tabfac as $key => $val ) {
$companystatic->id = $tabcompany[$key]['id']; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->name = $tabcompany[$key]['name']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->client = $tabcompany[$key]['code_client']; $companystatic->client = $tabcompany[$key]['code_client'];
@ -481,13 +426,19 @@ $form = new Form($db);
$date = dol_print_date($val["date"], 'day'); $date = dol_print_date($val["date"], 'day');
foreach ( $tabttc[$key] as $k => $mt ) { foreach ( $tabttc[$key] as $k => $mt ) {
print '"' . $date . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("subledger_account") . '"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep;
print "\n"; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("Code_tiers") . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . $sell_journal . '"' ;
print "\n";
} }
// Product / Service // Product / Service
@ -495,33 +446,48 @@ $form = new Form($db);
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print "\n"; print " " . $sep;
print '"' . utf8_decode ( dol_trunc($accountingaccount->label, 32) ) . '"' . $sep;
print '"' . utf8_decode (dol_trunc($companystatic->name, 16) ) . ' - ' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $sell_journal . '"' ;
print "\n";
} }
} }
// VAT // VAT
foreach ( $tabtva[$key] as $k => $mt ) { foreach ( $tabtva[$key] as $k => $mt ) {
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $key . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep; print '"' . utf8_decode ( dol_trunc($companystatic->name, 32) ). '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print "\n"; print " " . $sep;
print '"' . $langs->trans("VAT") . ' - ' . $def_tva[$key]. '"' . $sep;
print '"' . utf8_decode ( dol_trunc($companystatic->name, 16) ). ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . $sell_journal . '"' ;
print "\n";
} }
} }
}
} }
} }
*/
if (empty($action) || $action == 'view') { if (empty($action) || $action == 'view') {
@ -539,18 +505,12 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
else else
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
$period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1); $period = $form->select_date($date_start, 'date_start', 0, 0, 0, '', 1, 0, 1) . ' - ' . $form->select_date($date_end, 'date_end', 0, 0, 0, '', 1, 0, 1). ' - ' .$langs->trans("AlreadyInGeneralLedger").' '. $form->selectyesno('in_bookkeeping',$in_bookkeeping,0);
$varlink = 'id_journal=' . $id_journal; $varlink = 'id_journal=' . $id_journal;
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
/*if ($conf->global->ACCOUNTING_EXPORT_MODELCSV != 1 && $conf->global->ACCOUNTING_EXPORT_MODELCSV != 2) {
print '<input type="button" class="butActionRefused" style="float: right;" value="' . $langs->trans("Export") . '" disabled="disabled" title="' . $langs->trans('ExportNotSupported') . '"/>';
} else {
print '<input type="button" class="butAction" style="float: right;" value="' . $langs->trans("Export") . '" onclick="launch_export();" />';
}*/
// Button to write into Ledger // Button to write into Ledger
if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') {
print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone");
@ -563,6 +523,7 @@ if (empty($action) || $action == 'view') {
else { else {
print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; print '<input type="button" class="butAction" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';
} }
print '<input type="button" class="butAction" value="' . $langs->trans("ExportDraftJournal") . '" onclick="launch_export();" />';
print '</div>'; print '</div>';
print ' print '

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2016 Jamal Elbaz <jamelbaz@gmail.pro> /* Copyright (C) 2016/17 Jamal Elbaz <jamelbaz@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@ require '../../main.inc.php';
// Class // Class
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountancycategory.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/html.formaccounting.class.php';
@ -41,6 +42,8 @@ $selectcpt = GETPOST('cpt_bk');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'int'); $rowid = GETPOST('rowid', 'int');
$cancel = GETPOST('cancel'); $cancel = GETPOST('cancel');
$simple_report = GETPOST('simple_report');
// Filter // Filter
$year = GETPOST('year','int'); $year = GETPOST('year','int');
@ -77,7 +80,16 @@ $form = new Form($db);
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>'; $textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
$textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>'; $textnextyear = '&nbsp;<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
print load_fiche_titre($langs->trans('ReportInOut'), $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, 'title_accountancy'); $nom = $langs->trans("ReportInOut");
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = time();
$description = '';
$period = $langs->trans("Detail").' '. $form->selectyesno('simple_report',$simple_report,0) . " " .$textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear ;
report_header($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array (
'action' => ''
));
$moreforfilter=''; $moreforfilter='';
@ -108,30 +120,89 @@ foreach($months as $k => $v){
} }
print '</tr>'; print '</tr>';
$cats = $AccCat->getCatsCpts();
if ($cats < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$catsCalcule = $AccCat->getCatsCal();
//All categories
$cats = $AccCat->getCats();
if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors); if ($catsCalcule < 0) dol_print_error($db, $AccCat->error, $AccCat->errors);
$j=1; $j=1;
$sommes = array(); $sommes = array();
if (!empty($cats)) foreach($cats as $cat ){
{ if(!empty($cat['category_type'])){ // category calculed
foreach ($cats as $name_cat => $cpts)
{ $formula = $cat['formula'];
print "<tr class='liste_titre'>"; print "<tr class='liste_titre'>";
print '<td colspan="17">' . $name_cat . '</td>'; print '<td colspan="2">' . $cat['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$code = $cat['code']; // code categorie de calcule
$sommes[$code]['NP'] += $r;
// Current fiscal year (N)
if (is_array($sommes) && ! empty($sommes)){
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['N'] += $r;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
$r = $AccCat->calculate($result);
print '<td align="right"><font color="blue">' . price($r) . '</td>';
$sommes[$code]['M'][$k] += $r;
}
print "</tr>\n"; print "</tr>\n";
$position = -1;
$code = -1;
}else{ // normal category
$totCat = array();
$totCat['M'] = array();
// get cpts of category
$cpts = $AccCat->getCptsCat($cat['rowid']);
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $cat['label'] . '</td>';
foreach($cpts as $i => $cpt){ foreach($cpts as $i => $cpt){
$var = ! $var;
$position = $cpt['position']; $code = $cat['code'];
$code = $cpt['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']); $return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors'); setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0; $resultNP=0;
@ -139,6 +210,7 @@ if (!empty($cats))
$resultNP=$AccCat->sdc; $resultNP=$AccCat->sdc;
} }
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']); $return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) { if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors'); setEventMessages(null, $AccCat->errors, 'errors');
@ -146,13 +218,64 @@ if (!empty($cats))
} else { } else {
$resultN=$AccCat->sdc; $resultN=$AccCat->sdc;
} }
$totCat['NP'] += $resultNP;
$totCat['N'] += $resultN;
foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultM=0;
} else {
$resultM=$AccCat->sdc;
}
$totCat['M'][$k] += $resultM;
}
}
print '<td align="right">' . price($totCat['NP']) . '</td>';
print '<td align="right">' . price($totCat['N']) . '</td>';
foreach($totCat['M'] as $k => $v){
print '<td align="right">' . price($v) . '</td>';
}
print "</tr>\n";
foreach($cpts as $i => $cpt){
$var = ! $var;
$code = $cat['code'];
// N-1
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current -1, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultNP=0;
} else {
$resultNP=$AccCat->sdc;
}
//N
$return = $AccCat->getResult($cpt['account_number'], 0, $year_current, $cpt['dc']);
if ($return < 0) {
setEventMessages(null, $AccCat->errors, 'errors');
$resultN=0;
} else {
$resultN=$AccCat->sdc;
}
$sommes[$code]['NP'] += $resultNP; $sommes[$code]['NP'] += $resultNP;
$sommes[$code]['N'] += $resultN; $sommes[$code]['N'] += $resultN;
print '<tr class="oddeven">'; print '<tr'. $bc[$var].'>';
print '<td>' . $cpt['account_number'] . '</td>'; if ($simple_report == 'yes') {
print '<td>' . length_accountg($cpt['account_number']) . '</td>';
print '<td>' . $cpt['name_cpt'] . '</td>'; print '<td>' . $cpt['name_cpt'] . '</td>';
print '<td>' . price($resultNP) . '</td>'; print '<td align="right">' . price($resultNP) . '</td>';
print '<td>' . price($resultN) . '</td>'; print '<td align="right">' . price($resultN) . '</td>';
}
foreach($months as $k => $v){ foreach($months as $k => $v){
$return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']); $return = $AccCat->getResult($cpt['account_number'], $k+1, $year_current, $cpt['dc']);
@ -163,102 +286,15 @@ if (!empty($cats))
$resultM=$AccCat->sdc; $resultM=$AccCat->sdc;
} }
$sommes[$code]['M'][$k] += $resultM; $sommes[$code]['M'][$k] += $resultM;
if ($simple_report == 'yes') {
print '<td align="right">' . price($resultM) . '</td>'; print '<td align="right">' . price($resultM) . '</td>';
}
print "</tr>\n";
}
// If it's a calculated catgory
$p = $position + 1;
if(array_key_exists($p, $catsCalcule)){
$formula = $catsCalcule[$p]['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$code = $catsCalcule[$p]['code']; // code categorie de calcule
$sommes[$code]['NP'] += $result;
// Current fiscal year (N)
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['N'] += $result;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
} }
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['M'][$k] += $result;
} }
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
print "</tr>\n"; print "</tr>\n";
unset($catsCalcule[$p]); // j'élimine la catégorie calculée après affichage
} }
$j++;
} }
// Others calculed category
foreach($catsCalcule as $p => $catc)
{
$formula = $catsCalcule[$p]['formula'];
print "<tr class='liste_titre'>";
print '<td colspan="2">' . $catsCalcule[$p]['label'] . '</td>';
$vars = array();
// Previous Fiscal year (N-1)
foreach($sommes as $code => $det){
$vars[$code] = $det['NP'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$code = $catsCalcule[$p]['code']; // code categorie de calcule
$sommes[$code]['NP'] += $result;
// Current fiscal year (N)
foreach($sommes as $code => $det){
$vars[$code] = $det['N'];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['N'] += $result;
// Detail by month
foreach($months as $k => $v){
foreach($sommes as $code => $det){
$vars[$code] = $det['M'][$k];
}
$result = strtr($formula, $vars);
eval( '$result = (' . $result . ');' );
print '<td align="right">' . price($result) . '</td>';
$sommes[$code]['M'][$k] += $result;
}
//print '<td colspan="15">' . $catsCalcule[$p]['formula'] . '</td>';
print "</tr>\n";
}
} }
print "</table>"; print "</table>";

View File

@ -52,6 +52,8 @@ $search_desc = GETPOST('search_desc', 'alpha');
$search_amount = GETPOST('search_amount', 'alpha'); $search_amount = GETPOST('search_amount', 'alpha');
$search_account = GETPOST('search_account', 'alpha'); $search_account = GETPOST('search_account', 'alpha');
$search_vat = GETPOST('search_vat', 'alpha'); $search_vat = GETPOST('search_vat', 'alpha');
$search_country = GETPOST('search_country', 'alpha');
$search_tvaintra = GETPOST('search_tvaintra', 'alpha');
// Load variable for pagination // Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); $limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
@ -94,6 +96,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_amount = ''; $search_amount = '';
$search_account = ''; $search_account = '';
$search_vat = ''; $search_vat = '';
$search_country = '';
$search_tvaintra = '';
} }
if (is_array($changeaccount) && count($changeaccount) > 0) { if (is_array($changeaccount) && count($changeaccount) > 0) {
@ -149,13 +153,15 @@ print '<script type="text/javascript">
/* /*
* Supplier Invoice lines * Supplier Invoice lines
*/ */
$sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef,"; $sql = "SELECT f.rowid as facid, f.ref as facnumber, f.ref_supplier, f.libelle as invoice_label, f.datef, f.fk_soc,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, "; $sql.= " l.rowid, l.fk_product, l.description, l.total_ht , l.qty, l.tva_tx, aa.label, aa.account_number, ";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, co.label as country, s.tva_intra";
$sql.= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
$sql.= " , " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product";
$sql.= " , " . MAIN_DB_PREFIX . "facture_fourn_det as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.rowid = l.fk_code_ventilation";
$sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON p.rowid = l.fk_product"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as co ON co.rowid = s.fk_pays ";
$sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; $sql.= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 ";
$sql.= " AND aa.rowid = l.fk_code_ventilation"; $sql.= " AND aa.rowid = l.fk_code_ventilation";
if ($search_lineid) { if ($search_lineid) {
@ -182,6 +188,12 @@ if (strlen(trim($search_account))) {
if (strlen(trim($search_vat))) { if (strlen(trim($search_vat))) {
$sql .= natural_search("l.tva_tx", $search_vat, 1); $sql .= natural_search("l.tva_tx", $search_vat, 1);
} }
if (strlen(trim($search_country))) {
$sql .= " AND (co.label like'" . $search_country . "%')";
}
if (strlen(trim($search_tvaintra))) {
$sql .= " AND (s.tva_intra like'" . $search_tvaintra . "%')";
}
$sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy $sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);
@ -256,6 +268,8 @@ if ($result) {
print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="right flat maxwidth50" name="search_amount" value="' . dol_escape_htmltag($search_amount) . '"></td>';
print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="right flat maxwidth50" name="search_vat" placeholder="%" size="1" value="' . dol_escape_htmltag($search_vat) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>'; print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_account" value="' . dol_escape_htmltag($search_account) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_country" value="' . dol_escape_htmltag($search_country) . '"></td>';
print '<td class="liste_titre"><input type="text" class="flat maxwidth50" name="search_tavintra" value="' . dol_escape_htmltag($search_tavintra) . '"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
$searchpicto=$form->showFilterButtons(); $searchpicto=$form->showFilterButtons();
print $searchpicto; print $searchpicto;
@ -273,6 +287,8 @@ if ($result) {
print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Amount"), $_SERVER["PHP_SELF"], "l.total_ht", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATRate"), $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder);
$checkpicto=$form->showCheckAddButtons(); $checkpicto=$form->showCheckAddButtons();
print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"'); print_liste_field_titre($checkpicto, '', '', '', '', 'align="center"');
print "</tr>\n"; print "</tr>\n";
@ -315,7 +331,7 @@ if ($result) {
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
print '</td>'; print '</td>';
@ -325,7 +341,8 @@ if ($result) {
print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">'; print $codecompta . ' <a href="./card.php?id=' . $objp->rowid . '">';
print img_edit(); print img_edit();
print '</a></td>'; print '</a></td>';
print '<td align="right">' . $objp->country .'</td>';
print '<td align="center">' . $objp->tva_intra . '</td>';
print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>'; print '<td class="center"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>';
print "</tr>"; print "</tr>";

View File

@ -381,7 +381,7 @@ if ($result) {
// Description // Description
print '<td>'; print '<td>';
$text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description)); $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description));
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION') ? ACCOUNTING_LENGTH_DESCRIPTION : 32; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION) ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION;
print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description); print $form->textwithtooltip(dol_trunc($text,$trunclength), $objp->description);
print '</td>'; print '</td>';

View File

@ -52,7 +52,7 @@ $result=restrictedArea($user,'adherent',$id);
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -46,7 +46,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $limit * $page ; $offset = $limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -165,7 +165,7 @@ if ($action == 'edit')
$var=true; $var=true;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
foreach($modules as $module => $delays) foreach($modules as $module => $delays)
{ {
@ -178,7 +178,7 @@ if ($action == 'edit')
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('',$delay['img']).'</td>'; print '<td width="20px">'.img_object('',$delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td><td>';
print '<input size="5" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>'; print '<input class="right maxwidth75" type="number" name="'.$delay['code'].'" value="'.$value.'"> '.$langs->trans("days").'</td></tr>';
} }
} }
} }
@ -189,11 +189,11 @@ if ($action == 'edit')
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=false; $var=false;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' .$form->selectyesno('MAIN_DISABLE_METEO',(empty($conf->global->MAIN_DISABLE_METEO)?0:1),1) . '</td></tr>';
print '</table>'; print '</table>';
@ -211,7 +211,7 @@ else
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("DelaysOfToleranceBeforeWarning").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=true; $var=true;
foreach($modules as $module => $delays) foreach($modules as $module => $delays)
@ -225,7 +225,7 @@ else
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="20px">'.img_object('',$delay['img']).'</td>'; print '<td width="20px">'.img_object('',$delay['img']).'</td>';
print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>'; print '<td>'.$langs->trans('Delays_'.$delay['code']).'</td>';
print '<td>'.$value.' '.$langs->trans("days").'</td></tr>'; print '<td class="right">'.$value.' '.$langs->trans("days").'</td></tr>';
} }
} }
} }
@ -236,11 +236,11 @@ else
// Show if meteo is enabled // Show if meteo is enabled
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="120px">'.$langs->trans("Value").'</td></tr>'; print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td class="center" width="120px">'.$langs->trans("Value").'</td></tr>';
$var=false; $var=false;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td>' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>'; print '<td>'.$langs->trans("MAIN_DISABLE_METEO").'</td><td class="center">' . yn($conf->global->MAIN_DISABLE_METEO) . '</td></tr>';
print '</table>'; print '</table>';

View File

@ -74,7 +74,7 @@ $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -559,6 +559,7 @@ print '/>';
print '</td><td align="right">'; print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>';
// Use services duration // Use services duration
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';

View File

@ -67,7 +67,7 @@ $active = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -225,20 +225,6 @@ asort($orders);
//var_dump($modules); //var_dump($modules);
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
$head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
$head[$h][2] = 'feature';
$h++;
$i=0; $i=0;
foreach($orders as $tmpkey => $tmpvalue) foreach($orders as $tmpkey => $tmpvalue)
{ {
@ -257,6 +243,28 @@ $special = $objMod->special;
$tab=explode('_',$value); $tab=explode('_',$value);
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3]; $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
$head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("TechnicalServicesProvided");
$head[$h][2] = 'feature';
$h++;
if ($objMod->isCoreOrExternalModule() == 'external')
{
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=changelog';
$head[$h][1] = $langs->trans("ChangeLog");
$head[$h][2] = 'changelog';
$h++;
}
// Check filters // Check filters
$modulename=$objMod->getName(); $modulename=$objMod->getName();
$moduledesc=$objMod->getDesc(); $moduledesc=$objMod->getDesc();
@ -536,6 +544,13 @@ if ($mode == 'feature')
} }
if ($mode == 'changelog')
{
$changelog=$objMod->getChangeLog();
if ($changelog) $text.='<div class="moduledesclong">'.$changelog.'<div>';
else $text.='<div class="moduledesclong">'.$langs->trans("NotAvailable").'</div>';
}
print $text; print $text;

View File

@ -207,8 +207,19 @@ if ($action == 'set' && $user->admin)
//var_dump($resarray);exit; //var_dump($resarray);exit;
if ($resarray['nbperms'] > 0) if ($resarray['nbperms'] > 0)
{ {
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights'); $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
setEventMessages($msg, null, 'warnings'); $resqltmp=$db->query($tmpsql);
if ($resqltmp)
{
$obj=$db->fetch_object($resqltmp);
//var_dump($obj->nb);exit;
if ($obj && $obj->nb > 1)
{
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings');
}
}
else dol_print_error($db);
} }
} }
header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:'')); header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));

View File

@ -88,6 +88,7 @@ if (!empty($ExecTimeLimit))
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64 @set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
error_reporting($err); error_reporting($err);
} }
$MemoryLimit=0;
if (!empty($MemoryLimit)) if (!empty($MemoryLimit))
{ {
@ini_set('memory_limit', $MemoryLimit); @ini_set('memory_limit', $MemoryLimit);

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com> * Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* *
@ -45,15 +45,17 @@ $langs->load("companies");
$langs->load("users"); $langs->load("users");
$langs->load("other"); $langs->load("other");
$sortfield = GETPOST("sortfield",'alpha'); // Load variable for pagination
$sortorder = GETPOST("sortorder",'alpha'); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$page = GETPOST("page",'int'); $sortfield = GETPOST('sortfield','alpha');
if ($page == -1) { $page = 0 ; } $sortorder = GETPOST('sortorder','alpha');
$offset = $conf->liste_limit * $page ; $page = GETPOST('page','int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="dateevent"; if (! $sortfield) $sortfield="dateevent";
if (! $sortorder) $sortorder="DESC";
$search_code = GETPOST("search_code"); $search_code = GETPOST("search_code");
$search_ip = GETPOST("search_ip"); $search_ip = GETPOST("search_ip");
@ -61,9 +63,9 @@ $search_user = GETPOST("search_user");
$search_desc = GETPOST("search_desc"); $search_desc = GETPOST("search_desc");
$search_ua = GETPOST("search_ua"); $search_ua = GETPOST("search_ua");
if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear"));
else $date_start=-1; else $date_start=-1;
if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear"));
else $date_end=-1; else $date_end=-1;
// checks:if date_start>date_end then date_end=date_start + 24 hours // checks:if date_start>date_end then date_end=date_start + 24 hours
@ -72,14 +74,6 @@ if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date
$now = dol_now(); $now = dol_now();
$nowarray = dol_getdate($now); $nowarray = dol_getdate($now);
$params = "&amp;search_code=$search_code&amp;search_ip=$search_ip&amp;search_user=$search_user&amp;search_desc=$search_desc&amp;search_ua=$search_ua";
$params.= "&amp;date_startmonth=".$_REQUEST["date_startmonth"];
$params.= "&amp;date_startday=".$_REQUEST["date_startday"];
$params.= "&amp;date_startyear=".$_REQUEST["date_startyear"];
$params.= "&amp;date_endmonth=".$_REQUEST["date_endmonth"];
$params.= "&amp;date_endday=".$_REQUEST["date_endday"];
$params.= "&amp;date_endyear=".$_REQUEST["date_endyear"];
if (empty($date_start)) // We define date_start and date_end if (empty($date_start)) // We define date_start and date_end
{ {
$date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false); $date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false);
@ -88,6 +82,15 @@ if (empty($date_end))
{ {
$date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']); $date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']);
} }
// Set $date_startmonth...
$tmp = dol_getdate($date_start);
$date_startday = $tmp['mday'];
$date_startmonth = $tmp['mon'];
$date_startyear = $tmp['year'];
$tmp = dol_getdate($date_end);
$date_endday = $tmp['mday'];
$date_endmonth = $tmp['mon'];
$date_endyear = $tmp['year'];
/* /*
@ -97,7 +100,7 @@ if (empty($date_end))
$now=dol_now(); $now=dol_now();
// Purge search criteria // Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
{ {
$date_start=-1; $date_start=-1;
$date_end=-1; $date_end=-1;
@ -192,11 +195,20 @@ if ($result)
$i = 0; $i = 0;
$param=''; $param='';
if ($search_code) $param.='&search_code='.$search_code; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($search_ip) $param.='&search_ip='.$search_ip; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($search_user) $param.='&search_user='.$search_user; if ($optioncss != '') $param.='&optioncss='.$optioncss;
if ($search_desc) $param.='&search_desc='.$search_desc; if ($search_code) $param.='&search_code='.urlencode($search_code);
if ($search_ua) $param.='&search_ua='.$search_ua; if ($search_ip) $param.='&search_ip='.urlencode($search_ip);
if ($search_user) $param.='&search_user='.urlencode($search_user);
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
if ($search_ua) $param.='&search_ua='.urlencode($search_ua);
if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth);
if ($date_startday) $param.= "&date_startday=".urlencode($date_startday);
if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear);
if ($date_endmonth) $param.= "&date_endmonth=".urlencode($date_endmonth);
if ($date_endday) $param.= "&date_endday=".urlencode($date_endday);
if ($date_endyear) $param.= "&date_endyear=".urlencode($date_endyear);
$langs->load('withdrawals'); $langs->load('withdrawals');
if ($num) if ($num)
@ -204,7 +216,9 @@ if ($result)
$center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>'; $center='<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=purge">'.$langs->trans("Purge").'</a>';
} }
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup'); print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit);
if ($action == 'purge') if ($action == 'purge')
{ {
@ -212,19 +226,8 @@ if ($result)
print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1); print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1);
} }
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","","",'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
// Lignes des champs de filtres // Lignes des champs de filtres
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -255,14 +258,20 @@ if ($result)
print "</tr>\n"; print "</tr>\n";
$var=True;
while ($i < min($num, $conf->liste_limit)) print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder);
print_liste_field_titre('');
print "</tr>\n";
while ($i < min($num, $limit))
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Date // Date

View File

@ -47,7 +47,7 @@ $langs->load("other");
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -54,7 +54,7 @@ $status = 1;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $listlimit * $page ; $offset = $listlimit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;

View File

@ -1,41 +1,54 @@
API REST howto API REST
============== ========
This directory contains files to make Dolibarr a server of REST Web Services. ## Integrate your ERP with any other applications using Dolibarr APIs
It depends on external library Restler.
This module provides the service to make Dolibarr a server of REST Web Services. It depends on external library Restler.
Extract any data or push insert, update or delete record using our new REST APIs. Using standard HTTP and Json format, it is compatible with any language (PHP, Java, Ruby, Python, C#, C++, JavaScript, JQuery, Basic, ...). Use the embedded APIs explorer tool to test APIs or get generated URLs to use in your own code.
Explore the api <div align="center">
--------------- <img class="imgdoc" src="https://www.dolibarr.org//images/doc_apirest.png" alt="Dolibarr API explorer"/>
</div>
You can explore API method by using web interface : https://**yourdolibarr.tld**/mydolibarr/api/admin/explorer.php (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
Access to the API
Explore the APIs
----------------
You can explore all available APIs by using the API explorer : [**yourdolibarr.tld**/api/index.php/explorer](../api/index.php/explorer) (replace **yourdolibarr.tld** by real hostname of your Dolibarr installation)
Access to an API
----------------- -----------------
> **Warning : access to the API should (or better : must!) be secured with SSL connection** > **Warning : access to any API should (or better : must!) be secured with SSL connection**
To access to the API you need a token to identify. When you access the API for the first time, you need to log in with user name and password to get a token. **Only** this token will allow to access API with. To access to the API you need a token to identify. **Only** this token will allow to access API with.
The token is dedicated to a user and it **must** be put into requests as **DOLAPIKEY** parameter in HTTP header (or among URL parameters, but this is less secured).
To log in with the API, use this uri : https://**yourdolibarr.tld**/mydolibarr/api/index.php/login?login=**username**&password=**password** (replace bold strings with real values) To get a token you can:
The token will be saved by Dolibarr for next user accesses to the API and it **must** be put into request uri as **api_key** parameter. * Edit the user card to set the value of token. Each user can have a different token.
* or Call the *login* API with login and password. This will return the value of token for the user used to login.
Then call other services with Then call other services with
https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?api_key=**api_key** https://**yourdolibarr.tld**/mydolibarr/api/index.php/otherservice?DOLAPIKEY=**api_key**
Develop the API Develop an API
--------------- --------------
The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/ The API uses Lucarast Restler framework. Please check documentation https://www.luracast.com/products/restler and examples http://help.luracast.com/restler/examples/
Github contains also usefull informations : https://github.com/Luracast/Restler Github contains also usefull informations : https://github.com/Luracast/Restler
To implement it into Dolibarr, we need to create a specific class for object we want to use. A skeleton file is available into /dev directory : *skeleton_api_class.class.php* To implement it into Dolibarr, you need to create a specific class for object we want to use. A skeleton file is available into /modulebuilder/class directory : *api_mymodule_class.class.php*
The API class file must be put into object class directory, with specific file name. By example, API class file for '*myobject*' must be put as : /htdocs/*myobject*/class/api_*myobject*.class.php. Class must be named **MyobjectApi**. The API class file must be put into object class directory, with specific file name. By example, API class file for '*myobject*' must be put as : /htdocs/*myobject*/class/api_*myobject*.class.php. Class must be named **MyobjectApi**.
If a module provide several object, use a different name for '*myobject*' and put the file into the same directory. If a module provide several object, use a different name for *'myobject'* and put the file into the same directory.
**Define url for methods** **Define url for methods**

View File

@ -42,10 +42,11 @@ class DolibarrApi
/** /**
* Constructor * Constructor
* *
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
* @param string $cachedir Cache dir * @param string $cachedir Cache dir
* @param boolean $refreshCache Update cache
*/ */
function __construct($db, $cachedir='') function __construct($db, $cachedir='', $refreshCache=false)
{ {
global $conf; global $conf;
@ -54,7 +55,7 @@ class DolibarrApi
$this->db = $db; $this->db = $db;
$production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true ); $production_mode = ( empty($conf->global->API_PRODUCTION_MODE) ? false : true );
$this->r = new Restler($production_mode); $this->r = new Restler($production_mode, $refreshCache);
$this->r->setAPIVersion(1); $this->r->setAPIVersion(1);
} }

View File

@ -93,7 +93,7 @@ class DolibarrApiAccess implements iAuthenticate
// TODO Add option to disable use of api key on url. Return errors if used. // TODO Add option to disable use of api key on url. Return errors if used.
$api_key = $_GET['DOLAPIKEY']; // With GET method $api_key = $_GET['DOLAPIKEY']; // With GET method
} }
if (isset($_SERVER['HTTP_DOLAPIKEY'])) if (isset($_SERVER['HTTP_DOLAPIKEY'])) // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
{ {
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded) $api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
} }

View File

@ -40,7 +40,7 @@ class Login
* *
* @param string $login User login * @param string $login User login
* @param string $password User password * @param string $password User password
* @param int $entity Entity (when multicompany module is used). Empty means 1=first company. * @param string $entity Entity (when multicompany module is used). '' means 1=first company.
* @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access) * @param int $reset Reset token (0=get current token, 1=ask a new token and canceled old token. This means access using current existing API token of user will fails: new token will be required for new access)
* @return array Response status and user token * @return array Response status and user token
* *
@ -49,7 +49,7 @@ class Login
* @url GET / * @url GET /
* @url POST / * @url POST /
*/ */
public function index($login, $password, $entity=0, $reset=0) { public function index($login, $password, $entity='', $reset=0) {
global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; global $conf, $dolibarr_main_authentication, $dolibarr_auto_user;
@ -62,6 +62,8 @@ class Login
// Set authmode // Set authmode
$authmode = explode(',', $dolibarr_main_authentication); $authmode = explode(',', $dolibarr_main_authentication);
if ($entity == '') $entity=1;
include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php';
$login = checkLoginPassEntity($login, $password, $entity, $authmode); $login = checkLoginPassEntity($login, $password, $entity, $authmode);
if (empty($login)) if (empty($login))
@ -72,7 +74,7 @@ class Login
$token = 'failedtogenerateorgettoken'; $token = 'failedtogenerateorgettoken';
$tmpuser=new User($this->db); $tmpuser=new User($this->db);
$tmpuser->fetch(0, $login); $tmpuser->fetch(0, $login, 0, 0, $entity);
// Renew the hash // Renew the hash
if (empty($tmpuser->api_key) || $reset) if (empty($tmpuser->api_key) || $reset)
@ -102,7 +104,8 @@ class Login
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'token' => $token, 'token' => $token,
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.') 'entity' => $tmpuser->entity,
'message' => 'Welcome ' . $login.($reset?' - Token is new':' - This is your token (generated by a previous call). You can use it to make any REST API call, or enter it into the DOLAPIKEY field to use the Dolibarr API explorer.')
) )
); );
} }

View File

@ -21,13 +21,21 @@
* \defgroup api Module DolibarrApi * \defgroup api Module DolibarrApi
* \brief API loader * \brief API loader
* Search files htdocs/<module>/class/api_<module>.class.php * Search files htdocs/<module>/class/api_<module>.class.php
* \file htdocs/api/indexphp * \file htdocs/api/index.php
*
* @todo User authentication with api_key
*/ */
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
if (! defined("NOCSRFCHECK")) define("NOCSRFCHECK",'1'); //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); // Do not load ajax.lib.php library
if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
$res=0; $res=0;
if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php'; if (! $res && file_exists("../main.inc.php")) $res=include '../main.inc.php';
@ -67,7 +75,31 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
} }
$api = new DolibarrApi($db);
// Analyze URLs
// index.php/explorer do a redirect to index.php/explorer/
// index.php/explorer/ called by swagger to build explorer page
// index.php/explorer/.../....png|.css|.js called by swagger for resources to build explorer page
// index.php/explorer/resources.json called by swagger to get list of all services
// index.php/explorer/resources.json/xxx called by swagger to get detail of services xxx
// index.php/xxx called by any REST client to run API
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
$refreshcache=false;
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{
$refreshcache=true;
}
$api = new DolibarrApi($db, '', $refreshcache);
//var_dump($api->r->apiVersionMap);
// Enable the Restler API Explorer. // Enable the Restler API Explorer.
// See https://github.com/Luracast/Restler-API-Explorer for more info. // See https://github.com/Luracast/Restler-API-Explorer for more info.
@ -79,110 +111,82 @@ $api->r->addAuthenticationClass('DolibarrApiAccess','');
// Define accepted mime types // Define accepted mime types
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream'); UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
$listofapis = array();
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) // Call Explorer file for all APIs definitions
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
{ {
/* // Scan all API files to load them
* Search available module
*/
//dol_syslog("Scan directory ".$dir." for API modules");
$handle=@opendir(dol_osencode($dir)); $listofapis = array();
if (is_resource($handle))
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir)
{ {
while (($file = readdir($handle))!==false) // Search available module
dol_syslog("Scan directory ".$dir." for module descriptor to after search for API files");
$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
{ {
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg)) while (($file = readdir($handle))!==false)
{ {
$module = strtolower($reg[1]); if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
$moduledirforclass = $module;
$moduleforperm = $module;
if ($module == 'propale') {
$moduledirforclass = 'comm/propal';
$moduleforperm='propal';
}
elseif ($module == 'agenda') {
$moduledirforclass = 'comm/action';
}
elseif ($module == 'adherent') {
$moduledirforclass = 'adherents';
}
elseif ($module == 'banque') {
$moduledirforclass = 'compta/bank';
}
elseif ($module == 'categorie') {
$moduledirforclass = 'categories';
}
elseif ($module == 'facture') {
$moduledirforclass = 'compta/facture';
}
elseif ($module == 'project') {
$moduledirforclass = 'projet';
}
elseif ($module == 'task') {
$moduledirforclass = 'projet';
}
elseif ($module == 'stock') {
$moduledirforclass = 'product/stock';
}
elseif ($module == 'fournisseur') {
$moduledirforclass = 'fourn';
}
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
// Defined if module is enabled
$enabled=true;
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
if ($enabled)
{ {
/* $module = strtolower($reg[1]);
* If exists, load the API class for enable module $moduledirforclass = getModuleDirForApiClass($module);
* $moduleforperm = $module;
* Search files named api_<object>.class.php into /htdocs/<module>/class directory if ($module == 'propale') { $moduleforperm='propal'; }
*
* @todo : use getElementProperties() function ?
*/
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
$handle_part=@opendir(dol_osencode($dir_part)); //dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
if (is_resource($handle_part))
// Defined if module is enabled
$enabled=true;
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
if ($enabled)
{ {
while (($file_searched = readdir($handle_part))!==false) // If exists, load the API class for enable module
{ // Search files named api_<object>.class.php into /htdocs/<module>/class directory
if ($file_searched == 'api_access.class.php') continue; // @todo : use getElementProperties() function ?
$dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
// Support of the deprecated API. $handle_part=@opendir(dol_osencode($dir_part));
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg)) if (is_resource($handle_part))
{
while (($file_searched = readdir($handle_part))!==false)
{ {
$classname = ucwords($reg[1]).'Api'; if ($file_searched == 'api_access.class.php') continue;
require_once $dir_part.$file_searched;
if (class_exists($classname)) // Support of the deprecated API.
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
{ {
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched); $classname = ucwords($reg[1]).'Api';
$api->r->addAPIClass($classname, '/'); require_once $dir_part.$file_searched;
if (class_exists($classname))
{
//dol_syslog("Found deprecated API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
$api->r->addAPIClass($classname, '/');
}
else
{
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
}
} }
else elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
{ {
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING); $classname = ucwords($reg[1]);
} $classname = str_replace('_', '', $classname);
} require_once $dir_part.$file_searched;
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg)) if (class_exists($classname))
{ {
$classname = ucwords($reg[1]); //dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
$classname = str_replace('_', '', $classname); $listofapis[] = $classname;
require_once $dir_part.$file_searched; }
if (class_exists($classname)) else
{ {
//dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched); dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
$listofapis[] = $classname; }
}
else
{
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
} }
} }
} }
@ -191,20 +195,60 @@ foreach ($modulesdir as $dir)
} }
} }
} }
// Sort the classes before adding them to Restler.
// The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
sort($listofapis);
foreach ($listofapis as $classname)
{
$api->r->addAPIClass($classname);
}
} }
// Sort the classes before adding them to Restler. The Restler API Explorer // Call one APIs or one definition of an API
// shows the classes in the order they are added and it's a mess if they are if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
// not sorted.
sort($listofapis);
//var_dump($listofapis);
foreach ($listofapis as $classname)
{ {
$api->r->addAPIClass($classname); $module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service
{
$module = $regbis[1];
}
// Load a dedicated API file
dol_syslog("Load a dedicated API file");
$module=strtolower($module);
$moduledirforclass = getModuleDirForApiClass($module);
if (in_array($module, array('category','contact','customer','invoice','order','product','thirdparty','user'))) // Old Apis
{
$classfile = $module;
if ($module == 'customer') { $classfile = 'thirdparty'; }
if ($module == 'order') { $classfile = 'commande'; }
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_deprecated_'.$classfile.'.class.php');
$classname=ucwords($module);
if ($module == 'customer') { $classname='Thirdparty'; }
if ($module == 'order') { $classname='Commande'; }
//var_dump($classfile);var_dump($classname);exit;
require_once $dir_part_file;
if (class_exists($classname.'Api')) $api->r->addAPIClass($classname.'Api', '/');
}
else
{
$classfile = str_replace('_', '', $module);
if ($module == 'supplierinvoices') $classfile = 'supplier_invoices';
$dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php');
$classname=ucwords($module);
require_once $dir_part_file;
if (class_exists($classname)) $api->r->addAPIClass($classname);
}
} }
// TODO If not found, redirect to explorer // TODO If not found, redirect to explorer
//var_dump($api); //var_dump($api->r->apiVersionMap);
//exit;
// Call API (we suppose we found it) // Call API (we suppose we found it)
$api->r->handle(); $api->r->handle();

View File

@ -40,7 +40,26 @@ function printBookmarksList($aDb, $aLangs)
$langs->load("bookmarks"); $langs->load("bookmarks");
$url= $_SERVER["PHP_SELF"].(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); $url= $_SERVER["PHP_SELF"];
if (! empty($_SERVER["QUERY_STRING"]))
{
$url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):'');
}
else
{
global $sortfield,$sortorder;
$tmpurl='';
// No urlencode, all param $url will be urlencoded later
if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield;
if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder;
foreach($_POST as $key => $val)
{
if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val;
}
$url.=($tmpurl?'?'.$tmpurl:'');
}
$ret = ''; $ret = '';
@ -55,7 +74,8 @@ function printBookmarksList($aDb, $aLangs)
// Url to go on create new bookmark page // Url to go on create new bookmark page
if ($user->rights->bookmark->creer) if ($user->rights->bookmark->creer)
{ {
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url); //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;urlsource='.urlencode($url).'&amp;url='.urlencode($url);
$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&amp;url='.urlencode($url);
$ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>'; $ret.= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'">'.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).'...</option>';
} }
// Menu with all bookmarks // Menu with all bookmarks

View File

@ -39,6 +39,7 @@ $id=GETPOST("id");
$action=GETPOST("action","alpha"); $action=GETPOST("action","alpha");
$title=GETPOST("title","alpha"); $title=GETPOST("title","alpha");
$url=GETPOST("url","alpha"); $url=GETPOST("url","alpha");
$urlsource=GETPOST("urlsource","alpha");
$target=GETPOST("target","alpha"); $target=GETPOST("target","alpha");
$userid=GETPOST("userid","int"); $userid=GETPOST("userid","int");
$position=GETPOST("position","int"); $position=GETPOST("position","int");
@ -64,7 +65,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
if (GETPOST("cancel")) if (GETPOST("cancel"))
{ {
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php')); if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
@ -97,7 +98,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
if ($res > 0) if ($res > 0)
{ {
if (empty($backtopage)) $backtopage=(GETPOST("urlsource")?GETPOST("urlsource"):DOL_URL_ROOT.'/bookmarks/list.php'); if (empty($backtopage)) $backtopage=($urlsource?$urlsource:((! empty($url))?$url:DOL_URL_ROOT.'/bookmarks/list.php'));
header("Location: ".$backtopage); header("Location: ".$backtopage);
exit; exit;
} }
@ -121,6 +122,7 @@ if ($action == 'add' || $action == 'addproduct' || $action == 'update')
} }
} }
/* /*
* View * View
*/ */
@ -153,7 +155,7 @@ if ($action == 'create')
print load_fiche_titre($langs->trans("NewBookmark")); print load_fiche_titre($langs->trans("NewBookmark"));
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), 0, 'bookmark');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -161,7 +163,7 @@ if ($action == 'create')
dol_set_focus('#titlebookmark'); dol_set_focus('#titlebookmark');
// Url // Url
print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.$url.'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("UrlOrLink").'</td><td><input class="flat quatrevingtpercent" name="url" value="'.dol_escape_htmltag($url).'"></td><td class="hideonsmartphone">'.$langs->trans("UseAnExternalHttpLinkOrRelativeDolibarrLink").'</td></tr>';
// Target // Target
print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>'; print '<tr><td>'.$langs->trans("BehaviourOnClick").'</td><td>';
@ -219,7 +221,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
} }
dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); dol_fiche_head($head, $hselected, $langs->trans("Bookmark"), -1, 'bookmark');
$linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans("BackToList").'</a>';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -221,9 +221,7 @@ llxHeader("",$langs->trans("Categories"),$helpurl);
if ($user->rights->categorie->creer) if ($user->rights->categorie->creer)
{ {
/* // Create or add
* Fiche en mode creation
*/
if ($action == 'create' || $_POST["addcat"] == 'addcat') if ($action == 'create' || $_POST["addcat"] == 'addcat')
{ {
dol_set_focus('#label'); dol_set_focus('#label');
@ -246,7 +244,7 @@ if ($user->rights->categorie->creer)
// Ref // Ref
print '<tr>'; print '<tr>';
print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="flat" name="label" size="25" value="'.$label.'">'; print '<td class="titlefieldcreate fieldrequired">'.$langs->trans("Ref").'</td><td><input id="label" class="minwidth100" name="label" value="'.$label.'">';
print'</td></tr>'; print'</td></tr>';
// Description // Description
@ -263,7 +261,8 @@ if ($user->rights->categorie->creer)
// Parent category // Parent category
print '<tr><td>'.$langs->trans("AddIn").'</td><td>'; print '<tr><td>'.$langs->trans("AddIn").'</td><td>';
print $form->select_all_categories($type, $catorigin); print $form->select_all_categories($type, $catorigin, 'parent');
print ajax_combobox('parent');
print '</td></tr>'; print '</td></tr>';
$parameters=array(); $parameters=array();

View File

@ -938,7 +938,7 @@ class Categorie extends CommonObject
* *
* @return array Array of categories. this->cats and this->motherof are set. * @return array Array of categories. this->cats and this->motherof are set.
*/ */
function get_full_arbo($type,$markafterid=0) function get_full_arbo($type, $markafterid=0)
{ {
global $conf, $langs; global $conf, $langs;
@ -1434,7 +1434,7 @@ class Categorie extends CommonObject
$cats = array(); $cats = array();
// For backward compatibility // For backward compatibility
if (is_numeric( $type )) { if (is_numeric($type)) {
// We want to reverse lookup // We want to reverse lookup
$map_type = array_flip( $this->MAP_ID ); $map_type = array_flip( $this->MAP_ID );
$type = $map_type[$type]; $type = $map_type[$type];

View File

@ -36,9 +36,8 @@ $langs->load("categories");
if (! $user->rights->categorie->lire) accessforbidden(); if (! $user->rights->categorie->lire) accessforbidden();
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT); $type=(GETPOST('type','aZ09') ? GETPOST('type','aZ09') : Categorie::TYPE_PRODUCT);
$catname=GETPOST('catname','alpha'); $catname=GETPOST('catname','alpha');
$section=(GETPOST('section')?GETPOST('section'):0);
/* /*
@ -48,14 +47,15 @@ $section=(GETPOST('section')?GETPOST('section'):0);
$categstatic = new Categorie($db); $categstatic = new Categorie($db);
$form = new Form($db); $form = new Form($db);
if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea"); if ($type == Categorie::TYPE_PRODUCT) { $title=$langs->trans("ProductsCategoriesArea"); $typetext='product'; }
elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea"); elseif ($type == Categorie::TYPE_SUPPLIER) { $title=$langs->trans("SuppliersCategoriesArea"); $typetext='supplier'; }
elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea"); elseif ($type == Categorie::TYPE_CUSTOMER) { $title=$langs->trans("CustomersCategoriesArea"); $typetext='customer'; }
elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea"); elseif ($type == Categorie::TYPE_MEMBER) { $title=$langs->trans("MembersCategoriesArea"); $typetext='member'; }
elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea"); elseif ($type == Categorie::TYPE_CONTACT) { $title=$langs->trans("ContactsCategoriesArea"); $typetext='contact'; }
elseif ($type == Categorie::TYPE_ACCOUNT) $title=$langs->trans("AccountsCategoriesArea"); elseif ($type == Categorie::TYPE_ACCOUNT) { $title=$langs->trans("AccountsCategoriesArea"); $typetext='account'; }
elseif ($type == Categorie::TYPE_PROJECT) $title=$langs->trans("ProjectsCategoriesArea"); elseif ($type == Categorie::TYPE_USER) { $title=$langs->trans("UsersCategoriesArea"); $typetext='user'; }
else $title=$langs->trans("CategoriesArea"); elseif ($type == Categorie::TYPE_PROJECT) { $title=$langs->trans("ProjectsCategoriesArea"); $typetext='project'; }
else { $title=$langs->trans("CategoriesArea"); $typetext='unknown'; }
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');
@ -104,7 +104,7 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
*/ */
if ($catname || $id > 0) if ($catname || $id > 0)
{ {
$cats = $categstatic->rechercher($id,$catname,$type); $cats = $categstatic->rechercher($id, $catname, $typetext);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("FoundCats").'</td></tr>';
@ -140,7 +140,7 @@ print '<div class="fichecenter"><br>';
// Charge tableau des categories // Charge tableau des categories
$cate_arbo = $categstatic->get_full_arbo($type); $cate_arbo = $categstatic->get_full_arbo($typetext);
// Define fulltree array // Define fulltree array
$fulltree=$cate_arbo; $fulltree=$cate_arbo;

View File

@ -124,7 +124,7 @@ if ($object->id > 0)
dol_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action'); dol_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action');
$linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"'); $linkback = img_picto($langs->trans("BackToList"),'object_list','class="hideonsmartphone pictoactionview"');
$linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/index.php">'.$langs->trans("BackToList").'</a>'; $linkback.= '<a href="'.DOL_URL_ROOT.'/comm/action/listactions.php">'.$langs->trans("BackToList").'</a>';
// Link to other agenda views // Link to other agenda views
$out=''; $out='';

View File

@ -80,7 +80,7 @@ $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $limit * $page ; $offset = $limit * $page ;
if (! $sortorder) if (! $sortorder)
{ {
@ -338,6 +338,17 @@ if ($resql)
if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">';
print $nav; print $nav;
if ($user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create)
{
$newparam.='&month='.str_pad($month, 2, "0", STR_PAD_LEFT).'&year='.$year;
//$param='month='.$monthshown.'&year='.$year;
$hourminsec='100000';
$link = '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d",$year,$month,$day).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam?'?'.$newparam:'')).'">';
$link.= $langs->trans("NewAction");
$link.= '</a>';
}
print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit); print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit);
$moreforfilter=''; $moreforfilter='';
@ -497,12 +508,12 @@ if ($resql)
print '</td>'; print '</td>';
} }
// User to do // User owner
print '<td align="left">'; print '<td align="left">';
if ($obj->fk_user_action > 0) if ($obj->fk_user_action > 0)
{ {
$userstatic->fetch($obj->fk_user_action); $userstatic->fetch($obj->fk_user_action);
print $userstatic->getNomUrl(1); print $userstatic->getNomUrl(-1);
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';

View File

@ -729,8 +729,8 @@ foreach ($usernames as $username)
{ {
$var = ! $var; $var = ! $var;
echo "<tr>"; echo "<tr>";
echo '<td class="cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">'; echo '<td class="tdoverflowmax100 cal_current_month cal_peruserviewname'.($var?' cal_impair':'').'">';
print $username->getNomUrl(-1,'',0,0,24,1,''); print $username->getNomUrl(-1,'',0,0,20,1,'');
print '</td>'; print '</td>';
$tmpday = $sav; $tmpday = $sav;

View File

@ -42,7 +42,7 @@ $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha'); $sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int'); $page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $limit * $page ; $offset = $limit * $page ;
if (! $sortorder) $sortorder="DESC"; if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="a.datep"; if (! $sortfield) $sortfield="a.datep";

View File

@ -210,7 +210,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -234,7 +234,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -558,7 +558,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -663,7 +663,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -833,8 +833,8 @@ if (empty($reshook))
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if (empty($newlang) && GETPOST('lang_id')) if (empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if (empty($newlang)) if (empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -920,7 +920,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -1065,7 +1065,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records
@ -1360,7 +1360,7 @@ if ($action == 'create')
} }
} else { } else {
print '<td>'; print '<td>';
print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty'); print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{ {

View File

@ -2305,7 +2305,7 @@ class Propal extends CommonObject
if (! empty($conf->global->MAIN_MULTILANGS)) if (! empty($conf->global->MAIN_MULTILANGS))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->thirdparty->default_lang); $newlang=(GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $this->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
//$ret=$object->fetch($id); // Reload to get new records //$ret=$object->fetch($id); // Reload to get new records

View File

@ -208,8 +208,8 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -801,8 +801,8 @@ if (empty($reshook))
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if (empty($newlang) && GETPOST('lang_id')) if (empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if (empty($newlang)) if (empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -1015,8 +1015,8 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -1102,7 +1102,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1155,7 +1155,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1477,7 +1477,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td>'; print '</td>';
} else { } else {
print '<td>'; print '<td>';
print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300');
// reload page to retrieve customer informations // reload page to retrieve customer informations
if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE))
{ {

View File

@ -108,7 +108,7 @@ $offset = $limit * $page;
$pageprev = $page - 1; $pageprev = $page - 1;
$pagenext = $page + 1; $pagenext = $page + 1;
if (! $sortorder) $sortorder='ASC'; if (! $sortorder) $sortorder='ASC';
if (! $sortfield) $sortfield='b.datev'; if (! $sortfield) $sortfield='b.datev, b.dateo, b.rowid';
$mode_balance_ok=false; $mode_balance_ok=false;
//if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected //if (($sortfield == 'b.datev' || $sortfield == 'b.datev, b.dateo, b.rowid')) // TODO Manage balance when account not selected
@ -436,6 +436,7 @@ if ($id > 0 || ! empty($ref))
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>'; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
} }
print '</div>'; print '</div>';
} }
} }
@ -636,6 +637,7 @@ if ($resql)
// print '</td></tr></table>'; // print '</td></tr></table>';
} }
/// ajax to adjust value date with plus and less picto /// ajax to adjust value date with plus and less picto
print ' print '
<script type="text/javascript"> <script type="text/javascript">
@ -717,6 +719,7 @@ if ($resql)
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">'; print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['b.rowid']['checked'])) if (! empty($arrayfields['b.rowid']['checked']))
{ {
@ -855,7 +858,7 @@ if ($resql)
exit; exit;
} }
//Loop on each record // Loop on each record before
$sign = 1; $sign = 1;
$i = 0; $i = 0;
$sqlforbalance='SELECT SUM(b.amount) as balance'; $sqlforbalance='SELECT SUM(b.amount) as balance';
@ -865,7 +868,7 @@ if ($resql)
$sqlforbalance.= " WHERE b.fk_account = ba.rowid"; $sqlforbalance.= " WHERE b.fk_account = ba.rowid";
$sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account').")"; $sqlforbalance.= " AND ba.entity IN (".getEntity('bank_account').")";
$sqlforbalance.= " AND b.fk_account = ".$account; $sqlforbalance.= " AND b.fk_account = ".$account;
$sqlforbalance.= " AND b.datev < '" . $db->idate($db->jdate($objp->dv)) . "'"; $sqlforbalance.= " AND (b.datev < '" . $db->idate($db->jdate($objp->dv)) . "' OR (b.datev = '" . $db->idate($db->jdate($objp->dv)) . "' AND (b.dateo < '".$db->idate($db->jdate($objp->do))."' OR (b.dateo = '".$db->idate($db->jdate($objp->do))."' AND b.rowid < ".$objp->rowid."))))";
$resqlforbalance = $db->query($sqlforbalance); $resqlforbalance = $db->query($sqlforbalance);
//print $sqlforbalance; //print $sqlforbalance;
if ($resqlforbalance) if ($resqlforbalance)

View File

@ -464,7 +464,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -550,7 +550,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1371,7 +1371,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1586,8 +1586,8 @@ if (empty($reshook))
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if (empty($newlang) && GETPOST('lang_id')) if (empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if (empty($newlang)) if (empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -1656,7 +1656,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1832,8 +1832,8 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
@ -2732,9 +2732,9 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled)) if (!empty($conf->multicurrency->enabled))
{ {
print '<tr><td>' . $langs->trans('MulticurrencyTotalHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>'; print '<tr><td>' . $langs->trans('MulticurrencyAmountHT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ht) . '</td></tr>';
print '<tr><td>' . $langs->trans('MulticurrencyTotalVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyAmountVAT') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_tva) . "</td></tr>";
print '<tr><td>' . $langs->trans('MulticurrencyTotalTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>"; print '<tr><td>' . $langs->trans('MulticurrencyAmountTTC') . '</td><td colspan="2">' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
} }
} }

View File

@ -545,8 +545,8 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if (empty($newlang) && GETPOST('lang_id')) if (empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if (empty($newlang)) if (empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
@ -625,7 +625,7 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -810,8 +810,8 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09'))
$newlang = GETPOST('lang_id'); $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang; $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {

View File

@ -56,10 +56,10 @@ if ($action == 'builddoc')
$rap = new pdf_paiement($db); $rap = new pdf_paiement($db);
$outputlangs = $langs; $outputlangs = $langs;
if (GETPOST('lang_id')) if (GETPOST('lang_id','aZ09'))
{ {
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang(GETPOST('lang_id')); $outputlangs->setDefaultLang(GETPOST('lang_id','aZ09'));
} }
// We save charset_output to restore it because write_file can change it if needed for // We save charset_output to restore it because write_file can change it if needed for

View File

@ -251,7 +251,7 @@ if ($id)
if ($page == -1) { $page = 0 ; } if ($page == -1 || $page == null) { $page = 0 ; }
$offset = $conf->liste_limit * $page ; $offset = $conf->liste_limit * $page ;
$pageprev = $page - 1; $pageprev = $page - 1;

View File

@ -312,7 +312,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang; if (empty($newlang)) $newlang=$srcobject->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
@ -585,7 +585,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -922,7 +922,7 @@ if (empty($reshook))
$outputlangs = $langs; $outputlangs = $langs;
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$newlang = (GETPOST('lang_id') ? GETPOST('lang_id') : $object->thirdparty->default_lang); $newlang = (GETPOST('lang_id','aZ09') ? GETPOST('lang_id','aZ09') : $object->thirdparty->default_lang);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $object->fetch($id); // Reload to get new records $ret = $object->fetch($id); // Reload to get new records

View File

@ -68,7 +68,7 @@ if ($action == 'builddoc' && $permissioncreate)
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ... if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->thirdparty->default_lang)) $newlang=$object->thirdparty->default_lang; // for proposal, order, invoice, ...
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($object->default_lang)) $newlang=$object->default_lang; // for thirdparty
if (! empty($newlang)) if (! empty($newlang))

View File

@ -30,15 +30,15 @@ $dellinkid = GETPOST('dellinkid','int');
$addlinkid = GETPOST('idtolinkto','int'); $addlinkid = GETPOST('idtolinkto','int');
// Link invoice to order // Link invoice to order
if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $id > 0 && $addlinkid > 0) if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $id > 0 && $addlinkid > 0)
{ {
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$result = $object->add_object_linked(GETPOST('addlink'), $addlinkid); $result = $object->add_object_linked(GETPOST('addlink','alpha'), $addlinkid);
} }
// Delete link // Delete link
if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0) if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','alpha') && $dellinkid > 0)
{ {
$result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid);
if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); if ($result < 0) setEventMessages($object->error,$object->errors,'errors');

View File

@ -35,7 +35,7 @@ if ($action == 'up' && $permissiontoedit)
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -57,7 +57,7 @@ if ($action == 'down' && $permissiontoedit)
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);

View File

@ -400,7 +400,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
// Define output language (Here it is not used because we do only merging existing PDF) // Define output language (Here it is not used because we do only merging existing PDF)
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {

View File

@ -32,7 +32,7 @@
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) if (GETPOST('addfile','alpha'))
{ {
$trackid = GETPOST('trackid','aZ09'); $trackid = GETPOST('trackid','aZ09');
@ -68,7 +68,7 @@ if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
/* /*
* Remove all files in email form * Remove all files in email form
*/ */
if (GETPOST('removAll')) if (GETPOST('removAll','alpha'))
{ {
$trackid = GETPOST('trackid','aZ09'); $trackid = GETPOST('trackid','aZ09');
@ -447,7 +447,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
{ {
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings'); setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
dol_syslog('Try to send email with no recipiend defined', LOG_WARNING); dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
$action = 'presend'; $action = 'presend';
} }
} }

View File

@ -162,21 +162,13 @@ if ($type == 'directory')
// Auto area for suppliers invoices // Auto area for suppliers invoices
else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output; else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output;
// Auto area for suppliers invoices // Auto area for suppliers invoices
else if ($module == 'invoice_supplier') else if ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
{
$relativepath='facture';
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
}
// Auto area for customers orders // Auto area for customers orders
else if ($module == 'propal') $upload_dir = $conf->propal->dir_output; else if ($module == 'propal') $upload_dir = $conf->propal->dir_output;
// Auto area for customers orders // Auto area for customers orders
else if ($module == 'order') $upload_dir = $conf->commande->dir_output; else if ($module == 'order') $upload_dir = $conf->commande->dir_output;
// Auto area for suppliers orders // Auto area for suppliers orders
else if ($module == 'order_supplier') else if ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
{
$relativepath='commande';
$upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
}
// Auto area for suppliers invoices // Auto area for suppliers invoices
else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output; else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output;
// Auto area for products // Auto area for products
@ -198,6 +190,8 @@ if ($type == 'directory')
$param.='&module='.$module; $param.='&module='.$module;
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound"))); $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
if ($module == 'company') $excludefiles[]='^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1); $filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url); $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -20,7 +20,7 @@
/** /**
* \file htdocs/core/boxes/box_services_contracts.php * \file htdocs/core/boxes/box_services_contracts.php
* \ingroup produits,services * \ingroup produits,services
* \brief Module de generation de l'affichage de la box services_vendus * \brief Widget of sells products
*/ */
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
@ -124,7 +124,7 @@ class box_services_contracts extends ModeleBoxes
$thirdpartytmp->id = $objp->socid; $thirdpartytmp->id = $objp->socid;
// Multilangs // Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active if (! empty($conf->global->MAIN_MULTILANGS) && $objp->product_id > 0) // if option multilang is on
{ {
$sqld = "SELECT label"; $sqld = "SELECT label";
$sqld.= " FROM ".MAIN_DB_PREFIX."product_lang"; $sqld.= " FROM ".MAIN_DB_PREFIX."product_lang";

View File

@ -285,10 +285,8 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
{ {
if (isset($contents[$i])) if (isset($contents[$i]))
{ {
// TR // TR
if (isset($contents[$i][0]['tr'])) $out.= '<tr valign="top" '.$contents[$i][0]['tr'].'>'; if (isset($contents[$i][0]['tr'])) $out.= '<tr class="tdtop" '.$contents[$i][0]['tr'].'>';
else $out.= '<tr class="oddeven">'; else $out.= '<tr class="oddeven">';
// Loop on each TD // Loop on each TD

View File

@ -1486,7 +1486,7 @@ abstract class CommonObject
$fieldname = 'multicurrency_code'; $fieldname = 'multicurrency_code';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql .= ' SET '.$fieldname.' = "'.$this->db->escape($code).'"'; $sql .= ' SET '.$fieldname." = '".$this->db->escape($code)."'";
$sql .= ' WHERE rowid='.$this->id; $sql .= ' WHERE rowid='.$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
@ -3510,7 +3510,7 @@ abstract class CommonObject
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->thirdparty->default_lang; // For language to language of customer if (! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) && empty($newlang)) $newlang=$this->thirdparty->default_lang; // For language to language of customer
if (! empty($newlang)) if (! empty($newlang))
{ {

View File

@ -488,8 +488,8 @@ class Conf
// By default, we propagate contacts // By default, we propagate contacts
if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented) if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
// By default, we use the zip town autofill // By default, we do not use the zip town table but the table of third parties
if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=1; if (! isset($this->global->MAIN_USE_ZIPTOWN_DICTIONNARY)) $this->global->MAIN_USE_ZIPTOWN_DICTIONNARY=0;
// By default, we open card if one found // By default, we open card if one found
if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1; if (! isset($this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE)) $this->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE=1;

View File

@ -995,7 +995,7 @@ class Form
unset($societetmp); unset($societetmp);
} }
// mode 1 // mode 1
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter; $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:'');
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.='<style type="text/css"> $out.='<style type="text/css">
.ui-autocomplete { .ui-autocomplete {
@ -3463,7 +3463,7 @@ class Form
$cate_arbo = $cat->get_full_arbo($type,$excludeafterid); $cate_arbo = $cat->get_full_arbo($type,$excludeafterid);
} }
$output = '<select class="flat" name="'.$htmlname.'">'; $output = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
$outarray=array(); $outarray=array();
if (is_array($cate_arbo)) if (is_array($cate_arbo))
{ {
@ -4475,7 +4475,7 @@ class Form
* Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle.
* Sinon la TVA proposee par defaut=0. Fin de regle. * Sinon la TVA proposee par defaut=0. Fin de regle.
* @param bool $options_only Return HTML options lines only (for ajax treatment) * @param bool $options_only Return HTML options lines only (for ajax treatment)
* @param int $mode 1=Add code into key in select list * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key
* @return string * @return string
*/ */
function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0)

View File

@ -266,7 +266,7 @@ class FormAccounting extends Form
} }
else else
{ {
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50; $trunclength = empty($conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT) ? 50 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT;
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version"; $sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";

View File

@ -690,6 +690,7 @@ class FormFile
{ {
$headershown=1; $headershown=1;
$out.= '<div class="titre">'.$titletoshow.'</div>'."\n"; $out.= '<div class="titre">'.$titletoshow.'</div>'."\n";
$out.= '<div class="div-table-responsive-no-min">';
$out.= '<table class="noborder" summary="listofdocumentstable" id="'.$modulepart.'_table" width="100%">'."\n"; $out.= '<table class="noborder" summary="listofdocumentstable" id="'.$modulepart.'_table" width="100%">'."\n";
} }
@ -1001,6 +1002,7 @@ class FormFile
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="modulepart" value="'.$modulepart.'">'; print '<input type="hidden" name="modulepart" value="'.$modulepart.'">';
} }
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n"; print '<table width="100%" id="tablelines" class="'.($useinecm?'liste noborder':'liste').'">'."\n";
@ -1105,8 +1107,6 @@ class FormFile
&& $file['name'] != '..' && $file['name'] != '..'
&& ! preg_match('/\.meta$/i',$file['name'])) && ! preg_match('/\.meta$/i',$file['name']))
{ {
if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid']; if ($filearray[$key]['rowid'] > 0) $lastrowid = $filearray[$key]['rowid'];
$editline=0; $editline=0;

View File

@ -528,7 +528,12 @@ class FormMail extends Form
{ {
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
} }
$out.= $form->multiselectarray("receiver", $tmparray, GETPOST("receiver"), null, null, 'inline-block minwidth500', null, ""); $withtoselected=GETPOST("receiver"); // Array of selected value
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action','aZ09') == 'presend')
{
$withtoselected = array_keys($tmparray);
}
$out.= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
} }
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
@ -556,7 +561,8 @@ class FormMail extends Form
{ {
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
} }
$out.= $form->multiselectarray("receivercc", $tmparray, GETPOST("receivercc"), null, null, 'inline-block minwidth500',null, ""); $withtoccselected=GETPOST("receivercc"); // Array of selected value
$out.= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500',null, "");
} }
} }
$out.= "</td></tr>\n"; $out.= "</td></tr>\n";
@ -584,8 +590,8 @@ class FormMail extends Form
{ {
$tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key]=dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
} }
//$out.= $form->selectarray("receiverccc", $this->withtoccc, GETPOST("receiverccc"), 1); $withtocccselected=GETPOST("receiverccc"); // Array of selected value
$out.= $form->multiselectarray("receiverccc", $tmparray, GETPOST("receiverccc"), null, null, null,null, "90%"); $out.= $form->multiselectarray("receiverccc", $tmparray, $withtocccselected, null, null, null,null, "90%");
} }
} }

View File

@ -51,7 +51,7 @@ class Menu
/** /**
* Add a menu entry into this->liste (at end) * Add a menu entry into this->liste (at end)
* *
* @param string $url Url to follow on click * @param string $url Url to follow on click (does not include DOL_URL_ROOT)
* @param string $titre Label of menu to add * @param string $titre Label of menu to add
* @param integer $level Level of menu to add * @param integer $level Level of menu to add
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey) * @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
@ -59,11 +59,14 @@ class Menu
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...) * @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...) * @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
* @param int $position Position (not used yet) * @param int $position Position (not used yet)
* @param string $id Id
* @param string $idsel Id sel
* @param string $classname Class name
* @return void * @return void
*/ */
function add($url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0) function add($url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0, $id='', $idsel='', $classname='')
{ {
$this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position); $this->liste[]=array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu, 'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname);
} }
/** /**
@ -78,12 +81,15 @@ class Menu
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...) * @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...) * @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
* @param int $position Position (not used yet) * @param int $position Position (not used yet)
* @param string $id Id
* @param string $idsel Id sel
* @param string $classname Class name
* @return void * @return void
*/ */
function insert($idafter, $url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0) function insert($idafter, $url, $titre, $level=0, $enabled=1, $target='',$mainmenu='',$leftmenu='',$position=0, $id='', $idsel='', $classname='')
{ {
$array_start = array_slice($this->liste,0,($idafter+1)); $array_start = array_slice($this->liste,0,($idafter+1));
$array_new = array(0=>array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu,'position'=>$position)); $array_new = array(0=>array('url'=>$url,'titre'=>$titre,'level'=>$level,'enabled'=>$enabled,'target'=>$target,'mainmenu'=>$mainmenu,'leftmenu'=>$leftmenu,'position'=>$position, 'id'=>$id, 'idsel'=>$idsel, 'classname'=>$classname));
$array_end = array_slice($this->liste,($idafter+1)); $array_end = array_slice($this->liste,($idafter+1));
$this->liste=array_merge($array_start,$array_new,$array_end); $this->liste=array_merge($array_start,$array_new,$array_end);
} }

View File

@ -602,7 +602,7 @@ class Menubase
//$tabMenu[$b]['langs'] = $menu['langs']; //$tabMenu[$b]['langs'] = $menu['langs'];
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu']; $tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu']; $tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
$tabMenu[$b]['position'] = $menu['position']; $tabMenu[$b]['position'] = (int) $menu['position'];
$b++; $b++;
} }

View File

@ -93,6 +93,16 @@ print '
background-position-y: 16px; background-position-y: 16px;
padding: 1em 15px 1em 40px; padding: 1em 15px 1em 40px;
} }
li.lilevel0 font.vsmenudisabled {
/* background-image: url(/dolibarr_dev/htdocs/theme/eldy/img/next.png) !important; */
background-repeat: no-repeat !important;
background-position-x: 10px;
background-position-y: 16px;
padding: 1em 15px 1em 40px;
background: #f8f8f8;
display: block;
font-size: 16px !important;
}
li.lilevel1 { li.lilevel1 {
padding: 1em 15px 0.5em 40px; padding: 1em 15px 0.5em 40px;
border-top: 1px solid #aaa; border-top: 1px solid #aaa;
@ -184,7 +194,7 @@ if (! class_exists('MenuManager'))
} }
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1); $menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
$menumanager->loadMenu('all','all'); $menumanager->loadMenu('all','all');
//var_dump($menumanager->tabMenu);exit; //var_dump($menumanager);exit;
$menumanager->showmenu('jmobile'); $menumanager->showmenu('jmobile');
print '</body>'; print '</body>';

View File

@ -506,6 +506,11 @@ function calendars_prepare_head($param)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:''); $head[$h][0] = DOL_URL_ROOT.'/comm/action/index.php?action=show_day'.($param?'&'.$param:'');
$head[$h][1] = $langs->trans("ViewDay"); $head[$h][1] = $langs->trans("ViewDay");
$head[$h][2] = 'cardday'; $head[$h][2] = 'cardday';
@ -535,10 +540,6 @@ function calendars_prepare_head($param)
$head[$h][2] = 'cardperuser'; $head[$h][2] = 'cardperuser';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/action/listactions.php'.($param?'?'.$param:'');
$head[$h][1] = $langs->trans("ViewList");
$head[$h][2] = 'cardlist';
$h++;
$object=new stdClass(); $object=new stdClass();

View File

@ -37,9 +37,9 @@
* @param int $autoselect Automatic selection if just one value * @param int $autoselect Automatic selection if just one value
* @param array $ajaxoptions Multiple options array * @param array $ajaxoptions Multiple options array
* Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done * Ex: array('update'=>array('field1','field2'...)) will reset field1 and field2 once select done
* Ex: array('disabled'=> * Ex: array('disabled'=> )
* Ex: array('show'=> * Ex: array('show'=> )
* Ex: array('update_textarea'=> * Ex: array('update_textarea'=> )
* @return string Script * @return string Script
*/ */
function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array())
@ -392,7 +392,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
$tmpplugin='select2'; $tmpplugin='select2';
$msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> $msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id = '.$htmlname.' -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({ $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({

View File

@ -421,23 +421,28 @@ function getState($id,$withcode='',$dbtouse=0)
} }
/** /**
* Retourne le nom traduit ou code+nom d'une devise * Return label of currency or code+label
* *
* @param string $code_iso Code iso de la devise * @param string $code_iso Code iso of currency
* @param int $withcode '1'=affiche code + nom * @param int $withcode '1'=show code + label
* @return string Nom traduit de la devise * @param Translate $outputlangs Output language
* @return string Label translated of currency
*/ */
function currency_name($code_iso,$withcode='') function currency_name($code_iso, $withcode='', $outputlangs=null)
{ {
global $langs,$db; global $langs,$db;
// Si il existe une traduction, on peut renvoyer de suite le libelle if (empty($outputlangs)) $outputlangs=$langs;
if ($langs->trans("Currency".$code_iso)!="Currency".$code_iso)
$outputlangs->load("dict");
// If there is a translation, we can send immediatly the label
if ($outputlangs->trans("Currency".$code_iso)!="Currency".$code_iso)
{ {
return $langs->trans("Currency".$code_iso); return ($withcode?$code_iso.' - ':'').$outputlangs->trans("Currency".$code_iso);
} }
// Si pas de traduction, on consulte le libelle par defaut en table // If no translation, we read table to get label by default
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."c_currencies";
$sql.= " WHERE code_iso='".$code_iso."'"; $sql.= " WHERE code_iso='".$code_iso."'";
@ -457,8 +462,8 @@ function currency_name($code_iso,$withcode='')
{ {
return $code_iso; return $code_iso;
} }
} }
return 'ErrorWhenReadingCurrencyLabel';
} }
/** /**

View File

@ -248,7 +248,7 @@ function dol_shutdown()
* @param string $check Type of check * @param string $check Type of check
* ''=no check (deprecated) * ''=no check (deprecated)
* 'none'=no check (only for param that should have very rich content) * 'none'=no check (only for param that should have very rich content)
* 'int'=check it's numeric * 'int'=check it's numeric (integer or float)
* 'alpha'=check it's text and sign * 'alpha'=check it's text and sign
* 'aZ'=check it's a-z only * 'aZ'=check it's a-z only
* 'aZ09'=check it's simple alpha string (recommended for keys) * 'aZ09'=check it's simple alpha string (recommended for keys)
@ -749,7 +749,8 @@ function dol_string_unaccent($str)
} }
/** /**
* Clean a string from all punctuation characters to use it as a ref or login * Clean a string from all punctuation characters to use it as a ref or login.
* This is a more complete function than dol_sanitizeFileName.
* *
* @param string $str String to clean * @param string $str String to clean
* @param string $newstr String to replace forbidden chars with * @param string $newstr String to replace forbidden chars with
@ -760,7 +761,7 @@ function dol_string_unaccent($str)
*/ */
function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='') function dol_string_nospecial($str,$newstr='_',$badcharstoreplace='')
{ {
$forbidden_chars_to_replace=array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "="); $forbidden_chars_to_replace=array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
$forbidden_chars_to_remove=array(); $forbidden_chars_to_remove=array();
if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace; if (is_array($badcharstoreplace)) $forbidden_chars_to_replace=$badcharstoreplace;
//$forbidden_chars_to_remove=array("(",")"); //$forbidden_chars_to_remove=array("(",")");
@ -3458,7 +3459,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png',
* @param string $titre Title to show (required) * @param string $titre Title to show (required)
* @param int $page Numero of page to show in navigation links (required) * @param int $page Numero of page to show in navigation links (required)
* @param string $file Url of page (required) * @param string $file Url of page (required)
* @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder) * @param string $options More parameters for links ('' by default, does not include sortfield neither sortorder). Value must be 'urlencoded' before calling function.
* @param string $sortfield Field to sort on ('' by default) * @param string $sortfield Field to sort on ('' by default)
* @param string $sortorder Order to sort ('' by default) * @param string $sortorder Order to sort ('' by default)
* @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction() * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction()
@ -4162,7 +4163,7 @@ function getTaxesFromId($vatrate, $buyer=null, $seller=null, $firstparamisid=1)
* @param Societe $buyer Company object * @param Societe $buyer Company object
* @param Societe $seller Company object * @param Societe $seller Company object
* @param int $firstparamisid 1 if first param is id into table (use this if you can) * @param int $firstparamisid 1 if first param is id into table (use this if you can)
* @return array array(localtax_type1(1-6 / 0 if not found), rate of localtax1, ...) * @return array array(localtax_type1(1-6/0 if not found), rate localtax1, localtax_type1, rate localtax2, accountancycodecust, accountancycodesupp)
* @see getTaxesFromId * @see getTaxesFromId
*/ */
function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0) function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisid=0)
@ -4200,22 +4201,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
{ {
if (! isOnlyOneLocalTax(1)) if (! isOnlyOneLocalTax(1))
{ {
return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, get_localtax($vatrate, $local, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
else else
{ {
return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, $obj->localtax1,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
} }
elseif ($local == 2) elseif ($local == 2)
{ {
if (! isOnlyOneLocalTax(2)) if (! isOnlyOneLocalTax(2))
{ {
return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax2_type, get_localtax($vatrate, $local, $buyer, $seller),$obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
else else
{ {
return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
} }
else else
@ -4224,22 +4225,22 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi
{ {
if(! isOnlyOneLocalTax(2)) if(! isOnlyOneLocalTax(2))
{ {
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller),$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell,$obj->accountancy_code_buy);
} }
else else
{ {
return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, get_localtax($vatrate, 1, $buyer, $seller), $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
} }
else else
{ {
if(! isOnlyOneLocalTax(2)) if(! isOnlyOneLocalTax(2))
{ {
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type,get_localtax($vatrate, 2, $buyer, $seller) ,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, get_localtax($vatrate, 2, $buyer, $seller), $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
else else
{ {
return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2,$obj->accountancy_code_sell,$obj->accountancy_code_buy); return array($obj->localtax1_type, $obj->localtax1, $obj->localtax2_type, $obj->localtax2, $obj->accountancy_code_sell, $obj->accountancy_code_buy);
} }
} }
} }
@ -6094,13 +6095,13 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
/** /**
* Set focus onto field with selector * Set focus onto field with selector
* *
* @param string $selector Selector ('#id') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char. * @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @return string HTML code to set focus * @return string HTML code to set focus
*/ */
function dol_set_focus($selector) function dol_set_focus($selector)
{ {
print "\n".'<!-- Set focus onto a specific field -->'."\n"; print "\n".'<!-- Set focus onto a specific field -->'."\n";
print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.$selector.'").focus(); });</script>'."\n"; print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n";
} }

View File

@ -2121,8 +2121,8 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
* Applies the Cartesian product algorithm to an array * Applies the Cartesian product algorithm to an array
* Source: http://stackoverflow.com/a/15973172 * Source: http://stackoverflow.com/a/15973172
* *
* @param array $input Array of products * @param array $input Array of products
* @return array Array of combinations * @return array Array of combinations
*/ */
function cartesianArray(array $input) { function cartesianArray(array $input) {
// filter out empty values // filter out empty values
@ -2145,3 +2145,70 @@ function cartesianArray(array $input) {
return $result; return $result;
} }
/**
* Get name of directory where the api_...class.php file is stored
*
* @param string $module Module name
* @return string Directory name
*/
function getModuleDirForApiClass($module)
{
$moduledirforclass=$module;
if (in_array($module, array('login', 'access', 'status', 'documents'))) {
$moduledirforclass = 'api';
}
if (preg_match('/^dictionary/', $module)) {
$moduledirforclass = 'api';
}
if ($module == 'contact' || $module == 'contacts' || $module == 'customer' || $module == 'thirdparty' || $module == 'thirdparties') {
$moduledirforclass = 'societe';
}
if ($module == 'propale' || $module == 'proposals') {
$moduledirforclass = 'comm/propal';
}
elseif ($module == 'agenda' || $module == 'agendaevents') {
$moduledirforclass = 'comm/action';
}
elseif ($module == 'adherent' || $module == 'members' || $module == 'memberstypes' || $module == 'subscriptions') {
$moduledirforclass = 'adherents';
}
elseif ($module == 'banque' || $module == 'bankaccounts') {
$moduledirforclass = 'compta/bank';
}
elseif ($module == 'category' || $module == 'categorie') {
$moduledirforclass = 'categories';
}
elseif ($module == 'order' || $module == 'orders') {
$moduledirforclass = 'commande';
}
elseif ($module == 'facture' || $module == 'invoice' || $module == 'invoices') {
$moduledirforclass = 'compta/facture';
}
elseif ($module == 'products') {
$moduledirforclass = 'product';
}
elseif ($module == 'project' || $module == 'projects' || $module == 'tasks') {
$moduledirforclass = 'projet';
}
elseif ($module == 'task') {
$moduledirforclass = 'projet';
}
elseif ($module == 'stock' || $module == 'stockmovements' || $module == 'warehouses') {
$moduledirforclass = 'product/stock';
}
elseif ($module == 'fournisseur' || $module == 'supplierinvoices') {
$moduledirforclass = 'fourn';
}
elseif ($module == 'expensereports') {
$moduledirforclass = 'expensereport';
}
elseif ($module == 'users') {
$moduledirforclass = 'user';
}
return $moduledirforclass;
}

View File

@ -1068,10 +1068,10 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
// Show page nb only on iso languages (so default Helvetica font) // Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica')
{ {
$pdf->SetXY(-20,-$posy); $pdf->SetXY($dims['wk']-$dims['rm']-15, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit; //print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(13, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0); if (empty($conf->global->MAIN_USE_FPDF)) $pdf->MultiCell(15, 2, $pdf->PageNo().'/'.$pdf->getAliasNbPages(), 0, 'R', 0);
else $pdf->MultiCell(13, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); else $pdf->MultiCell(15, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
return $marginwithfooter; return $marginwithfooter;

View File

@ -212,6 +212,7 @@ 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', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __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', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
-- Setup -- Setup
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', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 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', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2454__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
@ -221,6 +222,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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __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 && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__);
-- Accounting period
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 && $leftmenu=="accountancy_admin" && $conf->global->MAIN_FEATURES_LEVEL > 0', __HANDLER__, 'left', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2451__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'FiscalPeriod', 1, 'admin', '', '', 2, 80, __ENTITY__);
-- Binding -- Binding
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', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __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', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __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 && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __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 && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);
@ -246,8 +249,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 && $leftmenu=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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 && $leftmenu=="ca"', __HANDLER__, 'left', 2445__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 22, __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 && $leftmenu=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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 && $leftmenu=="ca"', __HANDLER__, 'left', 2446__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 23, __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 && $leftmenu=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __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 && $leftmenu=="ca"', __HANDLER__, 'left', 2447__+MAX_llx_menu__, 'accountancy', '', 2440__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 3, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 24, __ENTITY__);
-- Accounting period
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', 2450__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_period', 2400__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?mainmenu=setup', 'FiscalPeriod', 1, 'admin', '', '', 2, 4, __ENTITY__);
-- Rapports compta simple -- Rapports compta simple
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', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __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->comptabilite->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&amp;mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __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->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __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->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__);

View File

@ -62,10 +62,7 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel='menu'; $idsel='menu';
if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry_auguria('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry_auguria($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
} }
$num = count($newTabMenu); $num = count($newTabMenu);
@ -84,10 +81,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); $param = (isset($tmp[1])?$tmp[1]:'');
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
{ {
$param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['url'].'&leftmenu='; $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
} }
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
{ {
@ -95,7 +92,10 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
} }
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
$url = dol_buildpath($url,1).($param?'?'.$param:''); $url = dol_buildpath($url,1).($param?'?'.$param:'');
$shorturl = $shorturl.($param?'?'.$param:''); //$shorturl = $shorturl.($param?'?'.$param:'');
$shorturl = $url;
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
} }
$url=preg_replace('/__LOGIN__/',$user->login,$url); $url=preg_replace('/__LOGIN__/',$user->login,$url);
@ -118,10 +118,18 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
} }
else if ($showmode == 2) $classname='class="tmenu"'; else if ($showmode == 2) $classname='class="tmenu"';
if (empty($noout)) print_start_menu_entry_auguria($idsel,$classname,$showmode); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu']?$newTabMenu[$i]['leftmenu']:''), $newTabMenu[$i]['position'], $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry_auguria($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); }
if (empty($noout)) print_end_menu_entry_auguria($showmode);
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); // Sort on position
$menu->liste = dol_sort_array($menu->liste, 'position');
// Output menu entries
foreach($menu->liste as $menkey => $menuval)
{
if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']);
} }
$showmode=1; $showmode=1;
@ -293,6 +301,16 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
print "<!-- End SearchForm -->\n"; print "<!-- End SearchForm -->\n";
} }
if (is_array($moredata) && ! empty($moredata['bookmarks']))
{
print "\n";
print "<!-- Begin Bookmarks -->\n";
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
print $moredata['bookmarks'];
print '</div>'."\n";
print "<!-- End Bookmarks -->\n";
}
// We update newmenu with entries found into database // We update newmenu with entries found into database
$menuArbo = new Menubase($db,'auguria'); $menuArbo = new Menubase($db,'auguria');
$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu); $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
@ -556,16 +574,6 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block
} }
if (is_array($moredata) && ! empty($moredata['bookmarks']))
{
print "\n";
print "<!-- Begin Bookmarks -->\n";
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
print $moredata['bookmarks'];
print '</div>'."\n";
print "<!-- End Bookmarks -->\n";
}
return count($menu_array); return count($menu_array);
} }

View File

@ -60,10 +60,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel='menu'; $idsel='menu';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
} }
// Home // Home
@ -73,10 +70,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='home'; $idsel='home';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("Home"), 1, DOL_URL_ROOT.'/index.php?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/index.php?mainmenu=home&amp;leftmenu=home', $langs->trans("Home"), 0, $showmode, $atarget, "home", '');
// Third parties // Third parties
$tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur'); $tmpentry=array('enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), 'module'=>'societe|fournisseur');
@ -91,10 +85,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='companies'; $idsel='companies';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '', 20, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/societe/index.php?mainmenu=companies&amp;leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '');
} }
// Products-Services // Products-Services
@ -120,10 +111,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$chaine.=$langs->trans("TMenuServices"); $chaine.=$langs->trans("TMenuServices");
} }
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($chaine, $showmode, DOL_URL_ROOT.'/product/index.php?mainmenu=products&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/product/index.php?mainmenu=products&amp;leftmenu=', $chaine, 0, $showmode, $atarget, "products", '');
} }
// Commercial // Commercial
@ -147,10 +135,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='commercial'; $idsel='commercial';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("Commercial"), $showmode, DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/comm/index.php?mainmenu=commercial&amp;leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "");
} }
// Financial // Financial
@ -177,10 +162,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='accountancy'; $idsel='accountancy';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '', 50, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuFinancial"), $showmode, DOL_URL_ROOT.'/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/compta/index.php?mainmenu=accountancy&amp;leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "accountancy", '');
} }
// Bank // Bank
@ -198,10 +180,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='bank'; $idsel='bank';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 60, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuBankCash"), $showmode, DOL_URL_ROOT.'/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/compta/bank/index.php?mainmenu=bank&amp;leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '');
} }
// Projects // Projects
@ -218,10 +197,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='project'; $idsel='project';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '', 70, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("Projects"), $showmode, DOL_URL_ROOT.'/projet/index.php?mainmenu=project&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/projet/index.php?mainmenu=project&amp;leftmenu=', $langs->trans("Projects"), 0, $showmode, $atarget, "project", '');
} }
// HRM // HRM
@ -238,10 +214,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='hrm'; $idsel='hrm';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("HRM"), $showmode, DOL_URL_ROOT.'/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/hrm/index.php?mainmenu=hrm&amp;leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '');
} }
@ -260,10 +233,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='tools'; $idsel='tools';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("TMenuTools"), $showmode, DOL_URL_ROOT.'/core/tools.php?mainmenu=tools&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/core/tools.php?mainmenu=tools&amp;leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '');
} }
// Members // Members
@ -278,10 +248,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
else $classname = 'class="tmenu"'; else $classname = 'class="tmenu"';
$idsel='members'; $idsel='members';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($langs->trans("MenuMembers"), $showmode, DOL_URL_ROOT.'/adherents/index.php?mainmenu=members&amp;leftmenu=', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('/adherents/index.php?mainmenu=members&amp;leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '');
} }
@ -297,6 +264,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
$showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal); $showmode=dol_eldy_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
if ($showmode == 1) if ($showmode == 1)
{ {
// url = url from host, shorturl = relative path into dolibarr sources
$url = $shorturl = $newTabMenu[$i]['url']; $url = $shorturl = $newTabMenu[$i]['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
{ {
@ -307,7 +275,9 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&amp;leftmenu='; if (! preg_match('/mainmenu/i',$param) || ! preg_match('/leftmenu/i',$param)) $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&amp;leftmenu=';
//$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
$url = dol_buildpath($url,1).($param?'?'.$param:''); $url = dol_buildpath($url,1).($param?'?'.$param:'');
$shorturl = $shorturl.($param?'?'.$param:''); //$shorturl = $shorturl.($param?'?'.$param:'');
$shorturl = $url;
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
} }
$url=preg_replace('/__LOGIN__/',$user->login,$url); $url=preg_replace('/__LOGIN__/',$user->login,$url);
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl); $shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
@ -321,10 +291,18 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
} }
else if ($showmode == 2) $classname='class="tmenu"'; else if ($showmode == 2) $classname='class="tmenu"';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu']?$newTabMenu[$i]['leftmenu']:''), $newTabMenu[$i]['position'], $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry($newTabMenu[$i]['titre'], $showmode, $url, $id, $idsel, $classname, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget)); }
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ''); // Sort on position
$menu->liste = dol_sort_array($menu->liste, 'position');
// Output menu entries
foreach($menu->liste as $menkey => $menuval)
{
if (empty($noout)) print_start_menu_entry($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry($menuval['enabled']);
} }
$showmode=1; $showmode=1;
@ -978,7 +956,13 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{ {
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47); if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
}*/ }*/
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60);
// Fiscal year
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("FiscalPeriod"), 2, $user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
}
// Binding // Binding
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer'); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
@ -1102,12 +1086,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/casoc.php?leftmenu=accountancy_report",$langs->trans("ByCompanies"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyuser.php?leftmenu=accountancy_report",$langs->trans("ByUsers"),3,$user->rights->accounting->comptarapport->lire);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire); if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_report/',$leftmenu)) $newmenu->add("/compta/stats/cabyprodserv.php?leftmenu=accountancy_report", $langs->trans("ByProductsAndServices"),3,$user->rights->accounting->comptarapport->lire);
// Fiscal year
if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods.
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_periods", $langs->trans("FiscalPeriod"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear');
}
} }
// Accountancy (simple) // Accountancy (simple)
@ -1605,7 +1583,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$url = $shorturl = $tmp[0]; $url = $shorturl = $tmp[0];
$param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link $param = (isset($tmp[1])?$tmp[1]:''); // params in url of the menu link
// Complete param to force leftmenu to '' to closed opend menu when we click on a link with no leftmenu defined. // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu'])) if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($menu_array[$i]['mainmenu']))
{ {
$param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu='; $param.=($param?'&':'').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';

View File

@ -76,39 +76,47 @@ class MenuManager
$res='ErrorBadParameterForMode'; $res='ErrorBadParameterForMode';
$noout=0; $noout=0;
if ($mode == 'jmobile') $noout=1; //if ($mode == 'jmobile') $noout=1;
if ($mode == 'topnb') if ($mode == 'topnb')
{ {
return 1; return 1;
} }
if ($mode == 'top' || $mode == 'jmobile') if ($mode == 'top')
{ {
if (empty($noout)) print_start_menu_array_empty(); if (empty($noout)) print_start_menu_array_empty();
// Home $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
$showmode=1;
$idsel='home';
$classname='class="tmenusel"';
// Show/Hide vertical menu // Show/Hide vertical menu
if ($mode != 'jmobile' && $mode != 'topnb' && (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{ {
$showmode=1; $showmode=1;
$classname = 'class="tmenu menuhider"'; $classname = 'class="tmenu menuhider"';
$idsel='menu'; $idsel='menu';
if (empty($noout)) print_start_menu_entry($idsel,$classname,$showmode); $this->menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
if (empty($noout)) print_text_menu_entry('', 1, '#', $id, $idsel, $classname, $atarget);
if (empty($noout)) print_end_menu_entry($showmode);
$menu->add('#', '', 0, $showmode, $atarget, "xxx", '');
} }
if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode); // Home
if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&amp;leftmenu=', $id, $idsel, $classname, $this->atarget); $showmode=1;
if (empty($noout)) print_end_menu_entry_empty($showmode); $classname='class="tmenusel"';
$this->menu->add(dol_buildpath('/index.php',1), $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', ''); $idsel='home';
$this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
// Sort on position
$this->menu->liste = dol_sort_array($this->menu->liste, 'position');
// Output menu entries
foreach($this->menu->liste as $menkey => $menuval)
{
if (empty($noout)) print_start_menu_entry_empty($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
if (empty($noout)) print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
if (empty($noout)) print_end_menu_entry_empty($menuval['enabled']);
}
$showmode=1; $showmode=1;
if (empty($noout)) print_start_menu_entry_empty('','class="tmenuend"',$showmode); if (empty($noout)) print_start_menu_entry_empty('','class="tmenuend"',$showmode);
@ -123,7 +131,195 @@ class MenuManager
} }
} }
if ($mode == 'left' || $mode == 'jmobile') if ($mode == 'jmobile') // Used to get menu in xml ul/li
{
// Home
$showmode=1;
$classname='class="tmenusel"';
$idsel='home';
$this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
// $this->menu->liste is top menu
//var_dump($this->menu->liste);exit;
$lastlevel = array();
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">';
if ($val['enabled'] == 1)
{
$relurl=dol_buildpath($val['url'],1);
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
$canonurl=preg_replace('/\?.*$/','',$val['url']);
print '<a class="alilevel0" href="#">';
// Add font-awesome
if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
print $val['titre'];
print '</a>'."\n";
// Search submenu fot this mainmenu entry
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
$langs->load("admin"); // Load translation file admin.lang
$submenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
$submenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
$submenu->add("/admin/modules.php", $langs->trans("Modules"),1);
$submenu->add("/admin/menus.php", $langs->trans("Menus"),1);
$submenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
$submenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
$submenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
$submenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
$submenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
$submenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
$submenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
$submenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
$submenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
$submenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
$submenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
$submenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
$canonnexturl=preg_replace('/\?.*$/','',$nexturl);
//var_dump($canonrelurl);
//var_dump($canonnexturl);
print '<ul>'."\n";
if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
|| (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/index.php') !== false))
{
// We add sub entry
print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
print '<a href="'.$relurl.'">';
if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
{
if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
else print $langs->trans("Dashboard");
}
else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
print '</a>';
print '</li>'."\n";
}
if ($val['level']==0)
{
if ($val['enabled'])
{
$lastlevel[0]='enabled';
}
else if ($showmenu) // Not enabled but visible (so greyed)
{
$lastlevel[0]='greyed';
}
else
{
$lastlevel[0]='hidden';
}
}
$lastlevel2 = array();
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
$showmenu=true;
if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu=false;
// If at least one parent is not enabled, we do not show any menu of all children
if ($val2['level'] > 0)
{
$levelcursor = $val2['level']-1;
while ($levelcursor >= 0)
{
if ($lastlevel2[$levelcursor] != 'enabled') $showmenu=false;
$levelcursor--;
}
}
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
{
$relurl2=dol_buildpath($val2['url'],1);
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
$disabled='';
if (! $val2['enabled'])
{
$disabled=" vsmenudisabled";
}
print str_pad('',$val2['level']+1);
print '<li class="lilevel'.($val2['level']+1);
if ($val2['level']==0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
print $disabled.'">'; // ui-btn to highlight on clic
if ($relurl2)
{
if ($val2['enabled']) // Allowed
{
print '<a href="'.$relurl2.'"';
//print ' data-ajax="false"';
print '>';
$lastlevel2[$val2['level']]='enabled';
}
else // Not allowed but visible (greyed)
{
print '<a href="#" class="vsmenudisabled">';
$lastlevel2[$val2['level']]='greyed';
}
}
else
{
if ($val2['enabled']) // Allowed
{
$lastlevel2[$val2['level']]='enabled';
}
else
{
$lastlevel2[$val2['level']]='greyed';
}
}
//var_dump($val2['level']);
//var_dump($lastlevel2);
print $val2['titre'];
if ($relurl2)
{
if ($val2['enabled']) // Allowed
print '</a>';
else
print '</a>';
}
print '</li>'."\n";
}
}
//var_dump($submenu);
print '</ul>';
}
if ($val['enabled'] == 2)
{
print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
}
print '</li>';
print '</ul>'."\n";
}
}
if ($mode == 'left')
{ {
// Put here left menu entries // Put here left menu entries
// ***** START ***** // ***** START *****
@ -134,8 +330,10 @@ class MenuManager
$this->menu->add("/admin/modules.php", $langs->trans("Modules"),1); $this->menu->add("/admin/modules.php", $langs->trans("Modules"),1);
$this->menu->add("/admin/menus.php", $langs->trans("Menus"),1); $this->menu->add("/admin/menus.php", $langs->trans("Menus"),1);
$this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1); $this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
$this->menu->add("/admin/fiscalyear.php", $langs->trans("Fiscalyear"),1); $this->menu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1); $this->menu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
$this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1); $this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1);
$this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1); $this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
$this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1); $this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
@ -143,7 +341,6 @@ class MenuManager
$this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1); $this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
$this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1); $this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
$this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1); $this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
if (! empty($conf->accounting->enabled)) $this->menu->add("/accountancy/admin/account.php", $langs->trans("Chartofaccounts"),1);
$this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1); $this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
// ***** END ***** // ***** END *****
@ -170,15 +367,15 @@ class MenuManager
$lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined $lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
if (($alt%2==0)) if (($alt%2==0))
{ {
print '<div class="blockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n"; print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
} }
else else
{ {
print '<div class="blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n"; print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
} }
} }
// Place tabulation // Add tabulation
$tabstring=''; $tabstring='';
$tabul=($this->menu->liste[$i]['level'] - 1); $tabul=($this->menu->liste[$i]['level'] - 1);
if ($tabul > 0) if ($tabul > 0)
@ -243,10 +440,10 @@ class MenuManager
unset($this->menu->liste); unset($this->menu->liste);
} }
} }
/*
if ($mode == 'jmobile') if ($mode == 'jmobile')
{ {
foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{ {
print '<ul class="ulmenu" data-inset="true">'; print '<ul class="ulmenu" data-inset="true">';
print '<li class="lilevel0">'; print '<li class="lilevel0">';
@ -296,7 +493,7 @@ class MenuManager
break; // Only first menu entry (so home) break; // Only first menu entry (so home)
} }
} }
*/
unset($this->menu); unset($this->menu);
return $res; return $res;

View File

@ -652,7 +652,12 @@ class DolibarrModules // Can not be abstract, because we need to insta
if ((float) DOL_VERSION >= 6.0) if ((float) DOL_VERSION >= 6.0)
{ {
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php'; @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
$content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath('cabinetmed/doc/', 1))); $content = dolMd2Html($content, 'parsedown',
array(
'doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1),
'img/'=>dol_buildpath(strtolower($this->name).'/img/', 1),
'images/'=>dol_buildpath(strtolower($this->name).'/imgages/', 1),
));
} }
else else
{ {
@ -678,6 +683,55 @@ class DolibarrModules // Can not be abstract, because we need to insta
return $content; return $content;
} }
/**
* Gives the changelog. First check ChangeLog-la_LA.md then ChangeLog.md
*
* @return string Content of ChangeLog
*/
function getChangeLog()
{
global $langs;
$langs->load("admin");
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$filefound= false;
// Define path to file README.md.
// First check README-la_LA.md then README.md
$pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog-'.$langs->defaultlang.'.md', 0);
if (dol_is_file($pathoffile))
{
$filefound = true;
}
if (! $filefound)
{
$pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog.md', 0);
if (dol_is_file($pathoffile))
{
$filefound = true;
}
}
if ($filefound) // Mostly for external modules
{
$content = file_get_contents($pathoffile);
if ((float) DOL_VERSION >= 6.0)
{
@include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
$content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1)));
}
else
{
$content = nl2br($content);
}
}
return $content;
}
/** /**
* Gives the publisher name * Gives the publisher name
* *

View File

@ -229,7 +229,7 @@ class CommActionRapport
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$eventstatic->id=$obj->id; $eventstatic->id=$obj->id;
$eventstatic->percentage=$obj->percentage; $eventstatic->percentage=$obj->percent;
$eventstatic->fulldayevent=$obj->fulldayevent; $eventstatic->fulldayevent=$obj->fulldayevent;
$eventstatic->punctual=$obj->punctual; $eventstatic->punctual=$obj->punctual;
@ -266,7 +266,14 @@ class CommActionRapport
// Date // Date
$pdf->SetXY($this->marge_gauche, $y); $pdf->SetXY($this->marge_gauche, $y);
$pdf->MultiCell(22, $height, dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour"), 0, 'L', 0); $textdate = dol_print_date($this->db->jdate($obj->dp),"day")."\n".dol_print_date($this->db->jdate($obj->dp),"hour");
if ($obj->dp2) {
if (dol_print_date($this->db->jdate($obj->dp),"day") != dol_print_date($this->db->jdate($obj->dp2),"day"))
$textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour");
else
$textdate.= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour");
}
$pdf->MultiCell(22, $height, $textdate, 0, 'L', 0);
$y0 = $pdf->GetY(); $y0 = $pdf->GetY();
// Third party // Third party

View File

@ -197,7 +197,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php', 'url'=>'/comm/action/index.php',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>100, 'position'=>15,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -235,7 +235,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>102, 'position'=>140,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -247,7 +247,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>103, 'position'=>141,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -259,7 +259,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>104, 'position'=>142,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -271,7 +271,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>105, 'position'=>143,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -283,7 +283,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1', 'url'=>'/comm/action/index.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>106, 'position'=>144,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -296,7 +296,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>112, 'position'=>110,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -308,7 +308,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>113, 'position'=>111,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -320,7 +320,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filter=mine',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>114, 'position'=>112,
'perms'=>'$user->rights->agenda->myactions->read', 'perms'=>'$user->rights->agenda->myactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',
@ -332,7 +332,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=todo&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>115, 'position'=>113,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -344,7 +344,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1', 'url'=>'/comm/action/listactions.php?mainmenu=agenda&amp;leftmenu=agenda&amp;status=done&amp;filtert=-1',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>116, 'position'=>114,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$user->rights->agenda->allactions->read', 'enabled'=>'$user->rights->agenda->allactions->read',
'target'=>'', 'target'=>'',
@ -357,7 +357,7 @@ class modAgenda extends DolibarrModules
'mainmenu'=>'agenda', 'mainmenu'=>'agenda',
'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&amp;leftmenu=agenda', 'url'=>'/comm/action/rapport/index.php?mainmenu=agenda&amp;leftmenu=agenda',
'langs'=>'agenda', 'langs'=>'agenda',
'position'=>120, 'position'=>160,
'perms'=>'$user->rights->agenda->allactions->read', 'perms'=>'$user->rights->agenda->allactions->read',
'enabled'=>'$conf->agenda->enabled', 'enabled'=>'$conf->agenda->enabled',
'target'=>'', 'target'=>'',

View File

@ -70,8 +70,8 @@ class modCashDesk extends DolibarrModules
$this->phpmin = array(4,1); // Minimum version of PHP required by module $this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module $this->need_dolibarr_version = array(2,4); // Minimum version of Dolibarr required by module
$this->langfiles = array("cashdesk"); $this->langfiles = array("cashdesk");
$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text') //$this->warnings_activation = array('FR'=>'WarningNoteModulePOSForFrenchLaw'); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text') //$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
// Constants // Constants
$this->const = array(); $this->const = array();

View File

@ -61,11 +61,11 @@ class pdf_standardlabel extends CommonStickerGenerator
*/ */
function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
{ {
global $mysoc,$conf,$langs; global $mysoc, $conf, $langs;
global $forceimgscalewidth,$forceimgscaleheight; global $forceimgscalewidth, $forceimgscaleheight;
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker) $imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker) $imgscaleheight=(empty($forceimgscaleheight)?0.5:$forceimgscaleheight); // Scale of image for height (1=Full height of sticker)
// We are in a new page, then we must add a page // We are in a new page, then we must add a page
if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) { if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) {

View File

@ -738,9 +738,10 @@ function setforfree() {
function setforpredef() { function setforpredef() {
console.log("Call setforpredef. We hide some fields"); console.log("Call setforpredef. We hide some fields");
jQuery("#select_type").val(-1); jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change();
jQuery("#price_ht").hide(); jQuery("#price_ht").val('').hide();
jQuery("#multicurrency_price_ht").hide(); jQuery("#multicurrency_price_ht").hide();
jQuery("#price_ttc").hide(); // May no exists jQuery("#price_ttc").hide(); // May no exists
jQuery("#tva_tx").hide(); jQuery("#tva_tx").hide();

View File

@ -109,7 +109,6 @@ $hookmanager->initHooks(array('expeditioncard','globalcard'));
$permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php $permissiondellink=$user->rights->expedition->livraison->creer; // Used by the include of actions_dellink.inc.php
/* /*
* Actions * Actions
*/ */
@ -195,8 +194,8 @@ if (empty($reshook))
$object->note = GETPOST('note','alpha'); $object->note = GETPOST('note','alpha');
$object->origin = $origin; $object->origin = $origin;
$object->origin_id = $origin_id; $object->origin_id = $origin_id;
$object->fk_project = GETPOST('projectid'); $object->fk_project = GETPOST('projectid','int');
$object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int'); $object->weight = GETPOST('weight','int')==''?"NULL":GETPOST('weight','int');
$object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int'); $object->sizeH = GETPOST('sizeH','int')==''?"NULL":GETPOST('sizeH','int');
$object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int'); $object->sizeW = GETPOST('sizeW','int')==''?"NULL":GETPOST('sizeW','int');
@ -214,7 +213,7 @@ if (empty($reshook))
$object->socid = $objectsrc->socid; $object->socid = $objectsrc->socid;
$object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment $object->ref_customer = ''; // We don't use $objectsrc->ref_client, this is ref or order not shipment
$object->model_pdf = GETPOST('model'); $object->model_pdf = GETPOST('model','alpha');
$object->date_delivery = $date_delivery; // Date delivery planed $object->date_delivery = $date_delivery; // Date delivery planed
$object->fk_delivery_address = $objectsrc->fk_delivery_address; $object->fk_delivery_address = $objectsrc->fk_delivery_address;
$object->shipping_method_id = GETPOST('shipping_method_id','int'); $object->shipping_method_id = GETPOST('shipping_method_id','int');
@ -453,7 +452,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -550,7 +549,7 @@ if (empty($reshook))
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
@ -704,7 +703,7 @@ if ($action == 'create')
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
$projectid = GETPOST('projectid')?GETPOST('projectid'):0; $projectid = GETPOST('projectid','int')?GETPOST('projectid','int'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0); if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load("projects"); $langs->load("projects");
@ -890,6 +889,7 @@ if ($action == 'create')
if (! empty($line->date_start)) $type=1; if (! empty($line->date_start)) $type=1;
if (! empty($line->date_end)) $type=1; if (! empty($line->date_end)) $type=1;
print '<!-- line '.$line->rowid.' for product -->'."\n";
print '<tr class="oddeven">'."\n"; print '<tr class="oddeven">'."\n";
// Product label // Product label
@ -979,7 +979,7 @@ if ($action == 'create')
print '<td align="center">'; print '<td align="center">';
if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES))
{ {
if (GETPOST('qtyl'.$indiceAsked)) $defaultqty=GETPOST('qtyl'.$indiceAsked); if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty=GETPOST('qtyl'.$indiceAsked, 'int');
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">'; print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
} }
@ -1107,8 +1107,8 @@ if ($action == 'create')
// ship from multiple locations // ship from multiple locations
if (empty($conf->productbatch->enabled) || ! $product->hasbatch()) if (empty($conf->productbatch->enabled) || ! $product->hasbatch())
{ {
print '<td></td><td></td></tr>'; // end line and start a new one for each warehouse
print '<!-- Case warehouse not already known and product does not need lot -->'; print '<!-- Case warehouse not already known and product does not need lot -->';
print '<td></td><td></td></tr>'."\n"; // end line and start a new one for each warehouse
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
$subj=0; $subj=0;
@ -1195,7 +1195,8 @@ if ($action == 'create')
} }
else else
{ {
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial print '<!-- Case warehouse not already known and product need lot -->';
print '<td></td><td></td></tr>'; // end line and start a new one for lot/serial
$subj=0; $subj=0;
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">'; print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
@ -1222,6 +1223,7 @@ if ($action == 'create')
//var_dump($dbatch); //var_dump($dbatch);
$batchStock = + $dbatch->qty; // To get a numeric $batchStock = + $dbatch->qty; // To get a numeric
$deliverableQty = min($quantityToBeDelivered,$batchStock); $deliverableQty = min($quantityToBeDelivered,$batchStock);
if ($deliverableQty < 0) $deliverableQty = 0;
print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">'; print '<!-- subj='.$subj.'/'.$nbofsuggested.' --><tr '.((($subj + 1) == $nbofsuggested)?$bc[$var]:'').'><td colspan="3"></td><td align="center">';
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">'; print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'_'.$subj.'" type="text" size="4" value="'.$deliverableQty.'">';
print '</td>'; print '</td>';
@ -1233,8 +1235,11 @@ if ($action == 'create')
print '<!-- Show details of lot -->'; print '<!-- Show details of lot -->';
print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">'; print '<input name="batchl'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$dbatch->id.'">';
//print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); //print $langs->trans("DetailBatchFormat", $dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
$productlotObject->fetch(0, $line->fk_product, $dbatch->batch); //print $line->fk_product.' - '.$dbatch->batch;
print $langs->trans("Batch").': '.$productlotObject->getNomUrl(1); print $langs->trans("Batch").': ';
$result = $productlotObject->fetch(0, $line->fk_product, $dbatch->batch);
if ($result > 0) print $productlotObject->getNomUrl(1);
else print 'TableLotIncompleteRunRepair';
print ' ('.$dbatch->qty.')'; print ' ('.$dbatch->qty.')';
//print $langs->trans("DetailBatchFormat", 'ee'.$dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty); //print $langs->trans("DetailBatchFormat", 'ee'.$dbatch->batch, dol_print_date($dbatch->eatby,"day"), dol_print_date($dbatch->sellby,"day"), $dbatch->qty);
$quantityToBeDelivered -= $deliverableQty; $quantityToBeDelivered -= $deliverableQty;
@ -1350,7 +1355,7 @@ else if ($id || $ref)
$res = $object->fetch_optionals($object->id, $extralabels); $res = $object->fetch_optionals($object->id, $extralabels);
$head=shipping_prepare_head($object); $head=shipping_prepare_head($object);
dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), 0, 'sending'); dol_fiche_head($head, 'shipping', $langs->trans("Shipment"), -1, 'sending');
$formconfirm=''; $formconfirm='';
@ -1762,7 +1767,7 @@ else if ($id || $ref)
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha'); if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
if (empty($newlang)) $newlang=$object->thirdparty->default_lang; if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
@ -1817,6 +1822,7 @@ else if ($id || $ref)
// Loop on each product to send/sent // Loop on each product to send/sent
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0 ; $i < $num_prod ; $i++)
{ {
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
print '<tr class="oddeven">'; print '<tr class="oddeven">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER))
@ -1889,14 +1895,14 @@ else if ($id || $ref)
$j = 0; $j = 0;
foreach($val as $shipmentline_id=> $shipmentline_var) foreach($val as $shipmentline_id=> $shipmentline_var)
{ {
if ($shipmentline_id == $lines[$i]->rowid) continue; // We want to show only "other shipments" if ($shipmentline_var['shipment_id'] == $lines[$i]->fk_expedition) continue; // We want to show only "other shipments"
$j++; $j++;
if ($j > 1) print '<br>'; if ($j > 1) print '<br>';
$shipment_static->fetch($shipmentline_var['shipment_id']); $shipment_static->fetch($shipmentline_var['shipment_id']);
print $shipment_static->getNomUrl(1); print $shipment_static->getNomUrl(1);
print ' - '.$shipmentline_var['qty_shipped']; print ' - '.$shipmentline_var['qty_shipped'];
$htmltext=$langs->trans("DateValidation").' : '.dol_print_date($shipmentline_var['date_valid'], 'dayhour'); $htmltext=$langs->trans("DateValidation").' : '.(empty($shipmentline_var['date_valid'])?$langs->trans("Draft"):dol_print_date($shipmentline_var['date_valid'], 'dayhour'));
if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0) if (! empty($conf->stock->enabled) && $shipmentline_var['warehouse'] > 0)
{ {
$warehousestatic->fetch($shipmentline_var['warehouse']); $warehousestatic->fetch($shipmentline_var['warehouse']);

View File

@ -1319,7 +1319,8 @@ class Expedition extends CommonObject
$sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type"; $sql = "SELECT cd.rowid, cd.fk_product, cd.label as custom_label, cd.description, cd.qty as qty_asked, cd.product_type";
$sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva"; $sql.= ", cd.total_ht, cd.total_localtax1, cd.total_localtax2, cd.total_ttc, cd.total_tva";
$sql.= ", cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht"; $sql.= ", cd.vat_src_code, cd.tva_tx, cd.localtax1_tx, cd.localtax2_tx, cd.localtax1_type, cd.localtax2_type, cd.price, cd.subprice, cd.remise_percent,cd.buy_price_ht as pa_ht";
$sql.= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc";
$sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql.= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; $sql.= ", p.ref as product_ref, p.label as product_label, p.fk_product_type";
$sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; $sql.= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch";
@ -1368,8 +1369,13 @@ class Expedition extends CommonObject
$line->line_id = $obj->line_id; $line->line_id = $obj->line_id;
$line->rowid = $obj->line_id; // TODO deprecated $line->rowid = $obj->line_id; // TODO deprecated
$line->id = $obj->line_id; $line->id = $obj->line_id;
$line->fk_origin_line = $obj->fk_origin_line;
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated $line->fk_origin = 'orderline';
$line->fk_origin_line = $obj->fk_origin_line;
$line->origin_line_id = $obj->fk_origin_line; // TODO deprecated
$line->fk_expedition = $this->id; // id of parent
$line->product_type = $obj->product_type; $line->product_type = $obj->product_type;
$line->fk_product = $obj->fk_product; $line->fk_product = $obj->fk_product;
$line->fk_product_type = $obj->fk_product_type; $line->fk_product_type = $obj->fk_product_type;
@ -1392,8 +1398,10 @@ class Expedition extends CommonObject
$line->pa_ht = $obj->pa_ht; $line->pa_ht = $obj->pa_ht;
$localtax_array=array(0=>$obj->localtax1_type, 1=>$obj->localtax1_tx, 2=>$obj->localtax2_type, 3=>$obj->localtax2_tx);
// For invoicing // For invoicing
$tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc); // We force type to 0 $tabprice = calcul_price_total($obj->qty_shipped, $obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->fk_product_type, $mysoc, $localtax_array); // We force type to 0
$line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements) $line->desc = $obj->description; // We need ->desc because some code into CommonObject use desc (property defined for other elements)
$line->qty = $line->qty_shipped; $line->qty = $line->qty_shipped;
$line->total_ht = $tabprice[0]; $line->total_ht = $tabprice[0];
@ -1401,6 +1409,7 @@ class Expedition extends CommonObject
$line->total_localtax2 = $tabprice[10]; $line->total_localtax2 = $tabprice[10];
$line->total_ttc = $tabprice[2]; $line->total_ttc = $tabprice[2];
$line->total_tva = $tabprice[1]; $line->total_tva = $tabprice[1];
$line->vat_src_code = $obj->vat_src_code;
$line->tva_tx = $obj->tva_tx; $line->tva_tx = $obj->tva_tx;
$line->localtax1_tx = $obj->localtax1_tx; $line->localtax1_tx = $obj->localtax1_tx;
$line->localtax2_tx = $obj->localtax2_tx; $line->localtax2_tx = $obj->localtax2_tx;
@ -1414,6 +1423,14 @@ class Expedition extends CommonObject
$this->total_localtax1+= $tabprice[9]; $this->total_localtax1+= $tabprice[9];
$this->total_localtax2+= $tabprice[10]; $this->total_localtax2+= $tabprice[10];
// Multicurrency
$this->fk_multicurrency = $obj->fk_multicurrency;
$this->multicurrency_code = $obj->multicurrency_code;
$this->multicurrency_subprice = $obj->multicurrency_subprice;
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
if ($originline != $obj->fk_origin_line) if ($originline != $obj->fk_origin_line)
{ {
$line->detail_batch = array(); $line->detail_batch = array();

View File

@ -314,7 +314,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -425,7 +425,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -542,7 +542,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -665,7 +665,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -788,7 +788,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -910,7 +910,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -953,7 +953,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1170,7 +1170,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
@ -1236,7 +1236,7 @@ if (empty($reshook))
{ {
$outputlangs = $langs; $outputlangs = $langs;
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang = GETPOST('lang_id','alpha'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) { if (! empty($newlang)) {
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);

View File

@ -684,7 +684,10 @@ if ($resql)
} }
else else
{ {
print '<tr '.$bc[false].'>'.'<td colspan="9" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>'; $colspan=1;
foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; }
print '<tr>'.'<td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
} }
// Show total line // Show total line

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