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

This commit is contained in:
Laurent Destailleur 2016-09-30 23:45:58 +02:00
commit ae68c8067e
117 changed files with 1692 additions and 1017 deletions

View File

@ -257,7 +257,7 @@ script:
# Ensure we catch errors # Ensure we catch errors
set -e set -e
# Exclusions are defined in the ruleset.xml file # Exclusions are defined in the ruleset.xml file
phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/codesniffer/ruleset.xml --encoding=utf-8 . phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 .
set +e set +e
echo echo

View File

@ -26,9 +26,9 @@ check you make a fetch on object before calling the delete.
- The old driver of "mysql" has been removed. Dolibarr use the new one (mysqli) by default. - The old driver of "mysql" has been removed. Dolibarr use the new one (mysqli) by default.
- Remove not used function calculate_byte(). Use dol_print_size() instead. - Remove not used function calculate_byte(). Use dol_print_size() instead.
- Function pdf_getTotalQty is now deprecated. Not used by Dolibarr core. - Function pdf_getTotalQty is now deprecated. Not used by Dolibarr core.
- Method expensereport->delete(id, user) has been replaced with delete(user) to follow good practice to - Method expensereport->delete(id, user) has been replaced with ->delete(user)
make a fetch on object before deleting it. Method warehouse->delete(id) has been replace with ->delete(user)
This is to follow good practice to make a fetch on object before deleting it.
***** ChangeLog for 4.0.0 compared to 3.9.* ***** ***** ChangeLog for 4.0.0 compared to 3.9.* *****

View File

@ -19,7 +19,7 @@
/** /**
* \file htdocs/accountancy/admin/account.php * \file htdocs/accountancy/admin/account.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief List accounting account * \brief List accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -19,7 +19,7 @@
/** /**
* \file htdocs/accountancy/admin/card.php * \file htdocs/accountancy/admin/card.php
* \ingroup Advanced accountancy * \ingroup Advanced accountancy
* \brief Card of accounting account * \brief Card of accounting account
*/ */
require '../../main.inc.php'; require '../../main.inc.php';

View File

@ -16,12 +16,12 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear.php * \file htdocs/accountancy/admin/fiscalyear.php
* \ingroup fiscal year * \ingroup Advanced accountancy
* \brief Setup page to configure fiscal year * \brief Setup page to configure fiscal year
*/ */
require '../../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';
@ -45,9 +45,9 @@ $langs->load("compta");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->fiscalyear) if (! $user->rights->mouvements->lire) // If we can read accounting records, we shoul be able to see fiscal year.
accessforbidden(); accessforbidden();
$error = 0; $error = 0;
// List of status // List of status
@ -65,6 +65,7 @@ $errors = array ();
$object = new Fiscalyear($db); $object = new Fiscalyear($db);
/* /*
* Actions * Actions
*/ */
@ -146,7 +147,14 @@ dol_fiche_end();
// Buttons // Buttons
print '<div class="tabsAction">'; print '<div class="tabsAction">';
print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>'; if (! empty($user->rights->accounting->fiscalyear))
{
print '<a class="butAction" href="fiscalyear_card.php?action=create">' . $langs->trans("NewFiscalYear") . '</a>';
}
else
{
print '<a class="butActionRefused" href="#">' . $langs->trans("NewFiscalYear") . '</a>';
}
print '</div>'; print '</div>';
llxFooter(); llxFooter();

View File

@ -16,8 +16,9 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_card.php
* \brief Page to show a fiscal year * \ingroup Advanced accountancy
* \brief Page to show a fiscal year
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
@ -30,7 +31,7 @@ $langs->load("compta");
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if (! $user->rights->accounting->fiscalyear) if (empty($user->rights->accounting->fiscalyear))
accessforbidden(); accessforbidden();
$error = 0; $error = 0;
@ -138,9 +139,12 @@ else if ($action == 'update') {
} }
} }
/* /*
* View * View
*/ */
$title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card"); $title = $langs->trans("Fiscalyear") . " - " . $langs->trans("Card");
$helpurl = ""; $helpurl = "";
llxHeader("",$title,$helpurl); llxHeader("",$title,$helpurl);
@ -291,16 +295,19 @@ if ($action == 'create')
dol_fiche_end(); dol_fiche_end();
/* if (! empty($user->rights->accounting->fiscalyear))
* Barre d'actions {
*/ /*
print '<div class="tabsAction">'; * Barre d'actions
*/
print '<div class="tabsAction">';
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>'; print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>'; print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
print '</div>'; print '</div>';
}
} }
} else { } else {
dol_print_error($db); dol_print_error($db);

View File

@ -16,11 +16,12 @@
*/ */
/** /**
* \file htdocs/accountancy/admin/fiscalyear_card.php * \file htdocs/accountancy/admin/fiscalyear_info.php
* \brief Page to show info of a fiscal year * \ingroup Advanced accountancy
* \brief Page to show info of a fiscal year
*/ */
require '../../main.inc.php';
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/fiscalyear.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/fiscalyear.class.php';

View File

@ -55,12 +55,17 @@ class BookKeeping extends CommonObject
*/ */
public $table_element = 'accounting_bookkeeping'; public $table_element = 'accounting_bookkeeping';
public $entity = 1;
/** /**
* *
* @var BookKeepingLine[] Lines * @var BookKeepingLine[] Lines
*/ */
public $lines = array (); public $lines = array ();
/** /**
* *
* @var int ID * @var int ID
@ -212,7 +217,6 @@ class BookKeeping extends CommonObject
} }
$sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " (";
$sql .= "doc_date"; $sql .= "doc_date";
$sql .= ", doc_type"; $sql .= ", doc_type";
$sql .= ", doc_ref"; $sql .= ", doc_ref";
@ -229,9 +233,8 @@ class BookKeeping extends CommonObject
$sql .= ", import_key"; $sql .= ", import_key";
$sql .= ", code_journal"; $sql .= ", code_journal";
$sql .= ", piece_num"; $sql .= ", piece_num";
$sql .= ', entity';
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= "'" . $this->doc_date . "'"; $sql .= "'" . $this->doc_date . "'";
$sql .= ",'" . $this->doc_type . "'"; $sql .= ",'" . $this->doc_type . "'";
$sql .= ",'" . $this->doc_ref . "'"; $sql .= ",'" . $this->doc_ref . "'";
@ -248,7 +251,7 @@ class BookKeeping extends CommonObject
$sql .= ",'" . $this->date_create . "'"; $sql .= ",'" . $this->date_create . "'";
$sql .= ",'" . $this->code_journal . "'"; $sql .= ",'" . $this->code_journal . "'";
$sql .= "," . $this->piece_num; $sql .= "," . $this->piece_num;
$sql .= ", " . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ")"; $sql .= ")";
dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG); dol_syslog(get_class($this) . ":: create sql=" . $sql, LOG_DEBUG);
@ -391,10 +394,9 @@ class BookKeeping extends CommonObject
$sql .= 'fk_user_author,'; $sql .= 'fk_user_author,';
$sql .= 'import_key,'; $sql .= 'import_key,';
$sql .= 'code_journal,'; $sql .= 'code_journal,';
$sql .= 'piece_num'; $sql .= 'piece_num,';
$sql .= 'entity';
$sql .= ') VALUES ('; $sql .= ') VALUES (';
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ','; $sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ','; $sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ','; $sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
@ -410,8 +412,8 @@ class BookKeeping extends CommonObject
$sql .= ' ' . $user->id . ','; $sql .= ' ' . $user->id . ',';
$sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ',';
$sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; $sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
$sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num); $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num).',';
$sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity);
$sql .= ')'; $sql .= ')';
$this->db->begin(); $this->db->begin();
@ -481,10 +483,14 @@ class BookKeeping extends CommonObject
$sql .= " t.piece_num"; $sql .= " t.piece_num";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
if (null !== $ref) { if (null !== $ref) {
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\''; $sql .= ' AND t.ref = ' . '\'' . $ref . '\'';
} else { } else {
$sql .= ' WHERE t.rowid = ' . $id; $sql .= ' AND t.rowid = ' . $id;
} }
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -586,13 +592,17 @@ class BookKeeping extends CommonObject
} }
} }
if (count($sqlwhere) > 0) { $sql.= ' WHERE 1 = 1';
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
} }
// Affichage par compte comptable if (count($sqlwhere) > 0) {
$sql .= ' ORDER BY t.numero_compte ASC'; $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
}
// Affichage par compte comptable
$sql .= ' ORDER BY t.numero_compte ASC';
if (! empty($sortfield)) { if (! empty($sortfield)) {
$sql .= ', ' . $sortfield . ' ' .$sortorder; $sql .= ', ' . $sortfield . ' ' .$sortorder;
} }
if (! empty($limit)) { if (! empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset); $sql .= ' ' . $this->db->plimit($limit + 1, $offset);
@ -696,8 +706,12 @@ class BookKeeping extends CommonObject
} }
} }
$sql.= ' WHERE 1 = 1';
if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";
}
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' ' . $filtermode . ' ', $sqlwhere); $sql .= ' AND ' . implode(' ' . $filtermode . ' ', $sqlwhere);
} }
if (! empty($sortfield)) { if (! empty($sortfield)) {

View File

@ -41,6 +41,9 @@ class FormVentilation extends Form
$options = array(); $options = array();
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
$sql .= ' ORDER BY import_key DESC'; $sql .= ' ORDER BY import_key DESC';
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG); dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
@ -227,6 +230,9 @@ class FormVentilation extends Form
// Auxiliary customer account // Auxiliary customer account
$sql = "SELECT DISTINCT code_compta, nom "; $sql = "SELECT DISTINCT code_compta, nom ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe"; $sql .= " FROM ".MAIN_DB_PREFIX."societe";
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
}
$sql .= " ORDER BY code_compta"; $sql .= " ORDER BY code_compta";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -246,6 +252,9 @@ class FormVentilation extends Form
// Auxiliary supplier account // Auxiliary supplier account
$sql = "SELECT DISTINCT code_compta_fournisseur, nom "; $sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
$sql .= " FROM ".MAIN_DB_PREFIX."societe"; $sql .= " FROM ".MAIN_DB_PREFIX."societe";
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("societe", 1) . ")";
}
$sql .= " ORDER BY code_compta_fournisseur"; $sql .= " ORDER BY code_compta_fournisseur";
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG); dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -280,10 +289,15 @@ class FormVentilation extends Form
*/ */
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
{ {
global $conf;
$out_array = array(); $out_array = array();
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear"; $sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
$sql .= " ORDER BY date_format(doc_date,'%Y')"; $sql .= " ORDER BY date_format(doc_date,'%Y')";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -316,10 +330,15 @@ class FormVentilation extends Form
*/ */
function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html') function selectjournal_accountancy_bookkepping($selected = '', $htmlname = 'journalid', $useempty = 0, $output_format = 'html')
{ {
global $conf;
$out_array = array(); $out_array = array();
$sql = "SELECT DISTINCT code_journal"; $sql = "SELECT DISTINCT code_journal";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
if (! empty($conf->multicompany->enabled)) {
$sql .= " WHERE entity IN (" . getEntity("accountancy", 1) . ")";
}
$sql .= " ORDER BY code_journal"; $sql .= " ORDER BY code_journal";
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);

View File

@ -171,9 +171,9 @@ 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="center">' . $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="center"><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,";
@ -220,9 +220,9 @@ 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="center">' . $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="center"><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 ++) {
@ -264,9 +264,9 @@ if (! empty($conf->margin->enabled)) {
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="center">' . $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="center"><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 ++) {
@ -291,9 +291,9 @@ if (! empty($conf->margin->enabled)) {
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(price2num($row[$i])) . '</td>';
} }
print '<td align="right"><b>' . price($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);

View File

@ -87,6 +87,11 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
/*
* Actions
*/
// Purge search criteria // Purge search criteria
if (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")) // Both test are required to be compatible with all browsers
{ {
@ -148,10 +153,6 @@ print '<script type="text/javascript">
}); });
</script>'; </script>';
/*
* Action
*/
/* /*
* Customer Invoice lines * Customer Invoice lines
*/ */
@ -251,7 +252,7 @@ if ($result) {
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account($account_parent, 'account_parent', 1); print $formventilation->select_account($account_parent, 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '"/></div>'; print '<input type="submit" class="button" value="' . $langs->trans("Validate") . '"/></div>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
@ -298,7 +299,7 @@ if ($result) {
// Ref Product // Ref Product
$product_static->ref = $objp->product_ref; $product_static->ref = $objp->product_ref;
$product_static->id = $objp->product_id; $product_static->id = $objp->product_id;
$product_static->type = $objp->type; $product_static->type = $objp->product_type;
print '<td>'; print '<td>';
if ($product_static->id) if ($product_static->id)
print $product_static->getNomUrl(1); print $product_static->getNomUrl(1);

View File

@ -103,9 +103,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) {
$search_vat = ''; $search_vat = '';
} }
/* /*
* View * View
*/ */
llxHeader('', $langs->trans("Ventilation")); llxHeader('', $langs->trans("Ventilation"));
print '<script type="text/javascript"> print '<script type="text/javascript">

View File

@ -155,9 +155,9 @@ print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="200" align="left">' . $langs->trans("Account") . '</td>'; print '<tr class="liste_titre"><td width="200" align="left">' . $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="center">' . $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="center"><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,";
@ -205,9 +205,9 @@ print "<br>\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>'; print '<tr class="liste_titre"><td width="400" align="left">' . $langs->trans("Total") . '</td>';
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
print '<td width="60" align="center">' . $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="center"><b>' . $langs->trans("Total") . '</b></td></tr>'; print '<td width="60" align="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
$sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,"; $sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,";
for($i = 1; $i <= 12; $i ++) { for($i = 1; $i <= 12; $i ++) {
@ -247,4 +247,4 @@ if ($resql) {
print "</table>\n"; print "</table>\n";
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -85,6 +85,11 @@ if (! $user->rights->accounting->ventilation->dispatch)
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
/*
* Actions
*/
// Purge search criteria // Purge search criteria
if (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")) // Both test are required to be compatible with all browsers
{ {
@ -121,6 +126,7 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
} }
} }
/* /*
* View * View
*/ */
@ -198,7 +204,7 @@ if ($result) {
print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>'; print '<br><div class="inline-block divButAction">' . $langs->trans("ChangeAccount") . '<br>';
print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1); print $formventilation->select_account(GETPOST('account_parent'), 'account_parent', 1);
print '<input type="submit" class="butAction" value="' . $langs->trans("Validate") . '" /></div>'; print '<input type="submit" class="button" value="' . $langs->trans("Validate") . '" /></div>';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Invoice"), $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);

View File

@ -93,6 +93,7 @@ $sql.= " b.fk_account";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."subscription as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON c.fk_bank=b.rowid";
$sql.= " WHERE d.rowid = c.fk_adherent"; $sql.= " WHERE d.rowid = c.fk_adherent";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if (isset($date_select) && $date_select != '') if (isset($date_select) && $date_select != '')
{ {
$sql.= " AND c.dateadh LIKE '".$date_select."%'"; $sql.= " AND c.dateadh LIKE '".$date_select."%'";

View File

@ -80,7 +80,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0); $taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,31,32,0);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();

View File

@ -75,10 +75,28 @@ if ($search_version) $param.='&search_version='.urlencode($search_version);
* Actions * Actions
*/ */
if (GETPOST('buttonreset'))
{
$search_keyword='';
$search_status='';
$search_nature='';
$search_version='';
}
if ($action == 'set' && $user->admin) if ($action == 'set' && $user->admin)
{ {
$result=activateModule($value); $resarray = activateModule($value);
if ($result) setEventMessages($result, null, 'errors'); if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
else
{
//var_dump($resarray);exit;
if ($resarray['nbperms'] > 0)
{
$msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
setEventMessages($msg, null, 'warnings');
}
}
header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:'')); header("Location: modules.php?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
exit; exit;
} }
@ -91,14 +109,6 @@ if ($action == 'reset' && $user->admin)
exit; exit;
} }
if (GETPOST('buttonreset'))
{
$search_keyword='';
$search_status='';
$search_nature='';
$search_version='';
}
/* /*
@ -494,8 +504,8 @@ if ($mode != 'marketplace')
// Help // Help
print '<td align="center" valign="top" class="nowrap" style="width: 82px;">'; print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
$text=''; $text='';
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>'.$objMod->getDescLong().'<br>'; if ($objMod->getDescLong()) $text.='<div class="titre">'.$objMod->getDesc().'</div><br>'.$objMod->getDescLong().'<br>';
else $text.=$objMod->getDesc().'<br>'; else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
$textexternal=''; $textexternal='';
if ($objMod->isCoreOrExternalModule() == 'external') if ($objMod->isCoreOrExternalModule() == 'external')
@ -605,7 +615,7 @@ if ($mode != 'marketplace')
else $text.=$langs->trans("No"); else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> '; $text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && is_array($objMod->menu) && ! empty($objMod->menu)) if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
{ {
$text.=$langs->trans("Yes"); $text.=$langs->trans("Yes");
} }

View File

@ -136,19 +136,23 @@ else if ($action == 'del')
// Set default model // Set default model
else if ($action == 'setdoc') else if ($action == 'setdoc')
{ {
if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
{ {
// La constante qui a ete lue en avant du nouveau set // La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent // on passe donc par une variable pour avoir un affichage coherent
$conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value; $conf->global->INVOICE_SUPPLIER_ADDON_PDF = $value;
} }
// On active le modele // On active le modele
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
$ret = addDocumentModel($value, $type, $label, $scandir); $ret = addDocumentModel($value, $type, $label, $scandir);
} }
}
else if ($action == 'unsetdoc')
{
dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity);
} }
if ($action == 'setmod') if ($action == 'setmod')
@ -366,7 +370,7 @@ foreach ($dirmodels as $reldir)
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file)) if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{ {
$name = substr($file, 4, dol_strlen($file) -16); $name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) -12);
@ -383,7 +387,7 @@ foreach ($dirmodels as $reldir)
require_once $dir.$file; require_once $dir.$file;
$module = new $classname($db,$specimenthirdparty); $module = new $classname($db,$specimenthirdparty);
if (method_exists($module,'info')) print $module->info($langs); if (method_exists($module,'info')) print $module->info($langs);
else print $module->description; else print $module->description;
print "</td>\n"; print "</td>\n";
@ -391,16 +395,17 @@ foreach ($dirmodels as $reldir)
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print '<td align="center">'."\n"; print '<td align="center">'."\n";
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name")
{ //{
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier">';
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
print '</a>'; print '</a>';
} /*}
else else
{ {
print img_picto($langs->trans("Enabled"),'switch_on'); print img_picto($langs->trans("Enabled"),'switch_on');
} }*/
print "</td>"; print "</td>";
} }
else else
@ -414,7 +419,9 @@ foreach ($dirmodels as $reldir)
print '<td align="center">'; print '<td align="center">';
if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name")
{ {
print img_picto($langs->trans("Default"),'on'); //print img_picto($langs->trans("Default"),'on');
// Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
} }
else else
{ {

View File

@ -82,13 +82,13 @@ $enableremotecheck = False;
print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">'; print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';
print $langs->trans("MakeIntegrityAnalysisFrom").':<br>'; print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
if (file_exists($xmlfile)) if (dol_is_file($xmlfile))
{ {
print '<input type="checkbox" name="local" checked> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>'; print '<input type="checkbox" name="local" checked> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>';
} }
else else
{ {
print '<input type="checkbox" name="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' <span class="warning">('.$langs->trans("NotAvailable").')</span><br>'; print '<input type="checkbox" name="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span><br>';
} }
if ($enableremotecheck) if ($enableremotecheck)
{ {
@ -98,13 +98,13 @@ else
{ {
print '<input type="checkbox" name="remote" disabled> '.$langs->trans("RemoteSignature").' = '.$xmlremote.' <span class="warning">('.$langs->trans("FeatureNotYetAvailable").')</span><br>'; print '<input type="checkbox" name="remote" disabled> '.$langs->trans("RemoteSignature").' = '.$xmlremote.' <span class="warning">('.$langs->trans("FeatureNotYetAvailable").')</span><br>';
} }
print '<input type="submit" name="check" class="button" value="'.$langs->trans("Check").'">'; print '<br><div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>';
print '</form>'; print '</form>';
print '<br>'; print '<br>';
if (GETPOST('local')) if (GETPOST('local'))
{ {
if (file_exists($xmlfile)) if (dol_is_file($xmlfile))
{ {
$xml = simplexml_load_file($xmlfile); $xml = simplexml_load_file($xmlfile);
} }

View File

@ -183,7 +183,7 @@ if (empty($reshook))
// Remove a product line // Remove a product line
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer)
{ {
$result = $object->deleteline($lineid); $result = $object->deleteline($user, $lineid);
if ($result > 0) if ($result > 0)
{ {
// Define output language // Define output language
@ -1919,9 +1919,9 @@ if ($action == 'create' && $user->rights->commande->creer)
// Order card // Order card
$linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/commande/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer
@ -1962,17 +1962,17 @@ if ($action == 'create' && $user->rights->commande->creer)
} }
} }
$morehtmlref.='</div>'; $morehtmlref.='</div>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="fichehalfleft">'; print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
/* /*
print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>'; print '<tr><td class="titlefield">' . $langs->trans('Ref') . '</td>';
@ -2309,7 +2309,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>'; print '</td></tr>';
} }
*/ */
// Incoterms // Incoterms
if (!empty($conf->incoterm->enabled)) if (!empty($conf->incoterm->enabled))
{ {
@ -2358,14 +2358,14 @@ if ($action == 'create' && $user->rights->commande->creer)
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '<div class="fichehalfright">'; print '<div class="fichehalfright">';
print '<div class="ficheaddleft">'; print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Total HT // Total HT
print '<tr><td class="titlefield">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td class="titlefield">' . $langs->trans('AmountHT') . '</td>';
print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>'; print '<td>' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';
@ -2408,19 +2408,19 @@ if ($action == 'create' && $user->rights->commande->creer)
// Statut // Statut
//print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>'; //print '<tr><td>' . $langs->trans('Status') . '</td><td>' . $object->getLibStatut(4) . '</td></tr>';
print '</table>'; print '</table>';
// Margin Infos // Margin Infos
if (! empty($conf->margin->enabled)) { if (! empty($conf->margin->enabled)) {
$formmargin->displayMarginInfos($object); $formmargin->displayMarginInfos($object);
} }
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '</div>'; print '</div>';
print '<div class="clearboth"></div><br>'; print '<div class="clearboth"></div><br>';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
@ -2634,7 +2634,7 @@ if ($action == 'create' && $user->rights->commande->creer)
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('order'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -23,19 +23,19 @@
* API class for commande object * API class for commande object
* *
* @smart-auto-routing false * @smart-auto-routing false
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
* *
* @category Api * @category Api
* @package Api * @package Api
* *
* @deprecated Use Orders instead (defined in api_orders.class.php) * @deprecated Use Orders instead (defined in api_orders.class.php)
*/ */
class CommandeApi extends DolibarrApi class CommandeApi extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'socid' 'socid'
@ -50,7 +50,7 @@ class CommandeApi extends DolibarrApi
* Constructor <b>Warning: Deprecated</b> * Constructor <b>Warning: Deprecated</b>
* *
* @url GET order/ * @url GET order/
* *
*/ */
function __construct() function __construct()
{ {
@ -63,40 +63,40 @@ class CommandeApi extends DolibarrApi
* Get properties of a commande object <b>Warning: Deprecated</b> * Get properties of a commande object <b>Warning: Deprecated</b>
* *
* Return an array with commande informations * Return an array with commande informations
* *
* @param int $id ID of order * @param int $id ID of order
* @param string $ref Ref of object * @param string $ref Ref of object
* @param string $ref_ext External reference of object * @param string $ref_ext External reference of object
* @param string $ref_int Internal reference of other object * @param string $ref_int Internal reference of other object
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @url GET order/{id} * @url GET order/{id}
* @throws RestException * @throws RestException
*/ */
function get($id='',$ref='', $ref_ext='', $ref_int='') function get($id='',$ref='', $ref_ext='', $ref_int='')
{ {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$this->commande->fetchObjectLinked(); $this->commande->fetchObjectLinked();
return $this->_cleanObjectDatas($this->commande); return $this->_cleanObjectDatas($this->commande);
} }
/** /**
* List orders <b>Warning: Deprecated</b> * List orders <b>Warning: Deprecated</b>
* *
* Get a list of orders * Get a list of orders
* *
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
@ -109,20 +109,20 @@ class CommandeApi extends DolibarrApi
*/ */
function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $societe = 0) { function getList($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0, $mode=0, $societe = 0) {
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
// case of external user, $societe param is ignored and replaced by user's socid // case of external user, $societe param is ignored and replaced by user's socid
$socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe; $socid = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $societe;
// If the internal user must only see his customers, force searching by him // If the internal user must only see his customers, force searching by him
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT s.rowid"; $sql = "SELECT s.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."commande as s"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as s";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
// Example of use $mode // Example of use $mode
//if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
//if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
@ -131,13 +131,13 @@ class CommandeApi extends DolibarrApi
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
if ($socid) $sql.= " AND s.fk_soc = ".$socid; if ($socid) $sql.= " AND s.fk_soc = ".$socid;
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter // Insert sale filter
if ($search_sale > 0) if ($search_sale > 0)
{ {
$sql .= " AND sc.fk_user = ".$search_sale; $sql .= " AND sc.fk_user = ".$search_sale;
} }
$nbtotalofrecords = 0; $nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
@ -157,7 +157,7 @@ class CommandeApi extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$i=0; $i=0;
@ -183,9 +183,9 @@ class CommandeApi extends DolibarrApi
/** /**
* List orders for specific thirdparty <b>Warning: Deprecated</b> * List orders for specific thirdparty <b>Warning: Deprecated</b>
* *
* Get a list of orders * Get a list of orders
* *
* @param int $socid Id of customer * @param int $socid Id of customer
* *
* @url GET /customer/{socid}/order/list * @url GET /customer/{socid}/order/list
@ -196,14 +196,14 @@ class CommandeApi extends DolibarrApi
return getList(0,"s.rowid","ASC",0,0,$socid); return getList(0,"s.rowid","ASC",0,0,$socid);
} }
/** /**
* Create order object <b>Warning: Deprecated</b> * Create order object <b>Warning: Deprecated</b>
* *
* @param array $request_data Request datas * @param array $request_data Request datas
* *
* @url POST order/ * @url POST order/
* *
* @return int ID of commande * @return int ID of commande
*/ */
function post($request_data = NULL) function post($request_data = NULL)
@ -227,7 +227,7 @@ class CommandeApi extends DolibarrApi
if(! $this->commande->create(DolibarrApiAccess::$user) ) { if(! $this->commande->create(DolibarrApiAccess::$user) ) {
throw new RestException(500, "Error while creating order"); throw new RestException(500, "Error while creating order");
} }
return $this->commande->id; return $this->commande->id;
} }
/** /**
@ -235,21 +235,21 @@ class CommandeApi extends DolibarrApi
* *
* *
* @param int $id Id of order * @param int $id Id of order
* *
* @url GET order/{id}/line/list * @url GET order/{id}/line/list
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id) {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -265,22 +265,22 @@ class CommandeApi extends DolibarrApi
* *
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param array $request_data Orderline data * @param array $request_data Orderline data
* *
* @url POST order/{id}/line * @url POST order/{id}/line
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = NULL) { function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -325,22 +325,22 @@ class CommandeApi extends DolibarrApi
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param int $lineid Id of line to update * @param int $lineid Id of line to update
* @param array $request_data Orderline data * @param array $request_data Orderline data
* *
* @url PUT order/{id}/line/{lineid} * @url PUT order/{id}/line/{lineid}
* *
* @return object * @return object
*/ */
function putLine($id, $lineid, $request_data = NULL) { function putLine($id, $lineid, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -382,26 +382,26 @@ class CommandeApi extends DolibarrApi
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* *
* @url DELETE order/{id}/line/{lineid} * @url DELETE order/{id}/line/{lineid}
* *
* @return int * @return int
*/ */
function delLine($id, $lineid) { function delLine($id, $lineid) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$request_data = (object) $request_data; $request_data = (object) $request_data;
$updateRes = $this->commande->deleteline($lineid); $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
if ($updateRes == 1) { if ($updateRes == 1) {
return $this->get($id); return $this->get($id);
} }
@ -412,42 +412,42 @@ class CommandeApi extends DolibarrApi
* Update order general fields (won't touch lines of order) <b>Warning: Deprecated</b> * Update order general fields (won't touch lines of order) <b>Warning: Deprecated</b>
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param array $request_data Datas * @param array $request_data Datas
* *
* @url PUT order/{id} * @url PUT order/{id}
* *
* @return int * @return int
*/ */
function put($id, $request_data = NULL) { function put($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->commande->$field = $value; $this->commande->$field = $value;
} }
if($this->commande->update($id, DolibarrApiAccess::$user,1,'','','update')) if($this->commande->update($id, DolibarrApiAccess::$user,1,'','','update'))
return $this->get($id); return $this->get($id);
return false; return false;
} }
/** /**
* Delete order <b>Warning: Deprecated</b> * Delete order <b>Warning: Deprecated</b>
* *
* @param int $id Order ID * @param int $id Order ID
* *
* @url DELETE order/{id} * @url DELETE order/{id}
* *
* @return array * @return array
*/ */
function delete($id) function delete($id)
@ -459,35 +459,35 @@ class CommandeApi extends DolibarrApi
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( ! $this->commande->delete(DolibarrApiAccess::$user)) { if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete order : '.$this->commande->error); throw new RestException(500, 'Error when delete order : '.$this->commande->error);
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'Order deleted' 'message' => 'Order deleted'
) )
); );
} }
/** /**
* Validate an order <b>Warning: Deprecated</b> * Validate an order <b>Warning: Deprecated</b>
* *
* @param int $id Order ID * @param int $id Order ID
* @param int $idwarehouse Warehouse ID * @param int $idwarehouse Warehouse ID
* *
* @url GET order/{id}/validate * @url GET order/{id}/validate
* @url POST order/{id}/validate * @url POST order/{id}/validate
* *
* @return array * @return array
* *
*/ */
function validOrder($id, $idwarehouse=0) function validOrder($id, $idwarehouse=0)
{ {
@ -498,15 +498,15 @@ class CommandeApi extends DolibarrApi
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( ! $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse)) { if( ! $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse)) {
throw new RestException(500, 'Error when validate order'); throw new RestException(500, 'Error when validate order');
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
@ -514,12 +514,12 @@ class CommandeApi extends DolibarrApi
) )
); );
} }
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Array with data to verify * @param array $data Array with data to verify
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) function _validate($data)
@ -529,7 +529,7 @@ class CommandeApi extends DolibarrApi
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$commande[$field] = $data[$field]; $commande[$field] = $data[$field];
} }
return $commande; return $commande;
} }

View File

@ -23,14 +23,14 @@
/** /**
* API class for orders * API class for orders
* *
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
*/ */
class Orders extends DolibarrApi class Orders extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object
*/ */
static $FIELDS = array( static $FIELDS = array(
'socid' 'socid'
@ -55,36 +55,36 @@ class Orders extends DolibarrApi
* Get properties of a commande object * Get properties of a commande object
* *
* Return an array with commande informations * Return an array with commande informations
* *
* @param int $id ID of order * @param int $id ID of order
* @return array|mixed data without useless information * @return array|mixed data without useless information
* *
* @throws RestException * @throws RestException
*/ */
function get($id) function get($id)
{ {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$this->commande->fetchObjectLinked(); $this->commande->fetchObjectLinked();
return $this->_cleanObjectDatas($this->commande); return $this->_cleanObjectDatas($this->commande);
} }
/** /**
* List orders * List orders
* *
* Get a list of orders * Get a list of orders
* *
* @param string $sortfield Sort field * @param string $sortfield Sort field
* @param string $sortorder Sort order * @param string $sortorder Sort order
* @param int $limit Limit for list * @param int $limit Limit for list
@ -95,31 +95,31 @@ class Orders extends DolibarrApi
*/ */
function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '') { function index($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '') {
global $db, $conf; global $db, $conf;
$obj_ret = array(); $obj_ret = array();
// case of external user, $thirdpartyid param is ignored and replaced by user's socid // case of external user, $thirdpartyid param is ignored and replaced by user's socid
$socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids; $socids = DolibarrApiAccess::$user->societe_id ? DolibarrApiAccess::$user->societe_id : $thirdparty_ids;
// If the internal user must only see his customers, force searching by him // If the internal user must only see his customers, force searching by him
if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id; if (! DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) $search_sale = DolibarrApiAccess::$user->id;
$sql = "SELECT s.rowid"; $sql = "SELECT s.rowid";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."commande as s"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as s";
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ' WHERE s.entity IN ('.getEntity('commande', 1).')'; $sql.= ' WHERE s.entity IN ('.getEntity('commande', 1).')';
if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql.= " AND s.fk_soc = sc.fk_soc";
if ($socids) $sql.= " AND s.fk_soc IN (".$socids.")"; if ($socids) $sql.= " AND s.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter // Insert sale filter
if ($search_sale > 0) if ($search_sale > 0)
{ {
$sql .= " AND sc.fk_user = ".$search_sale; $sql .= " AND sc.fk_user = ".$search_sale;
} }
$nbtotalofrecords = 0; $nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{ {
@ -139,7 +139,7 @@ class Orders extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@ -190,7 +190,7 @@ class Orders extends DolibarrApi
$errormsg = $this->commande->error; $errormsg = $this->commande->error;
throw new RestException(500, $errormsg ? $errormsg : "Error while creating order"); throw new RestException(500, $errormsg ? $errormsg : "Error while creating order");
} }
return $this->commande->id; return $this->commande->id;
} }
@ -198,21 +198,21 @@ class Orders extends DolibarrApi
* Get lines of an order * Get lines of an order
* *
* @param int $id Id of order * @param int $id Id of order
* *
* @url GET {id}/lines * @url GET {id}/lines
* *
* @return int * @return int
*/ */
function getLines($id) { function getLines($id) {
if(! DolibarrApiAccess::$user->rights->commande->lire) { if(! DolibarrApiAccess::$user->rights->commande->lire) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -228,22 +228,22 @@ class Orders extends DolibarrApi
* Add a line to given order * Add a line to given order
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param array $request_data Orderline data * @param array $request_data Orderline data
* *
* @url POST {id}/lines * @url POST {id}/lines
* *
* @return int * @return int
*/ */
function postLine($id, $request_data = NULL) { function postLine($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -288,22 +288,22 @@ class Orders extends DolibarrApi
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param int $lineid Id of line to update * @param int $lineid Id of line to update
* @param array $request_data Orderline data * @param array $request_data Orderline data
* *
* @url PUT {id}/lines/{lineid} * @url PUT {id}/lines/{lineid}
* *
* @return object * @return object
*/ */
function putLine($id, $lineid, $request_data = NULL) { function putLine($id, $lineid, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
@ -346,26 +346,26 @@ class Orders extends DolibarrApi
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* *
* @url DELETE {id}/lines/{lineid} * @url DELETE {id}/lines/{lineid}
* *
* @return int * @return int
*/ */
function delLine($id, $lineid) { function delLine($id, $lineid) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$request_data = (object) $request_data; $request_data = (object) $request_data;
$updateRes = $this->commande->deleteline($lineid); $updateRes = $this->commande->deleteline(DolibarrApiAccess::$user,$lineid);
if ($updateRes == 1) { if ($updateRes == 1) {
return $this->get($id); return $this->get($id);
} }
@ -376,38 +376,38 @@ class Orders extends DolibarrApi
* Update order general fields (won't touch lines of order) * Update order general fields (won't touch lines of order)
* *
* @param int $id Id of commande to update * @param int $id Id of commande to update
* @param array $request_data Datas * @param array $request_data Datas
* *
* @return int * @return int
*/ */
function put($id, $request_data = NULL) { function put($id, $request_data = NULL) {
if(! DolibarrApiAccess::$user->rights->commande->creer) { if(! DolibarrApiAccess::$user->rights->commande->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->commande->fetch($id); $result = $this->commande->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Commande not found'); throw new RestException(404, 'Commande not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
foreach($request_data as $field => $value) { foreach($request_data as $field => $value) {
$this->commande->$field = $value; $this->commande->$field = $value;
} }
if($this->commande->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) if($this->commande->update($id, DolibarrApiAccess::$user, 1, '', '', 'update'))
return $this->get($id); return $this->get($id);
return false; return false;
} }
/** /**
* Delete order * Delete order
* *
* @param int $id Order ID * @param int $id Order ID
* *
* @return array * @return array
*/ */
function delete($id) function delete($id)
@ -419,33 +419,33 @@ class Orders extends DolibarrApi
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
if( ! $this->commande->delete(DolibarrApiAccess::$user)) { if( ! $this->commande->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete order : '.$this->commande->error); throw new RestException(500, 'Error when delete order : '.$this->commande->error);
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
'message' => 'Order deleted' 'message' => 'Order deleted'
) )
); );
} }
/** /**
* Validate an order * Validate an order
* *
* @param int $id Order ID * @param int $id Order ID
* @param int $idwarehouse Warehouse ID * @param int $idwarehouse Warehouse ID
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* *
* @url POST {id}/validate * @url POST {id}/validate
* *
* @return array * @return array
* FIXME An error 403 is returned if the request has an empty body. * FIXME An error 403 is returned if the request has an empty body.
* Error message: "Forbidden: Content type `text/plain` is not supported." * Error message: "Forbidden: Content type `text/plain` is not supported."
@ -464,11 +464,11 @@ class Orders extends DolibarrApi
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Order not found'); throw new RestException(404, 'Order not found');
} }
if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) { if( ! DolibarrApi::_checkAccessToResource('commande',$this->commande->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger); $result = $this->commande->valid(DolibarrApiAccess::$user, $idwarehouse, $notrigger);
if ($result == 0) { if ($result == 0) {
throw new RestException(500, 'Error nothing done. May be object is already validated'); throw new RestException(500, 'Error nothing done. May be object is already validated');
@ -476,7 +476,7 @@ class Orders extends DolibarrApi
if ($result < 0) { if ($result < 0) {
throw new RestException(500, 'Error when validating Order: '.$this->commande->error); throw new RestException(500, 'Error when validating Order: '.$this->commande->error);
} }
return array( return array(
'success' => array( 'success' => array(
'code' => 200, 'code' => 200,
@ -484,12 +484,12 @@ class Orders extends DolibarrApi
) )
); );
} }
/** /**
* Validate fields before create or update object * Validate fields before create or update object
* *
* @param array $data Array with data to verify * @param array $data Array with data to verify
* @return array * @return array
* @throws RestException * @throws RestException
*/ */
function _validate($data) function _validate($data)
@ -499,7 +499,7 @@ class Orders extends DolibarrApi
if (!isset($data[$field])) if (!isset($data[$field]))
throw new RestException(400, "$field field missing"); throw new RestException(400, "$field field missing");
$commande[$field] = $data[$field]; $commande[$field] = $data[$field];
} }
return $commande; return $commande;
} }

View File

@ -48,7 +48,7 @@ class Commande extends CommonOrder
public $fk_element = 'fk_commande'; public $fk_element = 'fk_commande';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto = 'order'; public $picto = 'order';
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -810,11 +810,11 @@ class Commande extends CommonOrder
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$line = $this->lines[$i]; $line = $this->lines[$i];
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array // Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object. //if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line; if (! is_object($line)) $line = (object) $line;
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) { if (($line->product_type != 9 && empty($line->fk_parent_line)) || $line->product_type == 9) {
$fk_parent_line = 0; $fk_parent_line = 0;
@ -906,10 +906,10 @@ class Commande extends CommonOrder
} }
} }
} }
$sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc"; $sqlcontact = "SELECT ctc.code, ctc.source, ec.fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'"; $sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
$resqlcontact = $this->db->query($sqlcontact); $resqlcontact = $this->db->query($sqlcontact);
if ($resqlcontact) if ($resqlcontact)
{ {
@ -1220,7 +1220,7 @@ class Commande extends CommonOrder
*/ */
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0) function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
{ {
global $mysoc, $conf, $langs; global $mysoc, $conf, $langs, $user;
dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG); dol_syslog(get_class($this)."::addline commandeid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, date_start=$date_start, date_end=$date_end, type=$type special_code=$special_code, fk_unit=$fk_unit", LOG_DEBUG);
@ -1373,7 +1373,7 @@ class Commande extends CommonOrder
$this->line->array_options=$array_options; $this->line->array_options=$array_options;
} }
$result=$this->line->insert(); $result=$this->line->insert($user);
if ($result > 0) if ($result > 0)
{ {
// Reorder if child line // Reorder if child line
@ -1972,10 +1972,11 @@ class Commande extends CommonOrder
/** /**
* Delete an order line * Delete an order line
* *
* @param User $user User object
* @param int $lineid Id of line to delete * @param int $lineid Id of line to delete
* @return int >0 if OK, 0 if nothing to do, <0 if KO * @return int >0 if OK, 0 if nothing to do, <0 if KO
*/ */
function deleteline($lineid) function deleteline($user=null, $lineid=0)
{ {
if ($this->statut == self::STATUS_DRAFT) if ($this->statut == self::STATUS_DRAFT)
@ -2002,7 +2003,7 @@ class Commande extends CommonOrder
// For triggers // For triggers
$line->fetch($lineid); $line->fetch($lineid);
if ($line->delete() > 0) if ($line->delete($user) > 0)
{ {
$result=$this->update_price(1); $result=$this->update_price(1);
@ -2387,7 +2388,7 @@ class Commande extends CommonOrder
function availability($availability_id, $notrigger=0) function availability($availability_id, $notrigger=0)
{ {
global $user; global $user;
dol_syslog('Commande::availability('.$availability_id.')'); dol_syslog('Commande::availability('.$availability_id.')');
if ($this->statut >= self::STATUS_DRAFT) if ($this->statut >= self::STATUS_DRAFT)
{ {
@ -2457,7 +2458,7 @@ class Commande extends CommonOrder
function demand_reason($demand_reason_id, $notrigger=0) function demand_reason($demand_reason_id, $notrigger=0)
{ {
global $user; global $user;
dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); dol_syslog('Commande::demand_reason('.$demand_reason_id.')');
if ($this->statut >= self::STATUS_DRAFT) if ($this->statut >= self::STATUS_DRAFT)
{ {
@ -2740,7 +2741,7 @@ class Commande extends CommonOrder
*/ */
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null) function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null)
{ {
global $conf, $mysoc, $langs; global $conf, $mysoc, $langs, $user;
dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code"); dol_syslog(get_class($this)."::updateline id=$rowid, desc=$desc, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, price_base_type=$price_base_type, info_bits=$info_bits, date_start=$date_start, date_end=$date_end, type=$type, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, special_code=$special_code");
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
@ -2885,7 +2886,7 @@ class Commande extends CommonOrder
$this->line->array_options=$array_options; $this->line->array_options=$array_options;
} }
$result=$this->line->update(); $result=$this->line->update($user);
if ($result > 0) if ($result > 0)
{ {
// Reorder if child line // Reorder if child line
@ -3805,9 +3806,11 @@ class OrderLine extends CommonOrderLine
/** /**
* Delete line in database * Delete line in database
* *
* @param User $user User that modify
* @param int $notrigger 0=launch triggers after, 1=disable triggers
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function delete() function delete($user=null, $notrigger=0)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
@ -3833,10 +3836,13 @@ class OrderLine extends CommonOrderLine
} }
} }
// Call trigger if (! $error && ! $notrigger)
$result=$this->call_trigger('LINEORDER_DELETE',$user); {
if ($result < 0) $error++; // Call trigger
// End call triggers $result=$this->call_trigger('LINEORDER_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
}
if (!$error) { if (!$error) {
$this->db->commit(); $this->db->commit();
@ -3861,12 +3867,13 @@ class OrderLine extends CommonOrderLine
/** /**
* Insert line into database * Insert line into database
* *
* @param User $user User that modify
* @param int $notrigger 1 = disable triggers * @param int $notrigger 1 = disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function insert($notrigger=0) function insert($user=null, $notrigger=0)
{ {
global $langs, $conf, $user; global $langs, $conf;
$error=0; $error=0;
@ -4004,12 +4011,13 @@ class OrderLine extends CommonOrderLine
/** /**
* Update the line object into db * Update the line object into db
* *
* @param User $user User that modify
* @param int $notrigger 1 = disable triggers * @param int $notrigger 1 = disable triggers
* @return int <0 si ko, >0 si ok * @return int <0 si ko, >0 si ok
*/ */
function update($notrigger=0) function update($user=null, $notrigger=0)
{ {
global $conf,$langs,$user; global $conf,$langs;
$error=0; $error=0;

View File

@ -2884,8 +2884,7 @@ else if ($id > 0 || ! empty($ref))
// Invoice content // Invoice content
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; $linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
$morehtmlref='<div class="refidno">'; $morehtmlref='<div class="refidno">';
// Ref customer // Ref customer
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', 0, 1);

View File

@ -440,14 +440,14 @@ class FactureRec extends CommonInvoice
/** /**
* Delete template invoice * Delete template invoice
* *
* @param int $rowid Id of invoice to delete. If empty, we delete current instance of invoice * @param User $user User that delete.
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @param int $idwarehouse Id warehouse to use for stock change. * @param int $idwarehouse Id warehouse to use for stock change.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function delete($rowid=0, $notrigger=0, $idwarehouse=-1) function delete($user, $notrigger=0, $idwarehouse=-1)
{ {
if (empty($rowid)) $rowid=$this->id; $rowid=$this->id;
dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG); dol_syslog(get_class($this)."::delete rowid=".$rowid, LOG_DEBUG);

File diff suppressed because it is too large Load Diff

View File

@ -70,6 +70,7 @@ $userid=GETPOST('userid','int');
$search_product_category=GETPOST('search_product_category','int'); $search_product_category=GETPOST('search_product_category','int');
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
$search_refcustomer=GETPOST('search_refcustomer','alpha'); $search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_type=GETPOST('search_type','int');
$search_societe=GETPOST('search_societe','alpha'); $search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_vat=GETPOST('search_montant_vat','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha');
@ -142,6 +143,7 @@ $checkedtypetiers=0;
$arrayfields=array( $arrayfields=array(
'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'f.facnumber'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), 'f.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1),
'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0),
'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1),
'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1),
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
@ -191,6 +193,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter") || GETPOS
$search_product_category=''; $search_product_category='';
$search_ref=''; $search_ref='';
$search_refcustomer=''; $search_refcustomer='';
$search_type='';
$search_project=''; $search_project='';
$search_societe=''; $search_societe='';
$search_montant_ht=''; $search_montant_ht='';
@ -295,6 +298,15 @@ if ($filtre)
} }
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref); if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer); if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '' && $search_type >= 0)
{
if ($search_type == '0') $sql.=" AND f.type = 0"; // standard
if ($search_type == '1') $sql.=" AND f.type = 1"; // replacement
if ($search_type == '2') $sql.=" AND f.type = 2"; // credit note
if ($search_type == '3') $sql.=" AND f.type = 3"; // deposit
if ($search_type == '4') $sql.=" AND f.type = 4"; // proforma
if ($search_type == '5') $sql.=" AND f.type = 5"; // situation
}
if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
@ -310,7 +322,7 @@ if ($search_status != '' && $search_status >= 0)
{ {
if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft if ($search_status == '0') $sql.=" AND f.fk_statut = 0"; // draft
if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed if ($search_status == '1') $sql.=" AND f.fk_statut = 1"; // unpayed
if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some correupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) if ($search_status == '2') $sql.=" AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed)
if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned if ($search_status == '3') $sql.=" AND f.fk_statut = 3"; // abandonned
} }
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode.""; if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
@ -400,7 +412,7 @@ if ($resql)
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($socid) if ($socid)
{ {
$soc = new Societe($db); $soc = new Societe($db);
@ -419,6 +431,7 @@ if ($resql)
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref=' .urlencode($search_ref); if ($search_ref) $param.='&search_ref=' .urlencode($search_ref);
if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer); if ($search_refcustomer) $param.='&search_refcustomer=' .urlencode($search_refcustomer);
if ($search_type != '') $param.='&search_type='.urlencode($search_type);
if ($search_societe) $param.='&search_societe=' .urlencode($search_societe); if ($search_societe) $param.='&search_societe=' .urlencode($search_societe);
if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale); if ($search_sale > 0) $param.='&search_sale=' .urlencode($search_sale);
if ($search_user > 0) $param.='&search_user=' .urlencode($search_user); if ($search_user > 0) $param.='&search_user=' .urlencode($search_user);
@ -438,7 +451,7 @@ if ($resql)
$tmpkey=preg_replace('/search_options_/','',$key); $tmpkey=preg_replace('/search_options_/','',$key);
if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val); if ($val != '') $param.='&search_options_'.$tmpkey.'='.urlencode($val);
} }
$arrayofmassactions=array( $arrayofmassactions=array(
'presend'=>$langs->trans("SendByMail"), 'presend'=>$langs->trans("SendByMail"),
'builddoc'=>$langs->trans("PDFMerge") 'builddoc'=>$langs->trans("PDFMerge")
@ -457,7 +470,7 @@ if ($resql)
} }
if ($massaction == 'presend') $arrayofmassactions=array(); if ($massaction == 'presend') $arrayofmassactions=array();
$massactionbutton=$form->selectMassAction('', $arrayofmassactions); $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$i = 0; $i = 0;
print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" name="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">'; if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
@ -467,7 +480,7 @@ if ($resql)
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">'; print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit); print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy.png', 0, '', '', $limit);
if ($massaction == 'presend') if ($massaction == 'presend')
@ -496,7 +509,7 @@ if ($resql)
print '<input type="hidden" name="massaction" value="confirm_presend">'; print '<input type="hidden" name="massaction" value="confirm_presend">';
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
dol_fiche_head(null, '', ''); dol_fiche_head(null, '', '');
@ -615,12 +628,13 @@ if ($resql)
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['f.date_lim_reglement']['checked'])) print_liste_field_titre($arrayfields['f.date_lim_reglement']['label'],$_SERVER['PHP_SELF'],"f.date_lim_reglement",'',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'],$_SERVER['PHP_SELF'],'s.nom','',$param,'',$sortfield,$sortorder);
@ -673,6 +687,20 @@ if ($resql)
print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">'; print '<input class="flat" size="6" type="text" name="search_refcustomer" value="'.$search_refcustomer.'">';
print '</td>'; print '</td>';
} }
// Type
if (! empty($arrayfields['f.type']['checked']))
{
print '<td class="liste_titre maxwidthonsmartphone">';
$listtype=array(
Facture::TYPE_STANDARD=>$langs->trans("InvoiceStandard"),
Facture::TYPE_REPLACEMENT=>$langs->trans("InvoiceReplacement"),
Facture::TYPE_CREDIT_NOTE=>$langs->trans("InvoiceAvoir"),
Facture::TYPE_DEPOSIT=>$langs->trans("InvoiceDeposit"),
);
//$listtype[Facture::TYPE_PROFORMA]=$langs->trans("InvoiceProForma"); // A proformat invoice is not an invoice but must be an order.
print $form->selectarray('search_type', $listtype, $search_type, 1, 0, 0, '', 0, 0, 0, 'ASC', 'maxwidth100');
print '</td>';
}
// Date invoice // Date invoice
if (! empty($arrayfields['f.date']['checked'])) if (! empty($arrayfields['f.date']['checked']))
{ {
@ -719,7 +747,7 @@ if ($resql)
if (! empty($arrayfields['typent.code']['checked'])) if (! empty($arrayfields['typent.code']['checked']))
{ {
print '<td class="liste_titre maxwidthonsmartphone" align="center">'; print '<td class="liste_titre maxwidthonsmartphone" align="center">';
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth100');
print '</td>'; print '</td>';
} }
// Payment mode // Payment mode
@ -830,6 +858,7 @@ if ($resql)
$facturestatic->type=$obj->type; $facturestatic->type=$obj->type;
$facturestatic->statut=$obj->fk_statut; $facturestatic->statut=$obj->fk_statut;
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
$facturestatic->type=$obj->type;
print '<tr '.$bc[$var].'>'; print '<tr '.$bc[$var].'>';
if (! empty($arrayfields['f.facnumber']['checked'])) if (! empty($arrayfields['f.facnumber']['checked']))
@ -865,7 +894,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Customer ref // Customer ref
if (! empty($arrayfields['f.ref_client']['checked'])) if (! empty($arrayfields['f.ref_client']['checked']))
{ {
@ -874,7 +903,16 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Type
if (! empty($arrayfields['f.type']['checked']))
{
print '<td class="nowrap">';
print $facturestatic->getLibType();
print "</td>";
if (! $i) $totalarray['nbfield']++;
}
// Date // Date
if (! empty($arrayfields['f.date']['checked'])) if (! empty($arrayfields['f.date']['checked']))
{ {
@ -883,7 +921,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Date limit // Date limit
if (! empty($arrayfields['f.date_lim_reglement']['checked'])) if (! empty($arrayfields['f.date_lim_reglement']['checked']))
{ {
@ -895,7 +933,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Third party // Third party
if (! empty($arrayfields['s.nom']['checked'])) if (! empty($arrayfields['s.nom']['checked']))
{ {
@ -949,7 +987,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Payment mode // Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked'])) if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{ {
@ -958,7 +996,7 @@ if ($resql)
print '</td>'; print '</td>';
if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['nbfield']++;
} }
// Amount HT // Amount HT
if (! empty($arrayfields['f.total_ht']['checked'])) if (! empty($arrayfields['f.total_ht']['checked']))
{ {
@ -999,7 +1037,7 @@ if ($resql)
if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield']; if (! $i) $totalarray['totalrtpfield']=$totalarray['nbfield'];
$totalarray['totalrtp'] += $remaintopay; $totalarray['totalrtp'] += $remaintopay;
} }
// Extra fields // Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{ {

View File

@ -27,8 +27,10 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
@ -63,6 +65,10 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
// Date range // Date range
$year=GETPOST("year"); $year=GETPOST("year");
$month=GETPOST("month"); $month=GETPOST("month");
$search_societe = GETPOST("search_societe");
$search_zip = GETPOST("search_zip");
$search_town = GETPOST("search_town");
$search_country = GETPOST("search_country");
$date_startyear = GETPOST("date_startyear"); $date_startyear = GETPOST("date_startyear");
$date_startmonth = GETPOST("date_startmonth"); $date_startmonth = GETPOST("date_startmonth");
$date_startday = GETPOST("date_startday"); $date_startday = GETPOST("date_startday");
@ -130,6 +136,10 @@ $headerparams['q'] = $q;
$tableparams = array(); $tableparams = array();
$tableparams['search_categ'] = $selected_cat; $tableparams['search_categ'] = $selected_cat;
$tableparams['search_societe'] = $search_societe;
$tableparams['search_zip'] = $search_zip;
$tableparams['search_town'] = $search_town;
$tableparams['search_country'] = $search_country;
$tableparams['subcat'] = ($subcat === true)?'yes':''; $tableparams['subcat'] = ($subcat === true)?'yes':'';
// Adding common parameters // Adding common parameters
@ -182,7 +192,7 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
// Show Array // Show Array
$catotal=0; $catotal=0;
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,"; $sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,";
$sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if ($selected_cat === -2) // Without any category if ($selected_cat === -2) // Without any category
@ -218,7 +228,7 @@ if ($modecompta == 'CREANCES-DETTES') {
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin) * vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
*/ */
$sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc"; $sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
$sql.= ", ".MAIN_DB_PREFIX."paiement as p"; $sql.= ", ".MAIN_DB_PREFIX."paiement as p";
@ -248,9 +258,13 @@ if ($modecompta == 'CREANCES-DETTES') {
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid"; $sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
} }
} }
if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"';
if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"';
if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"';
if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.'';
$sql.= " AND f.entity = ".$conf->entity; $sql.= " AND f.entity = ".$conf->entity;
if ($socid) $sql.= " AND f.fk_soc = ".$socid; if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql.= " GROUP BY s.rowid, s.nom"; $sql.= " GROUP BY s.rowid, s.nom, s.zip, s.town, s.fk_pays";
$sql.= " ORDER BY s.rowid"; $sql.= " ORDER BY s.rowid";
//echo $sql; //echo $sql;
@ -264,6 +278,9 @@ if ($result) {
$amount_ht[$obj->socid] = $obj->amount; $amount_ht[$obj->socid] = $obj->amount;
$amount[$obj->socid] = $obj->amount_ttc; $amount[$obj->socid] = $obj->amount_ttc;
$name[$obj->socid] = $obj->name.' '.$obj->firstname; $name[$obj->socid] = $obj->name.' '.$obj->firstname;
$address_zip[$obj->socid] = $obj->zip;
$address_town[$obj->socid] = $obj->town;
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
$catotal_ht+=$obj->amount; $catotal_ht+=$obj->amount;
$catotal+=$obj->amount_ttc; $catotal+=$obj->amount_ttc;
$i++; $i++;
@ -296,6 +313,9 @@ if ($modecompta != 'CREANCES-DETTES') {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$amount[$obj->rowid] += $obj->amount_ttc; $amount[$obj->rowid] += $obj->amount_ttc;
$name[$obj->rowid] = $obj->name; $name[$obj->rowid] = $obj->name;
$address_zip[$obj->rowid] = $obj->zip;
$address_town[$obj->rowid] = $obj->town;
$address_pays[$obj->rowid] = getCountry($obj->fk_pays);
$catotal+=$obj->amount_ttc; $catotal+=$obj->amount_ttc;
$i++; $i++;
} }
@ -325,7 +345,7 @@ if ($subcat) {
print ' checked'; print ' checked';
} }
print'></td>'; print'></td>';
print '<td colspan="4" align="right">'; print '<td colspan="7" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -340,6 +360,33 @@ print_liste_field_titre(
"", "",
$sortfield,$sortorder $sortfield,$sortorder
); );
print_liste_field_titre(
$langs->trans("Zip"),
$_SERVER["PHP_SELF"],
"zip",
"",
$paramslink,
"",
$sortfield,$sortorder
);
print_liste_field_titre(
$langs->trans("Town"),
$_SERVER["PHP_SELF"],
"town",
"",
$paramslink,
"",
$sortfield,$sortorder
);
print_liste_field_titre(
$langs->trans("Country"),
$_SERVER["PHP_SELF"],
"country",
"",
$paramslink,
"",
$sortfield,$sortorder
);
if ($modecompta == 'CREANCES-DETTES') { if ($modecompta == 'CREANCES-DETTES') {
print_liste_field_titre( print_liste_field_titre(
$langs->trans('AmountHT'), $langs->trans('AmountHT'),
@ -383,6 +430,27 @@ print_liste_field_titre(
'align="center" width="20%"' 'align="center" width="20%"'
); );
print "</tr>\n"; print "</tr>\n";
print '<tr class="liste_titre">';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_societe" value="'.$search_societe.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_zip" value="'.$search_zip.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_town" value="'.$search_town.'">';
print '</td>';
print '<td class="liste_titre" align="left">';
print $form->select_country($search_country, 'search_country');
//print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '</tr>';
$var=true; $var=true;
if (count($amount)) { if (count($amount)) {
@ -412,6 +480,30 @@ if (count($amount)) {
arsort($amount); arsort($amount);
$arrayforsort=$amount; $arrayforsort=$amount;
} }
if ($sortfield == 'zip' && $sortorder == 'asc') {
asort($address_zip);
$arrayforsort=$address_zip;
}
if ($sortfield == 'zip' && $sortorder == 'desc') {
arsort($address_zip);
$arrayforsort=$address_zip;
}
if ($sortfield == 'town' && $sortorder == 'asc') {
asort($address_town);
$arrayforsort=$address_town;
}
if ($sortfield == 'town' && $sortorder == 'desc') {
arsort($address_town);
$arrayforsort=$address_town;
}
if ($sortfield == 'country' && $sortorder == 'asc') {
asort($address_pays);
$arrayforsort=$address_town;
}
if ($sortfield == 'country' && $sortorder == 'desc') {
arsort($address_pays);
$arrayforsort=$address_town;
}
foreach($arrayforsort as $key=>$value) { foreach($arrayforsort as $key=>$value) {
$var=!$var; $var=!$var;
@ -429,6 +521,18 @@ if (count($amount)) {
} }
print "<td>".$linkname."</td>\n"; print "<td>".$linkname."</td>\n";
print '<td>';
print $address_zip[$key];
print '</td>';
print '<td>';
print $address_town[$key];
print '</td>';
print '<td>';
print $address_pays[$key];
print '</td>';
// Amount w/o VAT // Amount w/o VAT
print '<td align="right">'; print '<td align="right">';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
@ -488,6 +592,9 @@ if (count($amount)) {
// Total // Total
print '<tr class="liste_total">'; print '<tr class="liste_total">';
print '<td>'.$langs->trans("Total").'</td>'; print '<td>'.$langs->trans("Total").'</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta != 'CREANCES-DETTES') {
print '<td colspan="1"></td>'; print '<td colspan="1"></td>';
} else { } else {

View File

@ -198,9 +198,9 @@ abstract class CommonInvoice extends CommonObject
} }
/** /**
* Retourne le libelle du type de facture * Return label of type of invoice
* *
* @return string Libelle * @return string Label of type of invoice
*/ */
function getLibType() function getLibType()
{ {
@ -209,7 +209,7 @@ abstract class CommonInvoice extends CommonObject
if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement");
if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir");
if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit");
if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used.
if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation");
return $langs->trans("Unknown"); return $langs->trans("Unknown");
} }

View File

@ -708,7 +708,7 @@ function purgeSessions($mysessionid)
* *
* @param string $value Name of module to activate * @param string $value Name of module to activate
* @param int $withdeps Activate/Disable also all dependencies * @param int $withdeps Activate/Disable also all dependencies
* @return string Error message or ''; * @return array array('nbmodules'=>nb modules activated with success, 'errors=>array of error messages, 'nbperms'=>Nb permission added);
*/ */
function activateModule($value,$withdeps=1) function activateModule($value,$withdeps=1)
{ {
@ -717,7 +717,7 @@ function activateModule($value,$withdeps=1)
// Check parameters // Check parameters
if (empty($value)) return 'ErrorBadParameter'; if (empty($value)) return 'ErrorBadParameter';
$ret=''; $ret=array('nbmodules'=>0, 'errors'=>array(), 'nbperms'=>0);
$modName = $value; $modName = $value;
$modFile = $modName . ".class.php"; $modFile = $modName . ".class.php";
@ -761,50 +761,67 @@ function activateModule($value,$withdeps=1)
} }
$result=$objMod->init(); $result=$objMod->init();
if ($result <= 0) $ret=$objMod->error; if ($result <= 0)
if (! $ret && $withdeps)
{ {
if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends)) $ret['errors'][]=$objMod->error;
}
else
{
if ($withdeps)
{ {
// Activation des modules dont le module depend if (isset($objMod->depends) && is_array($objMod->depends) && ! empty($objMod->depends))
$TError=array();
$num = count($objMod->depends);
for ($i = 0; $i < $num; $i++)
{ {
$activate = false; // Activation des modules dont le module depend
foreach ($modulesdir as $dir) $num = count($objMod->depends);
{ for ($i = 0; $i < $num; $i++)
if (file_exists($dir.$objMod->depends[$i].".class.php")) {
{ $activate = false;
activateModule($objMod->depends[$i]); foreach ($modulesdir as $dir)
$activate = true; {
} if (file_exists($dir.$objMod->depends[$i].".class.php"))
} {
$resarray = activateModule($objMod->depends[$i]);
if (!$activate) $TError[] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $objMod->depends[$i]); if (empty($resarray['errors'])) $activate = true;
break;
}
}
if ($activate)
{
$ret['nbmodules']+=$resarray['nbmodules'];
$ret['nbperms']+=$resarray['nbperms'];
}
else
{
$ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $objMod->depends[$i]);
}
}
} }
setEventMessages('', $TError, 'errors'); if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith))
}
if (isset($objMod->conflictwith) && is_array($objMod->conflictwith) && ! empty($objMod->conflictwith))
{
// Desactivation des modules qui entrent en conflit
$num = count($objMod->conflictwith);
for ($i = 0; $i < $num; $i++)
{ {
foreach ($modulesdir as $dir) // Desactivation des modules qui entrent en conflit
{ $num = count($objMod->conflictwith);
if (file_exists($dir.$objMod->conflictwith[$i].".class.php")) for ($i = 0; $i < $num; $i++)
{ {
unActivateModule($objMod->conflictwith[$i],0); foreach ($modulesdir as $dir)
} {
} if (file_exists($dir.$objMod->conflictwith[$i].".class.php"))
{
unActivateModule($objMod->conflictwith[$i],0);
}
}
}
} }
} }
} }
if (! count($ret['errors']))
{
$ret['nbmodules']++;
$ret['nbperms']+=count($objMod->rights);
}
return $ret; return $ret;
} }

View File

@ -62,7 +62,7 @@ function user_prepare_head($object)
if ($canreadperms) if ($canreadperms)
{ {
$head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/user/perms.php?id='.$object->id;
$head[$h][1] = $langs->trans("UserRights"); $head[$h][1] = $langs->trans("UserRights"). ' <span class="badge">'.($object->nb_rights).'</span>';
$head[$h][2] = 'rights'; $head[$h][2] = 'rights';
$h++; $h++;
} }

View File

@ -44,7 +44,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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 201__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/dolibarr.php?leftmenu=admintools', 'InfoDolibarr', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 202__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/modules.php?leftmenu=admintools', 'Modules', 2, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 203__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/triggers.php?leftmenu=admintools', 'Triggers', 2, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/filecheck.php?leftmenu=admintools', 'FileCheck', 2, 'admin', '', '', 2, 4, __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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 204__+MAX_llx_menu__, 'home', '', 201__+MAX_llx_menu__, '/admin/system/filecheck.php?leftmenu=admintools', 'FileCheck', 2, 'admin', '', '', 2, 4, __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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 205__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/browser.php?leftmenu=admintools', 'InfoBrowser', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 206__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/os.php?leftmenu=admintools', 'InfoOS', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 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 ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 207__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/web.php?leftmenu=admintools', 'InfoWebServer', 1, 'admin', '', '', 2, 3, __ENTITY__);

View File

@ -551,7 +551,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1); $newmenu->add('/admin/system/dolibarr.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('InfoDolibarr'), 1);
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/modules.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Modules'), 2);
if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Triggers'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/triggers.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('Triggers'), 2);
//if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/filecheck.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('FileCheck'), 2); if (empty($leftmenu) || $leftmenu=='admintools_info') $newmenu->add('/admin/system/filecheck.php?mainmenu=home&amp;leftmenu=admintools_info', $langs->trans('FileCheck'), 2);
$newmenu->add('/admin/system/browser.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoBrowser'), 1); $newmenu->add('/admin/system/browser.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoBrowser'), 1);
$newmenu->add('/admin/system/os.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoOS'), 1); $newmenu->add('/admin/system/os.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoOS'), 1);
$newmenu->add('/admin/system/web.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoWebServer'), 1); $newmenu->add('/admin/system/web.php?mainmenu=home&amp;leftmenu=admintools', $langs->trans('InfoWebServer'), 1);
@ -941,14 +941,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Dispatch // Dispatch
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_customer'); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_customer');
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?leftmenu=accountancy_dispatch_customer",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch); if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?leftmenu=accountancy_dispatch_customer",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read); if (preg_match('/accountancy_dispatch_customer/',$leftmenu)) $newmenu->add("/accountancy/customer/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_customer",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
if (! empty($conf->supplier_invoice->enabled)) if (! empty($conf->supplier_invoice->enabled))
{ {
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&amp;mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier'); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/supplier/index.php?leftmenu=accountancy_dispatch_supplier&amp;mainmenu=accountancy",$langs->trans("SuppliersVentilation"),1,$user->rights->accounting->ventilation->read, '', $mainmenu, 'dispatch_supplier');
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?leftmenu=accountancy_dispatch_supplier",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch); if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/list.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier",$langs->trans("ToDispatch"),2,$user->rights->accounting->ventilation->dispatch);
if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?leftmenu=accountancy_dispatch_supplier",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read); if (preg_match('/accountancy_dispatch_supplier/',$leftmenu)) $newmenu->add("/accountancy/supplier/lines.php?mainmenu=accountancy&amp;leftmenu=accountancy_dispatch_supplier",$langs->trans("Dispatched"),2,$user->rights->accounting->ventilation->read);
} }
// Journals // Journals
@ -972,7 +972,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
while ($i < $numr) while ($i < $numr)
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/bankjournal.php?left_menu=accountancy_journal&id_account='.$objp->rowid,$langs->trans("Journal").' - '.dol_trunc($objp->label,10),2,$user->rights->accounting->comptarapport->lire); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_account='.$objp->rowid,$langs->trans("Journal").' - '.dol_trunc($objp->label,10),2,$user->rights->accounting->comptarapport->lire);
$i++; $i++;
} }
} }
@ -980,15 +980,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$db->free($resql); $db->free($resql);
// Add other journal // Add other journal
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=accountancy_journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/sellsjournal.php?mainmenu=accountancy&amp;leftmenu=accountancy_journal",$langs->trans("SellsJournal"),2,$user->rights->accounting->comptarapport->lire);
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=accountancy_journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&amp;leftmenu=accountancy_journal",$langs->trans("PurchasesJournal"),2,$user->rights->accounting->comptarapport->lire);
} }
// General Ledger // General Ledger
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/list.php?mainmenu=accountancy",$langs->trans("Bookkeeping"),1,$user->rights->accounting->mouvements->lire);
// Balance // Balance
if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy",$langs->trans("AccountBalance"),1,$user->rights->accounting->mouvements->lire);
// Reports // Reports
$langs->load("compta"); $langs->load("compta");

View File

@ -1552,12 +1552,14 @@ class DolibarrModules // Can not be abstract, because we need to insta
/** /**
* Adds menu entries * Adds menu entries
* *
* @return int Error count (0 if OK) * @return int Error count (0 if OK)
*/ */
function insert_menus() function insert_menus()
{ {
global $user; global $user;
if (! is_array($this->menu) || empty($this->menu)) return 0;
require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
$err=0; $err=0;

View File

@ -892,14 +892,12 @@ class pdf_rouget extends ModelePdfExpedition
$Yoff=25; $Yoff=25;
// Add list of linked orders // Add list of linked orders
// TODO possibility to use with other document (business module,...)
//$object->load_object_linked();
$origin = $object->origin; $origin = $object->origin;
$origin_id = $object->origin_id; $origin_id = $object->origin_id;
// TODO move to external function // TODO move to external function
if (! empty($conf->$origin->enabled)) if (! empty($conf->$origin->enabled)) // commonly $origin='commande'
{ {
$outputlangs->load('orders'); $outputlangs->load('orders');
@ -908,6 +906,8 @@ class pdf_rouget extends ModelePdfExpedition
$result=$linkedobject->fetch($origin_id); $result=$linkedobject->fetch($origin_id);
if ($result >= 0) if ($result >= 0)
{ {
//$linkedobject->fetchObjectLinked() Get all linked object to the $linkedobject (commonly order) into $linkedobject->linkedObjects
$pdf->SetFont('','', $default_font_size - 2); $pdf->SetFont('','', $default_font_size - 2);
$text=$linkedobject->ref; $text=$linkedobject->ref;
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')'; if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';

View File

@ -284,8 +284,10 @@ class modAccounting extends DolibarrModules
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++; $r++;
// Main menu entries
$this->menus = array(); // Menus
$r = 0; //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
} }

View File

@ -209,7 +209,7 @@ class modAdherent extends DolibarrModules
$this->rights[$r][0] = 71; $this->rights[$r][0] = 71;
$this->rights[$r][1] = 'Read members\' card'; $this->rights[$r][1] = 'Read members\' card';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -244,7 +244,7 @@ class modAdherent extends DolibarrModules
$this->rights[$r][0] = 78; $this->rights[$r][0] = 78;
$this->rights[$r][1] = 'Read subscriptions'; $this->rights[$r][1] = 'Read subscriptions';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'cotisation'; $this->rights[$r][4] = 'cotisation';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -256,6 +256,12 @@ class modAdherent extends DolibarrModules
$this->rights[$r][4] = 'cotisation'; $this->rights[$r][4] = 'cotisation';
$this->rights[$r][5] = 'creer'; $this->rights[$r][5] = 'creer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -118,7 +118,7 @@ class modAgenda extends DolibarrModules
$this->rights[$r][0] = 2401; $this->rights[$r][0] = 2401;
$this->rights[$r][1] = 'Read actions/tasks linked to his account'; $this->rights[$r][1] = 'Read actions/tasks linked to his account';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'myactions'; $this->rights[$r][4] = 'myactions';
$this->rights[$r][5] = 'read'; $this->rights[$r][5] = 'read';
$r++; $r++;

View File

@ -155,7 +155,7 @@ class modApi extends DolibarrModules
// Example: // Example:
// $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;

View File

@ -89,7 +89,7 @@ class modBanque extends DolibarrModules
$this->rights[$r][0] = 111; // id de la permission $this->rights[$r][0] = 111; // id de la permission
$this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission $this->rights[$r][1] = 'Lire les comptes bancaires'; // libelle de la permission
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -135,7 +135,11 @@ class modBanque extends DolibarrModules
$this->rights[$r][4] = 'cheque'; $this->rights[$r][4] = 'cheque';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -81,22 +81,27 @@ class modBookmark extends DolibarrModules
$this->rights[$r][0] = 331; // id de la permission $this->rights[$r][0] = 331; // id de la permission
$this->rights[$r][1] = 'Lire les bookmarks'; // libelle de la permission $this->rights[$r][1] = 'Lire les bookmarks'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
$this->rights[$r][0] = 332; // id de la permission $this->rights[$r][0] = 332; // id de la permission
$this->rights[$r][1] = 'Creer/modifier les bookmarks'; // libelle de la permission $this->rights[$r][1] = 'Creer/modifier les bookmarks'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'creer'; $this->rights[$r][4] = 'creer';
$r++; $r++;
$this->rights[$r][0] = 333; // id de la permission $this->rights[$r][0] = 333; // id de la permission
$this->rights[$r][1] = 'Supprimer les bookmarks'; // libelle de la permission $this->rights[$r][1] = 'Supprimer les bookmarks'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (d<>pr<70>ci<63> <20> ce jour) $this->rights[$r][2] = 'r'; // type de la permission (d<>pr<70>ci<63> <20> ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par d<>faut $this->rights[$r][3] = 0; // La permission est-elle une permission par d<>faut
$this->rights[$r][4] = 'supprimer'; $this->rights[$r][4] = 'supprimer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
} }

View File

@ -86,7 +86,7 @@ class modCashDesk extends DolibarrModules
$this->rights[$r][0] = 50101; $this->rights[$r][0] = 50101;
$this->rights[$r][1] = 'Use point of sale'; $this->rights[$r][1] = 'Use point of sale';
$this->rights[$r][2] = 'a'; $this->rights[$r][2] = 'a';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'use'; $this->rights[$r][4] = 'use';
// Main menu entries // Main menu entries

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2016 Juanjo Menent <jmenent@2byte.es>
* *
* 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
@ -89,7 +89,7 @@ class modCategorie extends DolibarrModules
$this->rights[$r][0] = 241; // id de la permission $this->rights[$r][0] = 241; // id de la permission
$this->rights[$r][1] = 'Lire les categories'; // libelle de la permission $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecated) $this->rights[$r][2] = 'r'; // type de la permission (deprecated)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -107,6 +107,12 @@ class modCategorie extends DolibarrModules
$this->rights[$r][4] = 'supprimer'; $this->rights[$r][4] = 'supprimer';
$r++; $r++;
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;
@ -136,11 +142,53 @@ class modCategorie extends DolibarrModules
$this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code'); $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code','s.fk_stcomm'=>'List:c_stcomm:libelle:code');
$this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // We define here only fields that use another picto $this->export_entities_array[$r]=array('s.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company",'s.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company",'s.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company",'s.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company','s.fk_stcomm'=>'company'); // We define here only fields that use another picto
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_societe as cf, '.MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object ';
$this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category',1).')'; $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category',1).')';
$this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories
// Add extra fields
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe'";
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)
{
while ($obj=$this->db->fetch_object($resql))
{
$fieldname='extra.'.$obj->name;
$fieldlabel=ucfirst($obj->label);
$typeFilter="Text";
switch($obj->type)
{
case 'int':
case 'double':
case 'price':
$typeFilter="Numeric";
break;
case 'date':
case 'datetime':
$typeFilter="Date";
break;
case 'boolean':
$typeFilter="Boolean";
break;
case 'sellist':
$typeFilter="List:".$obj->param;
break;
case 'select':
$typeFilter="Select:".$obj->param;
break;
}
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
$this->export_entities_array[$r][$fieldname]='company';
}
}
// End add axtra fields
$r++; $r++;
$this->export_code[$r]='category_'.$r; $this->export_code[$r]='category_'.$r;
$this->export_label[$r]='CatProdList'; $this->export_label[$r]='CatProdList';
@ -303,6 +351,7 @@ class modCategorie extends DolibarrModules
$this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc';
$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
$this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category',1).')';
$this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories

View File

@ -114,7 +114,7 @@ class modCommande extends DolibarrModules
$this->rights[$r][0] = 81; $this->rights[$r][0] = 81;
$this->rights[$r][1] = 'Lire les commandes clients'; $this->rights[$r][1] = 'Lire les commandes clients';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -170,6 +170,12 @@ class modCommande extends DolibarrModules
$this->rights[$r][4] = 'commande'; $this->rights[$r][4] = 'commande';
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -91,9 +91,15 @@ class modComptabilite extends DolibarrModules
$this->rights[$r][0] = 95; $this->rights[$r][0] = 95;
$this->rights[$r][1] = 'Lire CA, bilans, resultats'; $this->rights[$r][1] = 'Lire CA, bilans, resultats';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'resultat'; $this->rights[$r][4] = 'resultat';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }

View File

@ -91,7 +91,7 @@ class modContrat extends DolibarrModules
$this->rights[$r][0] = 161; $this->rights[$r][0] = 161;
$this->rights[$r][1] = 'Lire les contrats'; $this->rights[$r][1] = 'Lire les contrats';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -130,6 +130,11 @@ class modContrat extends DolibarrModules
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$langs->load("contracts"); $langs->load("contracts");

View File

@ -108,7 +108,7 @@ class modCron extends DolibarrModules
$this->rights[$r][0] = 23001; $this->rights[$r][0] = 23001;
$this->rights[$r][1] = 'Read cron jobs'; $this->rights[$r][1] = 'Read cron jobs';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$r++; $r++;

View File

@ -108,6 +108,12 @@ class modDeplacement extends DolibarrModules
$this->rights[5][3] = 0; $this->rights[5][3] = 0;
$this->rights[5][4] = 'export'; $this->rights[5][4] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
$r=0; $r=0;

View File

@ -84,7 +84,7 @@ class modDocumentGeneration extends DolibarrModules
$this->rights[$r][0] = 1521; $this->rights[$r][0] = 1521;
$this->rights[$r][1] = 'Lire les documents'; $this->rights[$r][1] = 'Lire les documents';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;

View File

@ -135,7 +135,12 @@ class modDon extends DolibarrModules
$this->rights[3][2] = 'd'; $this->rights[3][2] = 'd';
$this->rights[3][3] = 0; $this->rights[3][3] = 0;
$this->rights[3][4] = 'supprimer'; $this->rights[3][4] = 'supprimer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }

View File

@ -83,5 +83,6 @@ class modDynamicPrices extends DolibarrModules
$this->rights = array(); $this->rights = array();
$this->rights_class = 'dynamicprices'; $this->rights_class = 'dynamicprices';
$r=0; $r=0;
} }
} }

View File

@ -101,21 +101,21 @@ class modECM extends DolibarrModules
$this->rights[$r][0] = 2501; $this->rights[$r][0] = 2501;
$this->rights[$r][1] = 'Consulter/Télécharger les documents'; $this->rights[$r][1] = 'Consulter/Télécharger les documents';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$r++; $r++;
$this->rights[$r][0] = 2503; $this->rights[$r][0] = 2503;
$this->rights[$r][1] = 'Soumettre ou supprimer des documents'; $this->rights[$r][1] = 'Soumettre ou supprimer des documents';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'upload'; $this->rights[$r][4] = 'upload';
$r++; $r++;
$this->rights[$r][0] = 2515; $this->rights[$r][0] = 2515;
$this->rights[$r][1] = 'Administrer les rubriques de documents'; $this->rights[$r][1] = 'Administrer les rubriques de documents';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'setup'; $this->rights[$r][4] = 'setup';

View File

@ -145,7 +145,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][0] = 101; $this->rights[$r][0] = 101;
$this->rights[$r][1] = 'Lire les expeditions'; $this->rights[$r][1] = 'Lire les expeditions';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -190,7 +190,7 @@ class modExpedition extends DolibarrModules
$this->rights[$r][0] = 1101; $this->rights[$r][0] = 1101;
$this->rights[$r][1] = 'Lire les bons de livraison'; $this->rights[$r][1] = 'Lire les bons de livraison';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -218,6 +218,12 @@ class modExpedition extends DolibarrModules
$this->rights[$r][4] = 'livraison'; $this->rights[$r][4] = 'livraison';
$this->rights[$r][5] = 'supprimer'; $this->rights[$r][5] = 'supprimer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -193,6 +193,12 @@ class modExpenseReport extends DolibarrModules
$this->rights[5][3] = 0; $this->rights[5][3] = 0;
$this->rights[5][4] = 'export'; $this->rights[5][4] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
$r=0; $r=0;

View File

@ -81,7 +81,7 @@ class modExport extends DolibarrModules
$this->rights[$r][0] = 1201; $this->rights[$r][0] = 1201;
$this->rights[$r][1] = 'Lire les exports'; $this->rights[$r][1] = 'Lire les exports';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -90,5 +90,11 @@ class modExport extends DolibarrModules
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer'; $this->rights[$r][4] = 'creer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
} }

View File

@ -97,7 +97,7 @@ class modFTP extends DolibarrModules
$this->rights[$r][0] = 2801; $this->rights[$r][0] = 2801;
$this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)'; $this->rights[$r][1] = 'Use FTP client in read mode (browse and download only)';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$r++; $r++;
@ -107,12 +107,9 @@ class modFTP extends DolibarrModules
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write'; $this->rights[$r][4] = 'write';
// Menus // Menus
//------ //-------
$this->menus = array(); // List of menus to add
$r=0;
// Top menu
$this->menu[$r]=array('fk_menu'=>0, $this->menu[$r]=array('fk_menu'=>0,
'type'=>'top', 'type'=>'top',
'titre'=>'FTP', 'titre'=>'FTP',

View File

@ -126,7 +126,7 @@ class modFacture extends DolibarrModules
$this->rights[$r][0] = 11; $this->rights[$r][0] = 11;
$this->rights[$r][1] = 'Lire les factures'; $this->rights[$r][1] = 'Lire les factures';
$this->rights[$r][2] = 'a'; $this->rights[$r][2] = 'a';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -184,6 +184,11 @@ class modFacture extends DolibarrModules
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=1; $r=1;

View File

@ -99,7 +99,7 @@ class modFicheinter extends DolibarrModules
$this->rights[$r][0] = 61; $this->rights[$r][0] = 61;
$this->rights[$r][1] = 'Lire les fiches d\'intervention'; $this->rights[$r][1] = 'Lire les fiches d\'intervention';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -147,6 +147,12 @@ class modFicheinter extends DolibarrModules
$this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][4] = 'ficheinter_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'unvalidate'; $this->rights[$r][5] = 'unvalidate';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
//Exports //Exports
//-------- //--------
$r=1; $r=1;

View File

@ -129,14 +129,14 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][0] = 1181; $this->rights[$r][0] = 1181;
$this->rights[$r][1] = 'Consulter les fournisseurs'; $this->rights[$r][1] = 'Consulter les fournisseurs';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
$this->rights[$r][0] = 1182; $this->rights[$r][0] = 1182;
$this->rights[$r][1] = 'Consulter les commandes fournisseur'; $this->rights[$r][1] = 'Consulter les commandes fournisseur';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'commande'; $this->rights[$r][4] = 'commande';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -209,7 +209,7 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][0] = 1231; $this->rights[$r][0] = 1231;
$this->rights[$r][1] = 'Consulter les factures fournisseur'; $this->rights[$r][1] = 'Consulter les factures fournisseur';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'facture'; $this->rights[$r][4] = 'facture';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -272,7 +272,12 @@ class modFournisseur extends DolibarrModules
$this->rights[$r][5] = 'approve2'; $this->rights[$r][5] = 'approve2';
} }
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -114,7 +114,7 @@ class modGravatar extends DolibarrModules
// Example: // Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;

View File

@ -99,21 +99,21 @@ class modHRM extends DolibarrModules
$this->rights[$r][0] = 4001; $this->rights[$r][0] = 4001;
$this->rights[$r][1] = 'See employees'; $this->rights[$r][1] = 'See employees';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee'; $this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'read'; $this->rights[$r][5] = 'read';
$r ++; $r ++;
$this->rights[$r][0] = 4002; $this->rights[$r][0] = 4002;
$this->rights[$r][1] = 'Create employees'; $this->rights[$r][1] = 'Create employees';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee'; $this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'write'; $this->rights[$r][5] = 'write';
$r ++; $r ++;
$this->rights[$r][0] = 4003; $this->rights[$r][0] = 4003;
$this->rights[$r][1] = 'Delete employees'; $this->rights[$r][1] = 'Delete employees';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'employee'; $this->rights[$r][4] = 'employee';
$this->rights[$r][5] = 'delete'; $this->rights[$r][5] = 'delete';
$r ++; $r ++;
@ -125,9 +125,11 @@ class modHRM extends DolibarrModules
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
$r ++; $r ++;
// Main menu entries
$this->menus = array (); // List of menus to add // Menus
$r = 0; //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
/** /**

View File

@ -133,14 +133,14 @@ class modHoliday extends DolibarrModules
$this->rights[$r][0] = 20001; // Permission id (must not be already used) $this->rights[$r][0] = 20001; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read your own holidays'; // Permission label $this->rights[$r][1] = 'Read your own holidays'; // Permission label
$this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++; $r++;
$this->rights[$r][0] = 20002; // Permission id (must not be already used) $this->rights[$r][0] = 20002; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label $this->rights[$r][1] = 'Create/modify your own holidays'; // Permission label
$this->rights[$r][3] = 1; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++; $r++;
@ -173,10 +173,11 @@ class modHoliday extends DolibarrModules
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++; $r++;
// Main menu entries
$this->menus = array(); // List of menus to add // Menus
$r=0; //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
$r=1; $r=1;

View File

@ -85,5 +85,11 @@ class modImport extends DolibarrModules
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'run'; $this->rights[$r][4] = 'run';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
} }

View File

@ -99,7 +99,7 @@ class modLoan extends DolibarrModules
$this->rights[$r][0] = 520; $this->rights[$r][0] = 520;
$this->rights[$r][1] = 'Read loans'; $this->rights[$r][1] = 'Read loans';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
@ -135,7 +135,12 @@ class modLoan extends DolibarrModules
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -79,7 +79,7 @@ class modMailing extends DolibarrModules
$this->rights[$r][0] = 221; // id de la permission $this->rights[$r][0] = 221; // id de la permission
$this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission $this->rights[$r][1] = 'Consulter les mailings'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -127,6 +127,10 @@ class modMailing extends DolibarrModules
$this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][4] = 'mailing_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'delete'; $this->rights[$r][5] = 'delete';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }

View File

@ -76,5 +76,10 @@ class modMailmanSpip extends DolibarrModules
// Permissions // Permissions
$this->rights = array(); $this->rights = array();
$this->rights_class = 'clicktodial'; $this->rights_class = 'clicktodial';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }
} }

View File

@ -126,7 +126,7 @@ class modMargin extends DolibarrModules
$this->rights[$r][0] = 59001; // id de la permission $this->rights[$r][0] = 59001; // id de la permission
$this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission $this->rights[$r][1] = 'Visualiser les marges'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'liretous'; $this->rights[$r][4] = 'liretous';
$r++; $r++;

View File

@ -189,7 +189,7 @@ class modMultiCurrency extends DolibarrModules
// Example: // Example:
// $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;

View File

@ -97,7 +97,7 @@ class modOauth extends DolibarrModules
$this->rights[$r][0] = 66000; $this->rights[$r][0] = 66000;
$this->rights[$r][1] = 'OauthAccess'; $this->rights[$r][1] = 'OauthAccess';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read';*/ $this->rights[$r][4] = 'read';*/
// Main menu entries // Main menu entries

View File

@ -119,23 +119,9 @@ class modOpenSurvey extends DolibarrModules
$r++; $r++;
// Main menu entries // Menus
$this->menus = array(); // List of menus to add //-------
$r=0; $r=0;
/*
$this->menu[$r]=array( 'fk_menu'=>0, // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'top',
'titre'=>'Surveys',
'mainmenu'=>'opensurvey',
'url'=>'/opensurvey/index.php',
'langs'=>'opensurvey',
'position'=>200,
'enabled'=>'$conf->opensurvey->enabled', // Define condition to show or hide menu entry. Use '$conf->NewsSubmitter->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->opensurvey->read',
'target'=>'',
'user'=>0);
$r++;*/
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', 'type'=>'left',
'titre'=>'Survey', 'titre'=>'Survey',

View File

@ -106,7 +106,7 @@ class modPayBox extends DolibarrModules
// Example: // Example:
// $this->rights[$r][0] = 2000; // Permission id (must not be already used) // $this->rights[$r][0] = 2000; // Permission id (must not be already used)
// $this->rights[$r][1] = 'Permision label'; // Permission label // $this->rights[$r][1] = 'Permision label'; // Permission label
// $this->rights[$r][3] = 1; // Permission by default for new user (0/1) // $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
// $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
// $r++; // $r++;

View File

@ -94,7 +94,7 @@ class modPrelevement extends DolibarrModules
$this->rights[$r][0] = 151; $this->rights[$r][0] = 151;
$this->rights[$r][1] = 'Read withdrawals'; $this->rights[$r][1] = 'Read withdrawals';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'bons'; $this->rights[$r][4] = 'bons';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -129,6 +129,11 @@ class modPrelevement extends DolibarrModules
$this->rights[2][4] = 'bons'; $this->rights[2][4] = 'bons';
$this->rights[2][5] = 'configurer'; $this->rights[2][5] = 'configurer';
*/ */
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
} }

View File

@ -97,7 +97,7 @@ class modPrinting extends DolibarrModules
$this->rights[$r][0] = 64001; $this->rights[$r][0] = 64001;
$this->rights[$r][1] = 'DirectPrint'; $this->rights[$r][1] = 'DirectPrint';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
// Main menu entries // Main menu entries

View File

@ -99,7 +99,7 @@ class modProduct extends DolibarrModules
$this->rights[$r][0] = 31; // id de la permission $this->rights[$r][0] = 31; // id de la permission
$this->rights[$r][1] = 'Lire les produits'; // libelle de la permission $this->rights[$r][1] = 'Lire les produits'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -124,6 +124,10 @@ class modProduct extends DolibarrModules
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
$r++; $r++;
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
/* We can't enable this here because it must be enabled in both product and service module and this create duplicate insert /* We can't enable this here because it must be enabled in both product and service module and this create duplicate insert
$r=0; $r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode $this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=admintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode

View File

@ -95,10 +95,12 @@ class modProductBatch extends DolibarrModules
$this->rights = array(); // Permission array used by this module $this->rights = array(); // Permission array used by this module
$r=0; $r=0;
// Main menu entries
$this->menu = array(); // List of menus to add // Menus
$r=0; //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
$r=0; $r=0;

View File

@ -154,7 +154,7 @@ class modProjet extends DolibarrModules
$this->rights[$r][0] = 41; // id de la permission $this->rights[$r][0] = 41; // id de la permission
$this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission $this->rights[$r][1] = "Read projects and tasks (shared projects or projects I am contact for). Can also enter time consumed on assigned tasks (timesheet)"; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -203,6 +203,11 @@ class modProjet extends DolibarrModules
$this->rights[$r][5] = 'supprimer'; $this->rights[$r][5] = 'supprimer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
//Exports //Exports
//-------- //--------
$r=1; $r=1;

View File

@ -116,7 +116,7 @@ class modPropale extends DolibarrModules
$this->rights[$r][0] = 21; // id de la permission $this->rights[$r][0] = 21; // id de la permission
$this->rights[$r][1] = 'Lire les propositions commerciales'; // libelle de la permission $this->rights[$r][1] = 'Lire les propositions commerciales'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -163,6 +163,12 @@ class modPropale extends DolibarrModules
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -97,7 +97,7 @@ class modReceiptPrinter extends DolibarrModules
$this->rights[$r][0] = 67000; $this->rights[$r][0] = 67000;
$this->rights[$r][1] = 'ReceiptPrinter'; $this->rights[$r][1] = 'ReceiptPrinter';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
// Main menu entries // Main menu entries

View File

@ -196,6 +196,11 @@ class modResource extends DolibarrModules
$r++; $r++;
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Add here list of permission defined by // Add here list of permission defined by
// an id, a label, a boolean and two constant strings. // an id, a label, a boolean and two constant strings.
// Example: // Example:
@ -204,7 +209,7 @@ class modResource extends DolibarrModules
//// Permission label //// Permission label
//$this->rights[$r][1] = 'Permision label'; //$this->rights[$r][1] = 'Permision label';
//// Permission by default for new user (0/1) //// Permission by default for new user (0/1)
//$this->rights[$r][3] = 1; //$this->rights[$r][3] = 0;
//// In php code, permission will be checked by test //// In php code, permission will be checked by test
//// if ($user->rights->permkey->level1->level2) //// if ($user->rights->permkey->level1->level2)
//$this->rights[$r][4] = 'level1'; //$this->rights[$r][4] = 'level1';

View File

@ -54,7 +54,7 @@ class modSalaries extends DolibarrModules
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
// Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = "Employees salaries management"; $this->description = "Employees contracts and salaries management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version // Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr'; $this->version = 'dolibarr';
@ -97,8 +97,8 @@ class modSalaries extends DolibarrModules
$r=0; $r=0;
$r++; $r++;
$this->rights[$r][0] = 510; $this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Read salaries'; $this->rights[$r][1] = 'Read employee contracts/salaries';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
@ -106,15 +106,23 @@ class modSalaries extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 512; $this->rights[$r][0] = 512;
$this->rights[$r][1] = 'Create/modify salaries'; $this->rights[$r][1] = 'Create/modify employee contracts/salaries';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write'; $this->rights[$r][4] = 'write';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
$r++;
$this->rights[$r][0] = 513;
$this->rights[$r][1] = 'Create/modify payment of salaries';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'write';
$this->rights[$r][5] = '';
$r++; $r++;
$this->rights[$r][0] = 514; $this->rights[$r][0] = 514;
$this->rights[$r][1] = 'Delete salaries'; $this->rights[$r][1] = 'Delete contracts/salaries';
$this->rights[$r][2] = 'd'; $this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'delete'; $this->rights[$r][4] = 'delete';
@ -122,13 +130,18 @@ class modSalaries extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 517; $this->rights[$r][0] = 517;
$this->rights[$r][1] = 'Export salaries'; $this->rights[$r][1] = 'Export employee contracts and salaries payments';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'export'; $this->rights[$r][4] = 'export';
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -88,7 +88,7 @@ class modService extends DolibarrModules
$this->rights[$r][0] = 531; // id de la permission $this->rights[$r][0] = 531; // id de la permission
$this->rights[$r][1] = 'Lire les services'; // libelle de la permission $this->rights[$r][1] = 'Lire les services'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
@ -130,7 +130,12 @@ class modService extends DolibarrModules
*/ */
// Exports // Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
//-------- //--------
$r=0; $r=0;

View File

@ -143,7 +143,7 @@ class modSociete extends DolibarrModules
$this->rights[$r][0] = 121; // id de la permission $this->rights[$r][0] = 121; // id de la permission
$this->rights[$r][1] = 'Lire les societes'; // libelle de la permission $this->rights[$r][1] = 'Lire les societes'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
/* $r++; /* $r++;
@ -206,7 +206,7 @@ class modSociete extends DolibarrModules
$this->rights[$r][0] = 262; $this->rights[$r][0] = 262;
$this->rights[$r][1] = 'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).'; $this->rights[$r][1] = 'Consulter tous les tiers par utilisateurs internes (sinon uniquement si contact commercial). Non effectif pour utilisateurs externes (tjs limités à eux-meme).';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'client'; $this->rights[$r][4] = 'client';
$this->rights[$r][5] = 'voir'; $this->rights[$r][5] = 'voir';
@ -214,7 +214,7 @@ class modSociete extends DolibarrModules
$this->rights[$r][0] = 281; // id de la permission $this->rights[$r][0] = 281; // id de la permission
$this->rights[$r][1] = 'Lire les contacts'; // libelle de la permission $this->rights[$r][1] = 'Lire les contacts'; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'contact'; $this->rights[$r][4] = 'contact';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -242,7 +242,12 @@ class modSociete extends DolibarrModules
$this->rights[$r][4] = 'contact'; $this->rights[$r][4] = 'contact';
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -117,6 +117,12 @@ class modStock extends DolibarrModules
$this->rights[4][4] = 'mouvement'; $this->rights[4][4] = 'mouvement';
$this->rights[4][5] = 'creer'; $this->rights[4][5] = 'creer';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -102,13 +102,13 @@ class modSupplierProposal extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = $this->numero + $r; // id de la permission $this->rights[$r][0] = $this->numero + $r; // id de la permission
$this->rights[$r][1] = 'Read supplier proposals'; // libelle de la permission $this->rights[$r][1] = 'Read supplier proposals'; // libelle de la permission
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'lire'; $this->rights[$r][4] = 'lire';
$r++; $r++;
$this->rights[$r][0] = $this->numero + $r; // id de la permission $this->rights[$r][0] = $this->numero + $r; // id de la permission
$this->rights[$r][1] = 'Create/modify supplier proposals'; // libelle de la permission $this->rights[$r][1] = 'Create/modify supplier proposals'; // libelle de la permission
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'creer'; $this->rights[$r][4] = 'creer';
$r++; $r++;

View File

@ -88,7 +88,7 @@ class modTax extends DolibarrModules
$this->rights[$r][0] = 91; $this->rights[$r][0] = 91;
$this->rights[$r][1] = 'Lire les charges'; $this->rights[$r][1] = 'Lire les charges';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'charges'; $this->rights[$r][4] = 'charges';
$this->rights[$r][5] = 'lire'; $this->rights[$r][5] = 'lire';
@ -117,6 +117,12 @@ class modTax extends DolibarrModules
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -134,7 +134,7 @@ class modUser extends DolibarrModules
$this->rights[$r][0] = 341; $this->rights[$r][0] = 341;
$this->rights[$r][1] = 'Consulter ses propres permissions'; $this->rights[$r][1] = 'Consulter ses propres permissions';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'readperms'; $this->rights[$r][5] = 'readperms';
@ -142,7 +142,7 @@ class modUser extends DolibarrModules
$this->rights[$r][0] = 342; $this->rights[$r][0] = 342;
$this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur'; $this->rights[$r][1] = 'Creer/modifier ses propres infos utilisateur';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self'; $this->rights[$r][4] = 'self';
$this->rights[$r][5] = 'creer'; $this->rights[$r][5] = 'creer';
@ -150,7 +150,7 @@ class modUser extends DolibarrModules
$this->rights[$r][0] = 343; $this->rights[$r][0] = 343;
$this->rights[$r][1] = 'Modifier son propre mot de passe'; $this->rights[$r][1] = 'Modifier son propre mot de passe';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self'; $this->rights[$r][4] = 'self';
$this->rights[$r][5] = 'password'; $this->rights[$r][5] = 'password';
@ -158,7 +158,7 @@ class modUser extends DolibarrModules
$this->rights[$r][0] = 344; $this->rights[$r][0] = 344;
$this->rights[$r][1] = 'Modifier ses propres permissions'; $this->rights[$r][1] = 'Modifier ses propres permissions';
$this->rights[$r][2] = 'w'; $this->rights[$r][2] = 'w';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on $this->rights[$r][4] = 'self_advance'; // Visible if option MAIN_USE_ADVANCED_PERMS is on
$this->rights[$r][5] = 'writeperms'; $this->rights[$r][5] = 'writeperms';
@ -202,6 +202,13 @@ class modUser extends DolibarrModules
$this->rights[$r][4] = 'user'; $this->rights[$r][4] = 'user';
$this->rights[$r][5] = 'export'; $this->rights[$r][5] = 'export';
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports // Exports
//-------- //--------
$r=0; $r=0;

View File

@ -92,7 +92,7 @@ class modWebsites extends DolibarrModules
$this->rights[$r][0] = 10001; $this->rights[$r][0] = 10001;
$this->rights[$r][1] = 'Read website content'; $this->rights[$r][1] = 'Read website content';
$this->rights[$r][3] = 1; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
$r++; $r++;

View File

@ -94,7 +94,7 @@ class modWorkflow extends DolibarrModules
$this->rights[$r][0] = 6001; // id de la permission $this->rights[$r][0] = 6001; // id de la permission
$this->rights[$r][1] = "Lire les workflow"; // libelle de la permission $this->rights[$r][1] = "Lire les workflow"; // libelle de la permission
$this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour) $this->rights[$r][2] = 'r'; // type de la permission (deprecie a ce jour)
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
*/ */

View File

@ -722,7 +722,7 @@ class Expedition extends CommonObject
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record.
// Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version)
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentValidatedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
if ($result < 0) { if ($result < 0) {
$error++; $error++;
$this->errors[]=$mouvS->error; $this->errors[]=$mouvS->error;
@ -1917,7 +1917,7 @@ class Expedition extends CommonObject
// line with batch detail // line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
if ($result < 0) { if ($result < 0) {
$this->error = $mouvS->error; $this->error = $mouvS->error;
$this->errors = $mouvS->errors; $this->errors = $mouvS->errors;
@ -2082,7 +2082,7 @@ class Expedition extends CommonObject
// line with batch detail // line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $obj->eatby, $obj->sellby, $obj->batch, $obj->fk_origin_stock); $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ShipmentUnClassifyCloseddInDolibarr",$numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
if ($result < 0) { if ($result < 0) {
$this->error = $mouvS->error; $this->error = $mouvS->error;
$this->errors = $mouvS->errors; $this->errors = $mouvS->errors;

View File

@ -379,7 +379,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= " t.tva,"; $sql.= " t.tva,";
$sql.= " t.localtax1,"; $sql.= " t.localtax1,";
$sql.= " t.localtax2,"; $sql.= " t.localtax2,";
$sql.= " t.total,"; //$sql.= " t.total,";
$sql.= " t.total_ht,"; $sql.= " t.total_ht,";
$sql.= " t.total_tva,"; $sql.= " t.total_tva,";
$sql.= " t.total_ttc,"; $sql.= " t.total_ttc,";
@ -440,7 +440,7 @@ class FactureFournisseur extends CommonInvoice
$this->tva = $obj->tva; $this->tva = $obj->tva;
$this->total_localtax1 = $obj->localtax1; $this->total_localtax1 = $obj->localtax1;
$this->total_localtax2 = $obj->localtax2; $this->total_localtax2 = $obj->localtax2;
$this->total = $obj->total; //$this->total = $obj->total;
$this->total_ht = $obj->total_ht; $this->total_ht = $obj->total_ht;
$this->total_tva = $obj->total_tva; $this->total_tva = $obj->total_tva;
$this->total_ttc = $obj->total_ttc; $this->total_ttc = $obj->total_ttc;
@ -1908,7 +1908,7 @@ class FactureFournisseur extends CommonInvoice
* @param int $hidedetails Hide details of lines * @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description * @param int $hidedesc Hide description
* @param int $hideref Hide ref * @param int $hideref Hide ref
* @return int 0 if KO, 1 if OK * @return int <0 if KO, 0 if nothing done, >0 if OK
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
@ -1917,7 +1917,7 @@ class FactureFournisseur extends CommonInvoice
$langs->load("suppliers"); $langs->load("suppliers");
// Set the model on the model name to use // Set the model on the model name to use
if (! dol_strlen($modele)) if (empty($modele))
{ {
if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF)) if (! empty($conf->global->INVOICE_SUPPLIER_ADDON_PDF))
{ {
@ -1925,13 +1925,20 @@ class FactureFournisseur extends CommonInvoice
} }
else else
{ {
$modele = 'canelle'; $modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation
} }
} }
if (empty($modele))
{
return 0;
}
else
{
$modelpath = "core/modules/supplier_invoice/pdf/";
$modelpath = "core/modules/supplier_invoice/pdf/"; return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
} }
/** /**

View File

@ -254,6 +254,24 @@ if (empty($reshook))
if ($object->update($user) < 0) { if ($object->update($user) < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else
{
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id'))
$newlang = GETPOST('lang_id');
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$ret = $object->fetch($object->id); // Reload to get new records
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
} }
// payments conditions // payments conditions
@ -559,7 +577,7 @@ if (empty($reshook))
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$outputlangs = $langs; $outputlangs = $langs;
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) if ($result < 0)
{ {
dol_print_error($db,$object->error,$object->errors); dol_print_error($db,$object->error,$object->errors);
exit; exit;
@ -969,7 +987,7 @@ if (empty($reshook))
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action=''; $action='';
@ -2325,7 +2343,7 @@ else
if (! $file || ! is_readable($file)) if (! $file || ! is_readable($file))
{ {
$result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $result = $object->generateDocument(GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0) if ($result < 0)
{ {
dol_print_error($db,$object->error,$object->errors); dol_print_error($db,$object->error,$object->errors);
exit; exit;

View File

@ -291,7 +291,7 @@ if ($search_ref)
else $sql .= natural_search('f.ref', $search_ref); else $sql .= natural_search('f.ref', $search_ref);
} }
if ($search_ref) $sql .= natural_search('f.ref', $search_ref); if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
if ($search_ref_supplier) $sql .= natural_search('f.ref_supplier', $search_ref_supplier); if ($search_refsupplier) $sql .= natural_search('f.ref_supplier', $search_refsupplier);
if ($search_project) $sql .= natural_search('p.ref', $search_project); if ($search_project) $sql .= natural_search('p.ref', $search_project);
if ($search_societe) $sql .= natural_search('s.nom', $search_societe); if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_town) $sql.= natural_search('s.town', $search_town); if ($search_town) $sql.= natural_search('s.town', $search_town);
@ -300,7 +300,7 @@ if ($search_state) $sql.= natural_search("state.nom",$search_state);
if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_company) $sql .= natural_search('s.nom', $search_company); if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_ht != '') $sql.= natural_search('f.total_ht', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1); if ($search_montant_vat != '') $sql.= natural_search('f.total_tva', $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status); if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status);
@ -405,7 +405,7 @@ if ($resql)
if ($month_lim) $param.='&month_lim='.urlencode($month_lim); if ($month_lim) $param.='&month_lim='.urlencode($month_lim);
if ($year_lim) $param.='&year_lim=' .urlencode($year_lim); if ($year_lim) $param.='&year_lim=' .urlencode($year_lim);
if ($search_ref) $param.='&search_ref='.urlencode($search_ref); if ($search_ref) $param.='&search_ref='.urlencode($search_ref);
if ($search_refsupplier) $param.='&search_refsupplier'.urlencode($search_refsupplier); if ($search_refsupplier) $param.='&search_refsupplier='.urlencode($search_refsupplier);
if ($search_label) $param.='&search_label='.urlencode($search_label); if ($search_label) $param.='&search_label='.urlencode($search_label);
if ($search_company) $param.='&search_company='.urlencode($search_company); if ($search_company) $param.='&search_company='.urlencode($search_company);
if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ht != '') $param.='&search_montant_ht='.urlencode($search_montant_ht);

View File

@ -33,6 +33,7 @@ DELETE FROM llx_menu where module='expensereport';
ALTER TABLE llx_user DROP COLUMN phenix_login; ALTER TABLE llx_user DROP COLUMN phenix_login;
ALTER TABLE llx_user DROP COLUMN phenix_pass; ALTER TABLE llx_user DROP COLUMN phenix_pass;
ALTER TABLE llx_user ADD COLUMN dateemployment datetime;
ALTER TABLE llx_societe ADD COLUMN fk_account integer; ALTER TABLE llx_societe ADD COLUMN fk_account integer;
@ -114,3 +115,6 @@ create table llx_product_warehouse_properties
desiredstock integer DEFAULT '0', desiredstock integer DEFAULT '0',
import_key varchar(14) -- Import key import_key varchar(14) -- Import key
)ENGINE=innodb; )ENGINE=innodb;
ALTER TABLE llx_accounting_bookkeeping ADD COLUMN entity integer DEFAULT 1 NOT NULL;

View File

@ -20,6 +20,7 @@
CREATE TABLE llx_accounting_bookkeeping CREATE TABLE llx_accounting_bookkeeping
( (
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
doc_date date NOT NULL, doc_date date NOT NULL,
doc_type varchar(30) NOT NULL, -- facture_client/reglement_client/facture_fournisseur/reglement_fournisseur doc_type varchar(30) NOT NULL, -- facture_client/reglement_client/facture_fournisseur/reglement_fournisseur
doc_ref varchar(300) NOT NULL, -- facture_client/reglement_client/... reference number doc_ref varchar(300) NOT NULL, -- facture_client/reglement_client/... reference number

View File

@ -54,7 +54,8 @@ create table llx_facturedet
buy_price_ht double(24,8) DEFAULT 0, -- buying price buy_price_ht double(24,8) DEFAULT 0, -- buying price
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
fk_code_ventilation integer DEFAULT 0 NOT NULL, fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line
special_code integer DEFAULT 0, -- code pour les lignes speciales special_code integer DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0, -- position of line rang integer DEFAULT 0, -- position of line
fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines

View File

@ -21,8 +21,8 @@
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_login (login, entity);
ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc); ALTER TABLE llx_user ADD INDEX idx_user_fk_societe (fk_soc);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_socpeople (fk_socpeople);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_fk_member (fk_member);
ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_api_key (api_key); ALTER TABLE llx_user ADD UNIQUE INDEX uk_user_api_key (api_key);

View File

@ -78,7 +78,9 @@ create table llx_user
nb_holiday integer DEFAULT 0, nb_holiday integer DEFAULT 0,
thm double(24,8), thm double(24,8),
tjm double(24,8), tjm double(24,8),
salary double(24,8),
salaryextra double(24,8), salary double(24,8), -- denormalized value coming from llx_user_employment
weeklyhours double(16,8) salaryextra double(24,8), -- denormalized value coming from llx_user_employment
dateemployment date, -- denormalized value coming from llx_user_employment
weeklyhours double(16,8) -- denormalized value coming from llx_user_employment
)ENGINE=innodb; )ENGINE=innodb;

View File

@ -0,0 +1,21 @@
-- ============================================================================
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- ===========================================================================
ALTER TABLE llx_user_employment ADD UNIQUE INDEX uk_user_employment (ref,entity);
ALTER TABLE llx_user_employment ADD CONSTRAINT fk_user_employment_fk_user FOREIGN KEY (fk_user) REFERENCES llx_user (rowid);

View File

@ -0,0 +1,39 @@
-- ============================================================================
-- Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- This table can be used to store employee working contracts
-- ===========================================================================
create table llx_user_employment
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref varchar(50), -- reference
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
fk_user integer,
datec datetime,
tms timestamp,
fk_user_creat integer,
fk_user_modif integer,
job varchar(128), -- job position. may be a dictionnary
status integer NOT NULL, -- draft, active, closed
salary double(24,8), -- last and current value stored into llx_user
salaryextra double(24,8), -- last and current value stored into llx_user
weeklyhours double(16,8) -- last and current value stored into llx_user
dateemployment date, -- last and current value stored into llx_user
dateemploymentend date, -- last and current value stored into llx_user
)ENGINE=innodb;

View File

@ -249,7 +249,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
$res=dol_include_once("/core/modules/".$file); $res=dol_include_once("/core/modules/".$file);
$res=activateModule($modtoactivatenew,1); $res=activateModule($modtoactivatenew,1);
if (! $result) print 'ERROR in activating module file='.$file; if (! empty($res['errors'])) print 'ERROR in activating module file='.$file;
} }
} }

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