Merge branch 'develop' into new_branch_20_04

This commit is contained in:
Philippe Grand 2017-05-06 11:05:33 +02:00 committed by GitHub
commit fe50dabf42
137 changed files with 2481 additions and 2298 deletions

View File

@ -152,7 +152,7 @@ tag 729538 -moreinfo
##### Testing a package into unstable env
##### Testing a package into a chroot environment
Check you have a mysql server available from another interface than "localhost".
Set line in /etc/mysql/my.cnf if required and restart mysql
@ -160,9 +160,11 @@ Set line in /etc/mysql/my.cnf if required and restart mysql
[mysqld]
bind-address = *
Create a chroot called "unstable-amd64-sbuild".
Create a chroot called "jessie" or "unstable".
Chroot env is stored into /srv/chroot directory.
> sudo sbuild-createchroot --keyring=unstable /srv/chroot/unstable http://ftp.uk.debian.org/debian
or
> sudo sbuild-createchroot jessie /srv/chroot/jessie http://ftp.uk.debian.org/debian
Pour lister les env chroot
> schroot -l
@ -170,8 +172,9 @@ or
> ls /srv/chroot
Puis pour se connecter et préparer l'environnement
> schroot -c name_of_chroot
> schroot -c name_of_chroot (exemple schroot -c unstable-amd64-sbuild)
> cat /etc/debian_chroot to check which debian branch we are into
> apt-get install vi dialog
> vi /usr/sbin/policy-rc.d and replace return code 101 (not allowed) into 0 (ok)
> apt-get update
> apt-get upgrade
@ -401,6 +404,7 @@ Note that package 3.5.7 contains not only fixed for bugs reported to debian. It
so it is a better solution to validate this maintenance release than applying a patch of the only CVE-2015-3935.
After discussion with ..., it appears that security holes are enough to request this unblock request."
Use this to request an full update of a stable package
reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls
@ -431,7 +435,7 @@ Use this to ask to apply patches on a stable version.
reportbug -B debian --smtphost=smtp.gmail.com:587 --smtpuser=xxxx --smtppasswd=yyyy --tls
Choose package "release.debian.org"
Then usertag "jessie-pu"
Then usertag "jessie-pu" (if tags is not available in list, choose another one, and change it later into email content text)
Then name of package "dolibarr"
Fill message, for example:
"Please unblock package dolibarr

View File

@ -1,168 +0,0 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/admin/journals.php
* \ingroup Advanced accountancy
* \brief Setup page to configure journals
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$action = GETPOST('action');
// Load variable for pagination
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield) $sortfield="j.rowid"; // Set here default search field
if (! $sortorder) $sortorder="ASC";
$langs->load("admin");
$langs->load("compta");
$langs->load("accountancy");
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we shoul be able to see fiscal year.
accessforbidden();
$error = 0;
// List of status
/*
static $tmptype2label = array (
'0' => 'AccountingJournalTypeVariousOperation',
'1' => 'AccountingJournalTypeSale',
'2' => 'AccountingJournalTypePurchase',
'3' => 'AccountingJournalTypeBank',
'9' => 'AccountingJournalTypeHasNew'
);
$type2label = array (
''
);
foreach ( $tmptype2label as $key => $val )
$type2label[$key] = $langs->trans($val);
*/
$errors = array ();
$object = new AccountingJournal($db);
/*
* Actions
*/
/*
* View
*/
$title = $langs->trans('AccountingJournals');
$helpurl = "";
llxHeader('', $title, $helpurl);
$max = 100;
$form = new Form($db);
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head(null);
dol_fiche_head($head, 'journal', $langs->trans("Configuration"), -1, 'cron');
$sql = "SELECT j.rowid, j.code, j.label, j.nature, j.active";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_journal as j";
// $sql .= " WHERE j.entity = " . $conf->entity;
$sql.=$db->order($sortfield,$sortorder);
// Count total nb of records
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= $db->plimit($limit+1, $offset);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
// $title = $langs->trans('AccountingJournals');
// print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, '', '', $limit, 1);
// Load attribute_label
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// print '<td>' . $langs->trans("Ref") . '</td>';
print '<td>' . $langs->trans("Code") . '</td>';
print '<td>' . $langs->trans("Label") . '</td>';
print '<td>' . $langs->trans("Nature") . '</td>';
print '</tr>';
if ($num) {
$accountingjournalstatic = new AccountingJournal($db);
while ( $i < $num && $i < $max ) {
$obj = $db->fetch_object($result);
$accountingjournalstatic->id = $obj->rowid;
print '<tr class="oddeven">';
print '<td><a href="journals_card.php?id=' . $obj->rowid . '">' . img_object($langs->trans("ShowJournal"), "technic") . ' ' . $obj->code . '</a></td>';
print '<td align="left">' . $obj->label . '</td>';
print '<td>' . $accountingjournalstatic->LibType($obj->nature, 0) . '</td>';
print '</tr>';
$i ++;
}
} else {
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">' . $langs->trans("None") . '</td></tr>';
}
print '</table>';
} else {
dol_print_error($db);
}
dol_fiche_end();
// Buttons
print '<div class="tabsAction">';
if (! empty($user->rights->accounting->fiscalyear))
{
print '<a class="butAction" href="journals_card.php?action=create">' . $langs->trans("NewAccountingJournal") . '</a>';
}
else
{
print '<a class="butActionRefused" href="#">' . $langs->trans("NewAccountingJournal") . '</a>';
}
print '</div>';
llxFooter();
$db->close();

View File

@ -1,294 +0,0 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/accountancy/admin/journals_card.php
* \ingroup Advanced accountancy
* \brief Page to show an accounting journal
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php';
$langs->load("admin");
$langs->load("compta");
$langs->load("accountancy");
// Security check
if ($user->societe_id > 0)
accessforbidden();
if (empty($user->rights->accounting->fiscalyear))
accessforbidden();
$error = 0;
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$id = GETPOST('id', 'int');
// List of status
static $tmptype2label = array (
'0' => 'AccountingJournalTypeVariousOperation',
'1' => 'AccountingJournalTypeSale',
'2' => 'AccountingJournalTypePurchase',
'3' => 'AccountingJournalTypeBank',
'9' => 'AccountingJournalTypeHasNew'
);
$type2label = array (
''
);
foreach ( $tmptype2label as $key => $val )
$type2label[$key] = $langs->trans($val);
$object = new AccountingJournal($db);
/*
* Actions
*/
if ($action == 'confirm_delete' && $confirm == "yes") {
$result = $object->delete($id);
if ($result >= 0) {
header("Location: journals.php");
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
}
else if ($action == 'add') {
if (! GETPOST('cancel', 'alpha')) {
$error = 0;
$object->code = GETPOST('code', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->nature = GETPOST('nature', 'int');
if (empty($object->code)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors');
$error ++;
}
if (empty($object->label)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$error ++;
}
if (! $error) {
$db->begin();
$id = $object->create($user);
if ($id > 0) {
$db->commit();
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit();
} else {
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
$action = 'create';
}
} else {
$action = 'create';
}
} else {
header("Location: ./journals.php");
exit();
}
}
// Update record
else if ($action == 'update') {
if (! GETPOST('cancel', 'alpha')) {
$result = $object->fetch($id);
$object->code = GETPOST('code', 'alpha');
$object->label = GETPOST('label', 'alpha');
$object->nature = GETPOST('nature', 'int');
if (empty($object->code)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Code")), null, 'errors');
$error ++;
}
if (empty($object->label)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$error ++;
}
$result = $object->update($user);
if ($result > 0) {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit();
} else {
setEventMessages($object->error, $object->errors, 'errors');
}
} else {
header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
exit();
}
}
/*
* View
*/
$title = $langs->trans("Journal") . " - " . $langs->trans("Card");
$helpurl = "";
llxHeader("",$title,$helpurl);
$form = new Form($db);
if ($action == 'create')
{
print load_fiche_titre($langs->trans("NewAccountingJournal"));
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
dol_fiche_head();
print '<table class="border" width="100%">';
// Code
print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Code") . '</td><td><input name="code" size="10" value="' . GETPOST("code") . '"></td></tr>';
// Label
print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td><td><input name="label" size="32" value="' . GETPOST("label") . '"></td></tr>';
// Nature
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Type") . '</td>';
print '<td class="valeur">';
print $form->selectarray('nature', $type2label, GETPOST('nature'));
print '</td></tr>';
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>';
} else if ($id) {
$result = $object->fetch($id);
if ($result > 0) {
$head = accounting_journal_prepare_head($object);
if ($action == 'edit') {
dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron');
print '<form name="update" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="' . $id . '">';
print '<table class="border" width="100%">';
// Code
print "<tr>";
print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("Code") . '</td><td>';
print '<input name="code" class="flat" size="8" value="' . $object->code . '">';
print '</td></tr>';
// Label
print '<tr><td class="fieldrequired">' . $langs->trans("Label") . '</td><td>';
print '<input name="label" class="flat" size="32" value="' . $object->label . '">';
print '</td></tr>';
// Nature
print '<tr><td>' . $langs->trans("Type") . '</td><td>';
print $form->selectarray('nature', $type2label, $object->nature);
print '</td></tr>';
print '</table>';
print '<br><div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>';
dol_fiche_end();
} else {
/*
* Confirm delete
*/
if ($action == 'delete') {
print $form->formconfirm($_SERVER["PHP_SELF"] . "?id=" . $id, $langs->trans("DeleteFiscalYear"), $langs->trans("ConfirmDeleteFiscalYear"), "confirm_delete");
}
dol_fiche_head($head, 'card', $langs->trans("AccountingJournal"), 0, 'cron');
print '<table class="border" width="100%">';
$linkback = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/journals.php">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td class="titlefield">' . $langs->trans("Code") . '</td><td width="50%">';
print $object->code;
print '</td><td>';
print $linkback;
print '</td></tr>';
// Label
print '<tr><td class="tdtop">';
print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print '</td><td colspan="2">';
print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32');
print "</td></tr>";
// Nature
print '<tr><td>' . $langs->trans("Type") . '</td><td colspan="2">' . $object->getLibType(0) . '</td></tr>';
print "</table>";
dol_fiche_end();
if (! empty($user->rights->accounting->fiscalyear))
{
/*
* 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="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
print '</div>';
}
}
} else {
dol_print_error($db);
}
}
llxFooter();
$db->close();

View File

@ -0,0 +1,752 @@
<?php
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/accountancy/admin/journals_list.php
* \ingroup Advanced accountancy
* \brief Setup page to configure journals
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
$langs->load("admin");
$langs->load("compta");
$langs->load("accountancy");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha');
// Security access
if (! empty($user->rights->accountancy->chartofaccount))
{
accessforbidden();
}
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
$listoffset=GETPOST('listoffset');
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
$active = 1;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; }
$offset = $listlimit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (empty($sortfield)) $sortfield='code';
if (empty($sortorder)) $sortorder='ASC';
$error = 0;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('admin'));
// This page is a generic page to edit dictionaries
// 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.
$taborder=array(35);
// Name of SQL tables of dictionaries
$tabname=array();
$tabname[35]= MAIN_DB_PREFIX."accounting_journal";
// Dictionary labels
$tablib=array();
$tablib[35]= "DictionaryAccountancyJournal";
// Requests to extract data
$tabsql=array();
$tabsql[35]= "SELECT a.rowid as rowid, a.code as code, a.label, a.nature, a.active FROM ".MAIN_DB_PREFIX."accounting_journal as a";
// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[35]="code ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[35]= "code,label,nature";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[35]= "code,label,nature";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[35]= "code,label,nature";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid=array();
$tabrowid[35]= "";
// Condition to show dictionary in setup page
$tabcond=array();
$tabcond[35]= ! empty($conf->accounting->enabled);
// List of help for fields
$tabhelp=array();
$tabhelp[35] = array('code'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
$tabfieldcheck[35] = array();
// Complete all arrays with entries found into modules
complete_dictionary_with_modules($taborder,$tabname,$tablib,$tabsql,$tabsqlsort,$tabfield,$tabfieldvalue,$tabfieldinsert,$tabrowid,$tabcond,$tabhelp,$tabfieldcheck);
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
// Must match ids defined into eldy.lib.php
$sourceList = array(
'1' => $langs->trans('AccountingJournalType1'),
'2' => $langs->trans('AccountingJournalType2'),
'3' => $langs->trans('AccountingJournalType3'),
'4' => $langs->trans('AccountingJournalType4'),
'9' => $langs->trans('AccountingJournalType9')
);
/*
* Actions
*/
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
{
$search_country_id = '';
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
// Check that all fields are filled
$ok=1;
foreach ($listfield as $f => $value)
{
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
}
// Other checks
if (isset($_POST["code"]))
{
if ($_POST["code"]=='0')
{
$ok=0;
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
}
/*if (!is_numeric($_POST['code'])) // disabled, code may not be in numeric base
{
$ok = 0;
$msg .= $langs->transnoentities('ErrorFieldFormat', $langs->transnoentities('Code')).'<br />';
}*/
}
// Clean some parameters
if ($_POST["accountancy_code"] <= 0) $_POST["accountancy_code"]=''; // If empty, we force to null
if ($_POST["accountancy_code_sell"] <= 0) $_POST["accountancy_code_sell"]=''; // If empty, we force to null
if ($_POST["accountancy_code_buy"] <= 0) $_POST["accountancy_code_buy"]=''; // If empty, we force to null
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd'))
{
if ($tabrowid[$id])
{
// Recupere id libre pour insertion
$newid=0;
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
$result = $db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
$newid=($obj->newid + 1);
} else {
dol_print_error($db);
}
}
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $tabrowid[$id].",";
$sql.= $tabfieldinsert[$id];
$sql.=",active)";
$sql.= " VALUES(";
// List of values
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $newid.",";
$i=0;
foreach ($listfieldinsert as $f => $value)
{
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.=",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
}
else
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
}
else {
dol_print_error($db);
}
}
}
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify'))
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
{
$sql.= $tabrowid[$id]."=";
$sql.= "'".$db->escape($rowid)."', ";
}
$i = 0;
foreach ($listfieldmodify as $field)
{
if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') {
$_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU');
}
else if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '' && ! ($listfieldvalue[$i] == 'code' && $id == 10)) $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
if (! $resql)
{
setEventMessages($db->error(), null, 'errors');
}
}
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if (GETPOST('actioncancel'))
{
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
}
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
if (! $result)
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
}
else
{
dol_print_error($db);
}
}
}
// activate
if ($action == $acts[0])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
// disable
if ($action == $acts[1])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
/*
* View
*/
$form = new Form($db);
$formadmin=new FormAdmin($db);
llxHeader();
$titre=$langs->trans("DictionarySetup");
$linkback='';
if ($id)
{
$titre.=' - '.$langs->trans($tablib[$id]);
$titlepicto='title_accountancy';
}
print load_fiche_titre($titre,$linkback,$titlepicto);
if (empty($id))
{
print $langs->trans("DictionaryDesc");
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
}
print "<br>\n";
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
}
//var_dump($elementList);
/*
* Show a dictionary
*/
if ($id)
{
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
if ($search_country_id > 0)
{
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
}
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
$sql.=$db->plimit($listlimit+1,$offset);
//print $sql;
$fieldlist=explode(',',$tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">';
// Form to add a new line
if ($tabname[$id])
{
$alabelisused=0;
$var=false;
$fieldlist=explode(',',$tabfield[$id]);
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$align="left";
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label')
{
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td>';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '<td style="min-width: 26px;"></td>';
print '</tr>';
// Line to enter new values
print '<tr class="oddeven nodrag nodrap nohover">';
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key=>$val)
{
if (GETPOST($val) != '')
$obj->$val=GETPOST($val);
}
}
$tmpaction = 'create';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook))
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
print '<td colspan="4" align="right">';
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";
print '<tr><td colspan="7">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;
$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
// There is several pages
if ($num > $listlimit)
{
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '</td></tr>';
}
// Title of lines
print '<tr class="liste_titre liste_titre_add">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield=1; // By defaut
$align="left";
$sortable=1;
$valuetoshow='';
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield'];
$valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align'];
$sortable=$tmp['sortable'];
*/
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='nature') { $valuetoshow=$langs->trans("Nature"); }
// Affiche nom du champ
if ($showfield)
{
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
// Title line with search boxes
print '<tr class="liste_titre_filter">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">';
if ($filterfound)
{
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
}
print '</td>';
print '</tr>';
if ($num)
{
// Lines with values
while ($i < $num)
{
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{
$tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
// Show fields
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
print '<td align="center" colspan="4">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '</td>';
}
else
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook))
{
foreach ($fieldlist as $field => $value)
{
$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
if ($valuetoshow=='all') {
$valuetoshow=$langs->trans('All');
}
else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') {
$langs->load("accountancy");
$key=$langs->trans("AccountingJournalType".strtoupper($obj->nature));
$valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($obj->nature)?$key:$obj->{$fieldlist[$field]});
}
$class='tddict';
// Show value for field
if ($showfield) print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
}
// Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
if (isset($obj->code) && $id != 10)
{
if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
}
$canbemodified=$iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param;
$url.='&';
// Active
print '<td align="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>';
// Delete link
if ($iserasable)
{
print '<td align="center">';
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionnary can be edited by other profile than admin
print '</td>';
}
else print '<td>&nbsp;</td>';
print '<td></td>';
print '</td>';
}
print "</tr>\n";
$i++;
}
}
}
else {
dol_print_error($db);
}
print '</table>';
print '</form>';
}
print '<br>';
llxFooter();
$db->close();
/**
* Show fields in insert/edit mode
*
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $form, $mysoc;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'nature')
{
print '<td>';
print $form->selectarray('nature', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth100" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
}
else
{
print '<td>';
$size=''; $class='';
if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='label') $class='quatrevingtpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}
}

View File

@ -47,6 +47,7 @@ class AccountancyExport
public static $EXPORT_TYPE_QUADRATUS = 6;
public static $EXPORT_TYPE_EBP = 7;
public static $EXPORT_TYPE_COGILOG = 8;
public static $EXPORT_TYPE_AGIRIS = 9;
/**
*
@ -96,6 +97,7 @@ class AccountancyExport
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris')
);
}
@ -145,6 +147,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_COGILOG :
$this->exportCogilog($TData);
break;
case self::$EXPORT_TYPE_AGIRIS :
$this->exportAgiris($TData);
break;
default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break;
@ -382,7 +387,7 @@ class AccountancyExport
/**
* Export format : Normal
* Export format : EBP
*
* @param array $objectLines data
*
@ -412,6 +417,47 @@ class AccountancyExport
}
/**
* Export format : Agiris
*
* @param array $objectLines data
*
* @return void
*/
public function exportAgiris($objectLines) {
$this->separator = ';';
foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
print $date . $this->separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
if (empty($line->code_tiers)) {
print length_accountg($line->numero_compte) . $this->separator;
} else {
if (substr($line->numero_compte, 0, 1) == 'C' || substr($line->numero_compte, 0, 1) == '9') {
print '411' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator;
}
if (substr($line->numero_compte, 0, 1) == 'F' || substr($line->numero_compte, 0, 1) == '0') {
print '401' . substr(str_replace(" ", "", $line->code_tiers), 0, 5) . $this->separator;
}
}
print length_accounta($line->code_tiers) . $this->separator;
print price($line->debit) . $this->separator;
print price($line->credit) . $this->separator;
print price($line->montant).$this->separator;
print $line->sens.$this->separator;
print $line->code_journal . $this->separator;
print $this->end_line;
}
}
/**
*

View File

@ -364,28 +364,63 @@ class AccountingAccount extends CommonObject
/**
* Return clicable name (with picto eventually)
*
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @return string Chaine avec URL
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
* @param int $withlabel 0=No label, 1=Include label of account
* @param int $nourl 1=Disable url
* @param string $moretitle Add more text to title tooltip
* @param int $notooltip 1=Disable tooltip
* @return string String with URL
*/
function getNomUrl($withpicto = 0) {
global $langs;
function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0)
{
global $langs, $conf, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result = '';
$link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id . '">';
$linkend = '</a>';
$url = DOL_URL_ROOT . '/accountancy/admin/card.php?id=' . $this->id;
$picto = 'billr';
$label='';
$label = $langs->trans("Show") . ': ' . $this->account_number . ' - ' . $this->label;
$label = '<u>' . $langs->trans("ShowAccountingAccount") . '</u>';
if (! empty($this->account_number))
$label .= '<br><b>'.$langs->trans('AccountAccounting') . ':</b> ' . length_accountg($this->account_number);
if (! empty($this->label))
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
if ($moretitle) $label.=' - '.$moretitle;
if ($withpicto)
$result .= ($link . img_object($label, $picto) . $linkend);
if ($withpicto && $withpicto != 2)
$result .= ' ';
if ($withpicto != 2)
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
$result .= $link . length_accountg($this->account_number) . ' - ' . $this->label . $linkend;
$linkclose='';
if (empty($notooltip))
{
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
{
$label=$langs->trans("ShowAccoutingAccount");
$linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"';
}
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart='<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
if ($nourl)
{
$linkstart = '';
$linkclose = '';
$linkend = '';
}
$label_link = length_accountg($this->account_number);
if ($withlabel) $label_link .= ' - ' . $this->label;
if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend);
if ($withpicto && $withpicto != 2) $result .= ' ';
if ($withpicto != 2) $result.=$linkstart . $label_link . $linkend;
return $result;
}

View File

@ -82,208 +82,6 @@ class AccountingJournal extends CommonObject
}
}
/**
* Insert journal in database
*
* @param User $user Use making action
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function create($user, $notrigger = 0)
{
global $conf;
$error = 0;
$now = dol_now();
// Clean parameters
if (isset($this->code))
$this->code = trim($this->code);
if (isset($this->label))
$this->label = trim($this->label);
// Check parameters
if (empty($this->nature) || $this->nature == '-1')
{
$this->nature = '0';
}
// Insert request
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_journal(";
$sql .= "code";
$sql .= ", label";
$sql .= ", nature";
$sql .= ", active";
$sql .= ") VALUES (";
$sql .= " " . (empty($this->code) ? 'NULL' : "'" . $this->db->escape($this->code) . "'");
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->nature) ? '0' : "'" . $this->db->escape($this->nature) . "'");
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql .= ")";
$this->db->begin();
dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
if (! $error) {
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "accounting_journal");
// if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers
// }
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
dol_syslog(get_class($this) . "::create " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return $this->id;
}
}
/**
* Update record
*
* @param User $user Use making update
* @return int <0 if KO, >0 if OK
*/
function update($user)
{
// Check parameters
if (empty($this->nature) || $this->nature == '-1')
{
$this->nature = '0';
}
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
$sql .= " SET code = " . ($this->code ? "'" . $this->db->escape($this->code) . "'" : "null");
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
$sql .= " , nature = " . ($this->nature ? "'" . $this->db->escape($this->nature) . "'" : "0");
$sql .= " , active = '" . $this->active . "'";
$sql .= " WHERE rowid = " . $this->id;
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
}
}
/**
* Check usage of accounting journal
*
* @return int <0 if KO, >0 if OK
*/
function checkUsage() {
global $langs;
$sql = "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facturedet";
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
$sql .= "UNION";
$sql .= "(SELECT fk_code_ventilation FROM " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " WHERE fk_code_ventilation=" . $this->id . ")";
dol_syslog(get_class($this) . "::checkUsage sql=" . $sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$num = $this->db->num_rows($resql);
if ($num > 0) {
$this->error = $langs->trans('ErrorAccountingJournalIsAlreadyUse');
return 0;
} else {
return 1;
}
} else {
$this->error = $this->db->lasterror();
return - 1;
}
}
/**
* Delete object in database
*
* @param User $user User that deletes
* @param int $notrigger 0=triggers after, 1=disable triggers
* @return int <0 if KO, >0 if OK
*/
function delete($user, $notrigger = 0) {
$error = 0;
$result = $this->checkUsage();
if ($result > 0) {
$this->db->begin();
// if (! $error) {
// if (! $notrigger) {
// Uncomment this and change MYOBJECT to your own tag if you
// want this action calls a trigger.
// // Call triggers
// include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
// $interface=new Interfaces($this->db);
// $result=$interface->run_triggers('ACCOUNTANCY_ACCOUNT_DELETE',$this,$user,$langs,$conf);
// if ($result < 0) { $error++; $this->errors=$interface->errors; }
// // End call triggers
// }
// }
if (! $error) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "accounting_journal";
$sql .= " WHERE rowid=" . $this->id;
dol_syslog(get_class($this) . "::delete sql=" . $sql);
$resql = $this->db->query($sql);
if (! $resql) {
$error ++;
$this->errors[] = "Error " . $this->db->lasterror();
}
}
// Commit or rollback
if ($error) {
foreach ( $this->errors as $errmsg ) {
dol_syslog(get_class($this) . "::delete " . $errmsg, LOG_ERR);
$this->error .= ($this->error ? ', ' . $errmsg : $errmsg);
}
$this->db->rollback();
return - 1 * $error;
} else {
$this->db->commit();
return 1;
}
} else {
return - 1;
}
}
/**
* Return clicable name (with picto eventually)
*
@ -311,64 +109,6 @@ class AccountingJournal extends CommonObject
return $result;
}
/**
* Deactivate journal
*
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function journal_deactivate($id) {
$result = $this->checkUsage();
if ($result > 0) {
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
$sql .= "SET active = '0'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
dol_syslog(get_class($this) . "::deactivate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
}
} else {
return - 1;
}
}
/**
* Activate journal
*
* @param int $id Id
* @return int <0 if KO, >0 if OK
*/
function journal_activate($id) {
$this->db->begin();
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_journal ";
$sql .= "SET active = '1'";
$sql .= " WHERE rowid = " . $this->db->escape($id);
dol_syslog(get_class($this) . "::activate sql=" . $sql, LOG_DEBUG);
$result = $this->db->query($sql);
if ($result) {
$this->db->commit();
return 1;
} else {
$this->error = $this->db->lasterror();
$this->db->rollback();
return - 1;
}
}
/**
* Retourne le libelle du statut d'un user (actif, inactif)
*

View File

@ -71,6 +71,10 @@ print "<br>\n";
// STEPS
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("AccountingJournals").'</strong>');
print "<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("Pcg_version").'</strong>');
print "<br>\n";
print "<br>\n";
@ -148,24 +152,26 @@ print '<hr>';
print "<br>\n";
$step = 0;
$langs->loadLangs(array('bills', 'trips'));
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescCustomer", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."<br>\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsCustomers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("CustomersVentilation").'</strong>')."<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSupplier", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("BillsSuppliers"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong>')."<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."<br>\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64+$step), $langs->transnoentitiesnoconv("ExpenseReports"), '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")."-".$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong>')."<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", $step)."<br>\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64+$step), $langs->transnoentitiesnoconv("Journalization"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."<br>\n";
print "<br>\n";
$step++;
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", $step)."<br>\n";
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64+$step))."<br>\n";
print "<br>\n";
llxFooter();

View File

@ -695,7 +695,6 @@ if ($action == 'export_csv') {
*/
/*
* View
*/
@ -749,7 +748,7 @@ if (empty($action) || $action == 'view') {
/*
* Show result array
*/
print '<br><br>';
print '<br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";

View File

@ -477,7 +477,7 @@ if (empty($action) || $action == 'view') {
/*
* Show result array
*/
print '<br><br>';
print '<br>';
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";

View File

@ -500,6 +500,7 @@ $form = new Form($db);
}
*/
if (empty($action) || $action == 'view') {
llxHeader('', $langs->trans("SellsJournal"));

View File

@ -262,10 +262,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module = new $classname($db, new ActionComm($db));
$module = new $classname($db, new ActionComm($db));
print '<tr class="oddeven">\n';
print '<tr class="oddeven">'."\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";
@ -337,8 +336,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print '</table><br>';
}
$var=true;
print '<form action="'.$_SERVER["PHP_SELF"].'" name="agenda">';
print '<input type="hidden" name="action" value="set">';
@ -379,7 +376,6 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
}
// AGENDA_DEFAULT_FILTER_TYPE
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
@ -388,7 +384,6 @@ $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AG
print '</td></tr>'."\n";
// AGENDA_DEFAULT_FILTER_STATUS
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";
@ -397,7 +392,6 @@ $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_
print '</td></tr>'."\n";
// AGENDA_DEFAULT_VIEW
print '<tr class="oddeven">'."\n";
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
print '<td align="center">&nbsp;</td>'."\n";

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@ -794,7 +794,6 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("CompanyIds").'</td><td>'.$langs->trans("Value").'</td></tr>';
$var=true;
// Managing Director(s)

View File

@ -37,7 +37,7 @@ if (!$user->admin) accessforbidden();
$id=GETPOST('rowid','int');
$action=GETPOST('action','alpha');
$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder'
$mode = GETPOST('mode')?GETPOST('mode'):'createform'; // 'createform', 'filters', 'sortorder', 'focus'
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
@ -210,6 +210,10 @@ if ($mode == 'sortorder')
{
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
}
if ($mode == 'focus')
{
print info_admin($langs->trans("FeatureNotYetAvailable")).'<br>';
}
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" id="action" name="action" value="">';
@ -217,11 +221,13 @@ print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($m
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
// Page
$texthelp=$langs->trans("PageUrlForDefaultValues");
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php');
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
// Field
$texthelp=$langs->trans("TheKeyIsTheNameOfHtmlField");
if ($mode != 'sortorder')
{
@ -233,26 +239,32 @@ else
$textkey=$form->textwithpicto($langs->trans("Field"), $texthelp);
}
print_liste_field_titre($textkey,$_SERVER["PHP_SELF"],'param','',$param,'',$sortfield,$sortorder);
if ($mode != 'sortorder')
// Value
if ($mode != 'focus')
{
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
// See list into GETPOST
$texthelp.='__USERID__<br>';
$texthelp.='__SUPERVISORID__<br>';
$texthelp.='__MYCOUNTRYID__<br>';
$texthelp.='__DAY__<br>';
$texthelp.='__MONTH__<br>';
$texthelp.='__YEAR__<br>';
if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__<br>';
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, '');
if ($mode != 'sortorder')
{
$texthelp=$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
// See list into GETPOST
$texthelp.='__USERID__<br>';
$texthelp.='__SUPERVISORID__<br>';
$texthelp.='__MYCOUNTRYID__<br>';
$texthelp.='__DAY__<br>';
$texthelp.='__MONTH__<br>';
$texthelp.='__YEAR__<br>';
if (! empty($conf->multicompany->enabled)) $texthelp.='__ENTITYID__<br>';
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, '');
}
else
{
$texthelp='ASC or DESC';
$textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp);
}
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
}
else
{
$texthelp='ASC or DESC';
$textvalue=$form->textwithpicto($langs->trans("SortOrder"), $texthelp);
}
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
// Entity
if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,page','',$param,'',$sortfield,$sortorder);
// Actions
print '<td align="center"></td>';
print "</tr>\n";
@ -261,15 +273,21 @@ print "</tr>\n";
print "\n";
print '<tr class="oddeven">';
// Page
print '<td>';
print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="defaulturl" value="">';
print '</td>'."\n";
// Field
print '<td>';
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">';
print '</td>';
print '<td>';
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
print '</td>';
// Value
if ($mode != 'focus')
{
print '<td>';
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
print '</td>';
}
// Limit to superadmin
if (! empty($conf->multicompany->enabled) && !$user->entity)
{
@ -311,28 +329,33 @@ if ($result)
print '<tr class="oddeven">';
// Page
print '<td>';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->page;
else print '<input type="text" name="urlpage" value="'.dol_escape_htmltag($obj->page).'">';
print '</td>'."\n";
// Key
// Field
print '<td>';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->param;
else print '<input type="text" name="key" value="'.dol_escape_htmltag($obj->param).'">';
print '</td>'."\n";
// Value
print '<td>';
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value;
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
print '</td>';
if ($mode != 'focus')
{
print '<td>';
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
print '<input type="hidden" name="const['.$i.'][lang]" value="'.$obj->lang.'">';
print '<input type="hidden" name="const['.$i.'][name]" value="'.$obj->transkey.'">';
print '<input type="text" id="value_'.$i.'" class="flat inputforupdate" size="30" name="const['.$i.'][value]" value="'.dol_escape_htmltag($obj->transvalue).'">';
*/
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print $obj->value;
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
print '</td>';
}
// Actions
print '<td align="center">';
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
{
@ -349,7 +372,7 @@ if ($result)
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
}
print '</td>';
print "</tr>\n";
print "\n";
$i++;

View File

@ -230,7 +230,7 @@ print load_fiche_titre($langs->trans("ExpenseReportsSetup"),$linkback,'title_set
$head=expensereport_admin_prepare_head();
dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), 0, 'trip');
dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), -1, 'trip');
// Interventions numbering model
/*

View File

@ -74,7 +74,7 @@ print load_fiche_titre($langs->trans("ExpenseReportsSetup"),$linkback,'title_set
$head = expensereport_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), 0, 'trip');
dol_fiche_head($head, 'attributes', $langs->trans("ExpenseReports"), -1, 'trip');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -265,7 +265,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu
$head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), 0, 'intervention');
dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), -1, 'intervention');
// Interventions numbering model
@ -291,7 +291,6 @@ foreach ($dirmodels as $reldir)
$handle = opendir($dir);
if (is_resource($handle))
{
$var=true;
while (($file = readdir($handle))!==false)
{

View File

@ -50,18 +50,6 @@ $action = GETPOST('action');
if (! defined("MAIN_MOTD")) define("MAIN_MOTD","");
// List of supported permanent search area
$searchform=array();
/* deprecated
if (empty($conf->use_javascript_ajax))
{
$searchform=array("MAIN_SEARCHFORM_SOCIETE", "MAIN_SEARCHFORM_CONTACT", "MAIN_SEARCHFORM_PRODUITSERVICE", "MAIN_SEARCHFORM_ADHERENT", "MAIN_SEARCHFORM_PROJECT", "MAIN_SEARCHFORM_EMPLOYEE");
$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE,$conf->global->MAIN_SEARCHFORM_ADHERENT,$conf->global->MAIN_SEARCHFORM_PROJECT,$conf->global->MAIN_SEARCHFORM_EMPLOYEE);
$searchformtitle=array($langs->trans("Companies"), $langs->trans("Contacts"), $langs->trans("ProductsAndServices"), $langs->trans("Members"), $langs->trans("Projects"), $langs->trans("Users"));
$searchformmodule=array('Module1Name','Module1Name','Module50Name','Module310Name','Module400Name');
}
*/
/*
* Action
@ -275,21 +263,6 @@ if ($action == 'edit') // Edit
show_theme(null,1);
print '<br>';
// List of permanent supported search box
if (! empty($searchform))
{
print '<table summary="search" class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("PermanentLeftSearchForm").'</td><td colspan="2">'.$langs->trans("Activated").'</td></tr>';
foreach ($searchform as $key => $value)
{
print '<tr><td class="titlefield">'.$searchformtitle[$key].'</td><td colspan="2">';
print $form->selectyesno($searchform[$key],$searchformconst[$key],1);
print '</td></tr>';
}
print '</table>';
print '<br>';
}
// Other
print '<table summary="edit" class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td>'.$langs->trans("Value").'</td>';
@ -476,23 +449,6 @@ else // Show
print '<br>';
// List of search forms to show
if (! empty($searchform))
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("PermanentLeftSearchForm").'</td><td>'.$langs->trans("Activated").'</td><td>&nbsp;</td></tr>';
foreach ($searchform as $key => $value)
{
print '<tr class="oddeven"><td class="titlefield">'.$searchformtitle[$key].'</td><td>'.yn($searchformconst[$key]).'</td>';
print '<td align="left">';
if (! empty($searchformmodule[$key])) print $langs->trans("IfModuleEnabled",$langs->transnoentitiesnoconv($searchformmodule[$key]));
print '</td></tr>';
}
print '</table>';
print '<br>';
}
// Other
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="titlefield">'.$langs->trans("Parameters").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>';

View File

@ -1,152 +0,0 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file admin/inventory.php
* \ingroup inventory
* \brief This file is an example module setup page
* Put some comments here
*/
// Dolibarr environment
require '../main.inc.php';
// Libraries
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT .'/inventory/lib/inventory.lib.php';
// Translations
$langs->load("stock");
$langs->load("inventory");
// Access control
if (! $user->admin) {
accessforbidden();
}
// Parameters
$action = GETPOST('action', 'alpha');
/*
* Actions
*/
if (preg_match('/set_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_set_const($db, $code, GETPOST($code), 'chaine', 0, '', $conf->entity) > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, 0) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
$page_name = "inventorySetup";
llxHeader('', $langs->trans($page_name));
// Subheader
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
. $langs->trans("BackToModuleList") . '</a>';
print_fiche_titre($langs->trans($page_name), $linkback);
// Configuration header
$head = inventoryAdminPrepareHead();
dol_fiche_head(
$head,
'settings',
$langs->trans("Module104420Name"),
0,
"inventory@inventory"
);
// Setup page goes here
$form=new Form($db);
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_DISABLE_VIRTUAL">';
print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_USE_MIN_PA_IF_NO_LAST_PA">';
print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT">';
print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
print '</table>';
llxFooter();
$db->close();

View File

@ -96,9 +96,7 @@ print "</tr>\n";
foreach ($list as $key)
{
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);

View File

@ -4,7 +4,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
@ -659,11 +659,10 @@ if ($resql)
// Lines with values
while ($i < $num)
{
$var = ! $var;
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{
$tmpaction='edit';
@ -697,7 +696,7 @@ if ($resql)
// Show value for field
if ($showfield) {
print '</tr><tr '.$bc[$var].' nohover tr-'.$tmpfieldlist.'-'.$rowid.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;
@ -789,7 +788,7 @@ if ($resql)
// Show value for field
if ($showfield) {
print '</tr><tr '.$bc[$var].' nohover tr-'.$tmpfieldlist.'-'.$i.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$i.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;

View File

@ -428,8 +428,6 @@ $h++;
print "<br>\n";
$var=true;
if ($mode == 'common')
{
@ -782,7 +780,7 @@ if ($mode == 'marketplace')
print '</tr>';
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
$url='https://www.dolistore.com';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
@ -790,7 +788,7 @@ if ($mode == 'marketplace')
print '</tr>';
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
$url='https://partners.dolibarr.org';
print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a></td>';
print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';

View File

@ -93,7 +93,6 @@ print $langs->trans("ListOfSupportedOauthProviders").'<br><br>';
print '<table class="noborder" width="100%">';
$var = true;
$i=0;
foreach ($list as $key)
@ -116,31 +115,27 @@ foreach ($list as $key)
if ($supported)
{
$redirect_uri=$urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$key[0]].'_oauthcallback.php';
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td><input style="width: 80%" type"text" name="uri'.$key[0].'" value="'.$redirect_uri.'">';
print '</td></tr>';
}
else
{
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
print '</td></tr>';
}
// Api Id
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
print '<td><label for="'.$key[1].'">'.$langs->trans($key[1]).'</label></td>';
print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.$conf->global->{$key[1]}.'">';
print '</td></tr>';
// Api Secret
$var = !$var;
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
print '<td><label for="'.$key[2].'">'.$langs->trans($key[2]).'</label></td>';
print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.$conf->global->{$key[2]}.'">';
print '</td></tr>';

View File

@ -306,8 +306,9 @@ else // Show
$var=true;
// Misc options
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','').'<br>';
$var=true;
print load_fiche_titre($langs->trans("DictionaryPaperFormat"),'','');
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
@ -357,7 +358,7 @@ else // Show
print '<br>';
print load_fiche_titre($langs->trans("PDFAddressForging"),'','').'<br>';
print load_fiche_titre($langs->trans("PDFAddressForging"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px">'.$langs->trans("Value").'</td></tr>';
@ -444,7 +445,7 @@ else // Show
print '<br>';
// Other
print load_fiche_titre($langs->trans("Other"),'','').'<br>';
print load_fiche_titre($langs->trans("Other"),'','');
$var=true;
print '<table summary="more" class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td width="200px" colspan="2">'.$langs->trans("Value").'</td></tr>';

View File

@ -140,7 +140,6 @@ if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$var = True;
$oldmod = "";
while ($i < $num)
@ -187,8 +186,7 @@ if ($result)
}
print '<tr '. $bc[$var].'>';
print '<tr class="oddeven">';
print '<td>'.img_object('',$picto).' '.$objMod->getName();
print '<a name="'.$objMod->getName().'">&nbsp;</a>';

View File

@ -99,7 +99,7 @@ foreach ($list as $key)
{
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);

View File

@ -432,6 +432,61 @@ if ($virtualdiffersfromphysical)
}
print '<br />';
if ($conf->global->MAIN_LEVEL_FEATURES >= 2)
{
$var=false;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Inventory").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">&nbsp;</td>'."\n";
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_DISABLE_VIRTUAL").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_DISABLE_VIRTUAL">';
print $form->selectyesno("INVENTORY_DISABLE_VIRTUAL",$conf->global->INVENTORY_DISABLE_VIRTUAL,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_USE_MIN_PA_IF_NO_LAST_PA">';
print $form->selectyesno("INVENTORY_USE_MIN_PA_IF_NO_LAST_PA",$conf->global->INVENTORY_USE_MIN_PA_IF_NO_LAST_PA,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
// Example with a yes / no select
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT").'</td>';
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT">';
print $form->selectyesno("INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT",$conf->global->INVENTORY_USE_INVENTORY_DATE_FROM_DATEMVT,1);
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>';
print '</td></tr>';
print '</table>';
}
$var=true;
print '<table class="noborder" width="100%">';
@ -508,6 +563,7 @@ if ($conf->global->PRODUIT_SOUSPRODUITS)
print '</table>';
llxFooter();
$db->close();

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@ -205,7 +205,7 @@ print "<br>";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), -1, 'company');
// Supplier invoice numbering module
@ -361,7 +361,6 @@ foreach ($dirmodels as $reldir)
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
@ -379,7 +378,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db, new FactureFournisseur($db));
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011-2017 Philippe Grand <philippe.grand@atoo-net.com>
*
* 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
@ -234,7 +234,7 @@ print "<br>";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'order', $langs->trans("Suppliers"), -1, 'company');
// Supplier order numbering module
@ -382,7 +382,6 @@ print '</tr>'."\n";
clearstatcache();
$var=true;
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_order/pdf/");
@ -403,7 +402,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db, new CommandeFournisseur($db));
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";

View File

@ -65,7 +65,7 @@ if ($action == 'updateMask')
}
}else if ($action == 'setmod')
{
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON",$value,'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity);
}
// define constants for models generator that need parameters
@ -138,7 +138,7 @@ else if ($action == 'specimen')
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/supplier_payment/pdf/pdf_".$modele.".modules.php",0);
$file=dol_buildpath($reldir."core/modules/supplier_payment/doc/pdf_".$modele.".modules.php",0);
if (file_exists($file))
{
$filefound=1;
@ -188,7 +188,7 @@ print load_fiche_titre($langs->trans("SupplierPaymentSetup"),$linkback,'title_se
print "<br>";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'supplierpayment', $langs->trans("Suppliers"), -1, 'company');
/*
* Numbering module
@ -198,12 +198,6 @@ if (empty($conf->global->SUPPLIER_PAYMENT_ADDON)) $conf->global->SUPPLIER_PAYMEN
print load_fiche_titre($langs->trans("PaymentsNumberingModule"), '', '');
/*
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
// Load array def with activated templates
$def = array();
$sql = "SELECT nom";
@ -349,6 +343,12 @@ foreach ($dirmodels as $reldir)
print '</table>';
/*
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("PaymentsPDFModules"),'','');
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n";
print '<td width="100">'.$langs->trans("Name").'</td>'."\n";
@ -363,11 +363,10 @@ clearstatcache();
foreach ($dirmodels as $reldir)
{
$dir = dol_buildpath($reldir."core/modules/supplier_payment/pdf/");
$dir = dol_buildpath($reldir."core/modules/supplier_payment/doc/");
if (is_dir($dir))
{
$var=true;
$handle=opendir($dir);
@ -385,7 +384,7 @@ foreach ($dirmodels as $reldir)
$module = new $classname($db, new PaiementFourn($db));
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
print "<td>";
print (empty($module->name)?$name:$module->name);
print "</td>\n";
@ -441,8 +440,6 @@ foreach ($dirmodels as $reldir)
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,1,0);
print '</td>';
@ -459,7 +456,7 @@ foreach ($dirmodels as $reldir)
}
}
print '</table><br>';
print '</table>';
dol_fiche_end();

View File

@ -79,7 +79,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'supplierinvoice', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -79,7 +79,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'supplierinvoicedet', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -75,7 +75,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'supplierorder', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -76,7 +76,7 @@ print "<br>\n";
$head = supplierorder_admin_prepare_head();
dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), 0, 'company');
dol_fiche_head($head, 'supplierorderdet', $langs->trans("Suppliers"), -1, 'company');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -197,7 +197,6 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Value").'</td>';
print '<td align="right" colspan="2"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
print "</tr>\n";
$var=true;
foreach ($syslogModules as $moduleName)
{
@ -210,7 +209,7 @@ foreach ($syslogModules as $moduleName)
print '<tr class="oddeven">';
print '<td width="140">';
print '<input '.$bc[$var].' type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
print '<input class="oddeven" type="checkbox" name="SYSLOG_HANDLERS[]" value="'.$moduleName.'" '.(in_array($moduleName, $activeModules) ? 'checked' : '').($moduleactive <= 0 ? 'disabled' : '').'> ';
print $module->getName();
print '</td>';

View File

@ -136,10 +136,10 @@ else
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<tr class="oddeven"><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print "</table>\n";
@ -152,7 +152,7 @@ else
print '<tr class="liste_titre"><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
// Products
print '<tr '.$bc[false].'><td>'.$langs->trans("Product").'</td>';
print '<tr class="oddeven"><td>'.$langs->trans("Product").'</td>';
print '<td>';
print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
@ -163,7 +163,7 @@ else
print '</td></tr>';
// Services
print '<tr '.$bc[true].'><td>'.$langs->trans("Services").'</td>';
print '<tr class="oddeven"><td>'.$langs->trans("Services").'</td>';
print '<td>';
if ($tax_mode == 0)
{
@ -206,7 +206,7 @@ foreach ($list as $key)
{
print '<tr '.$bc[$var].' class="value">';
print '<tr class="oddeven value">';
// Param
$label = $langs->trans($key);

View File

@ -441,7 +441,6 @@ if ($id)
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;
if ($num)
{
print '<br>';
@ -499,7 +498,6 @@ if ($id)
// Lines with values
while ($i < $num)
{
$var = ! $var;
$obj = $db->fetch_object($resql);
//print_r($obj);

View File

@ -120,8 +120,7 @@ foreach($workflowcodes as $key => $params)
$oldfamily = $family;
}
$var = !$var;
print "<tr ".$bc[$var].">\n";
print "<tr class=\"oddeven\">\n";
print "<td>".img_object('', $picto).$langs->trans('desc'.$key);
if (! empty($params['warning']))
{

View File

@ -62,7 +62,7 @@ function printBookmarksList($aDb, $aLangs)
*/
$ret.= '<div class="menu_top"></div>'."\n";
$ret.= '<form id="actionbookmark" name="actionbookmark" method="POST" action="">';
$ret.= '<!-- form with GET method --><form id="actionbookmark" name="actionbookmark" method="GET" action="">';
$ret.= '<select name="bookmark" id="boxbookmark" class="flat boxcombo vmenusearchselectcombo">';
$ret.= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
$ret.= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_js(DOL_URL_ROOT.'/bookmarks/list.php').'">'.dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';

View File

@ -125,7 +125,7 @@ if ($catname || $id > 0)
print '</span>';
print "</td>\n";
print "\t\t<td>";
print $cat->description;
print dolGetFirstLineOfText($cat->description);
print "</td>\n";
print "\t</tr>\n";
}
@ -162,7 +162,7 @@ foreach($fulltree as $key => $val)
'rowid'=>$val['rowid'],
'fk_menu'=>$val['fk_parent'],
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
'</tr></table>'
);
@ -181,13 +181,13 @@ $nbofentries=(count($data) - 1);
if ($nbofentries > 0)
{
print '<tr '.$bc[0].'><td colspan="3">';
print '<tr class="pair"><td colspan="3">';
tree_recur($data,$data[0],0);
print '</td></tr>';
}
else
{
print '<tr '.$bc[0].'>';
print '<tr class="pair">';
print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.img_picto_common('','treemenu/branchbottom.gif').'</td>';
print '<td valign="middle">';
print $langs->trans("NoCategoryYet");

View File

@ -337,7 +337,7 @@ if ($action == 'add')
unset($_SESSION['assignedtouser']);
$moreparam='';
if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
if ($user->id != $object->userownerid) $moreparam="filtert=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit();
if (! empty($backtopage))
@ -706,7 +706,7 @@ if ($action == 'create')
if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) $percent='0';
else if (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent=100;
}
$formactions->form_select_status_action('formaction',$percent,1,'complete');
$formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200');
print '</td></tr>';
// Location
@ -1428,7 +1428,7 @@ if ($id > 0)
} else {
$value = $object->array_options["options_" . $key];
}
print '<tr><td width="30%">'.$label.'</td><td>';
print '<tr><td class="titlefield">'.$label.'</td><td>';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";
}
@ -1491,7 +1491,7 @@ if ($id > 0)
{
if (empty($conf->global->AGENDA_DISABLE_BUILDDOC))
{
print '<div style="clear:both;">&nbsp;<br><br></div><div class="fichecenter"><div class="fichehalfleft">';
print '<div style="clear:both;"></div><div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
/*
@ -1512,8 +1512,6 @@ if ($id > 0)
print '</div></div></div>';
print '<div style="clear:both;">&nbsp;</div>';
}
}
}

View File

@ -43,8 +43,8 @@ if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MA
if (empty($conf->global->AGENDA_EXT_NB)) $conf->global->AGENDA_EXT_NB=5;
$MAXAGENDA=$conf->global->AGENDA_EXT_NB;
$filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filter = GETPOST("filter",'',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -1155,21 +1155,6 @@ else // View by day
echo '</table>';
}
/* TODO Export
print '
<a href="" id="actionagenda_ical_link"><img src="'.DOL_URL_ROOT.'/theme/common/ical.gif" border="0"/></a>
<a href="" id="actionagenda_vcal_link"><img src="'.DOL_URL_ROOT.'/theme/common/vcal.gif" border="0"/></a>
<a href="" id="actionagenda_rss_link"><img src="'.DOL_URL_ROOT.'/theme/common/rss.gif" border="0"/></a>
<script>
$("#actionagenda_rss_link").attr("href","/public/agenda/agendaexport.php?format=rss&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
$("#actionagenda_ical_link").attr("href","/public/agenda/agendaexport.php?format=ical&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
$("#actionagenda_vcal_link").attr("href","/public/agenda/agendaexport.php?format=vcal&type=ActionAgenda&exportkey=dolibarr&token="+getToken()+"&status="+getStatus()+"&userasked="+getUserasked()+"&usertodo="+getUsertodo()+"&userdone="+getUserdone()+"&year="+getYear()+"&month="+getMonth()+"&day="+getDay()+"&showbirthday="+getShowbirthday()+"&action="+getAction()+"&projectid="+getProjectid()+"");
</script>
';
*/
llxFooter();
$db->close();

View File

@ -64,8 +64,8 @@ $dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GET
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
if (empty($action) && ! isset($_GET['action']) && ! isset($_POST['action'])) $action=(empty($conf->global->AGENDA_DEFAULT_VIEW)?'show_month':$conf->global->AGENDA_DEFAULT_VIEW);
$filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filter = GETPOST("filter",'',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;

View File

@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filter = GETPOST("filter",'',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -250,7 +250,7 @@ $picto='calendarweek';
$nav.=' &nbsp; <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
$nav.='<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$nav.='<input type="hidden" name="action" value="' . $action . '">';
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
@ -714,7 +714,7 @@ jQuery(document).ready(function() {
else if (ids.indexOf(",") > -1) /* There is several events */
{
/* alert(\'several events\'); */
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
window.location.href = url;
}
else /* One event */

View File

@ -38,8 +38,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/core/class
if (! isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW=3;
$filter=GETPOST("filter",'',3);
$filtert = GETPOST("usertodo","int",3)?GETPOST("usertodo","int",3):GETPOST("filtert","int",3);
$filter = GETPOST("filter",'',3);
$filtert = GETPOST("filtert","int",3);
$usergroup = GETPOST("usergroup","int",3);
//if (! ($usergroup > 0) && ! ($filtert > 0)) $filtert = $user->id;
//$showbirthday = empty($conf->use_javascript_ajax)?GETPOST("showbirthday","int"):1;
@ -252,7 +252,7 @@ $picto='calendarweek';
$nav.=' &nbsp; <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
$nav.='<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
$nav.='<input type="hidden" name="action" value="' . $action . '">';
$nav.='<input type="hidden" name="usertodo" value="' . $filtert . '">';
$nav.='<input type="hidden" name="filtert" value="' . $filtert . '">';
$nav.='<input type="hidden" name="usergroup" value="' . $usergroup . '">';
$nav.='<input type="hidden" name="actioncode" value="' . $actioncode . '">';
$nav.='<input type="hidden" name="resourceid" value="' . $resourceid . '">';
@ -663,7 +663,6 @@ else
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
$sql.= " WHERE u.statut = 1 AND u.entity IN (".getEntity('user',1).")";
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
//if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//print $sql;
$resql=$db->query($sql);
if ($resql)
@ -816,7 +815,7 @@ jQuery(document).ready(function() {
else if (ids.indexOf(",") > -1) /* There is several events */
{
/* alert(\'several events\'); */
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?filtert="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
window.location.href = url;
}
else /* One event */

View File

@ -161,6 +161,7 @@ if ($_POST["button_removefilter"])
$search_lastname='';
$search_firstname='';
$search_email='';
$search_dest_status='';
}
@ -399,7 +400,7 @@ if ($object->fetch($id) >= 0)
if ($search_lastname) $sql.= " AND mc.lastname LIKE '%".$db->escape($search_lastname)."%'";
if ($search_firstname) $sql.= " AND mc.firstname LIKE '%".$db->escape($search_firstname)."%'";
if ($search_email) $sql.= " AND mc.email LIKE '%".$db->escape($search_email)."%'";
if (!empty($search_dest_status)) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
if ($search_dest_status != '' && $search_dest_status >= -1) $sql.= " AND mc.statut=".$db->escape($search_dest_status)." ";
$sql .= $db->order($sortfield,$sortorder);
// Count total nb of records
@ -411,7 +412,7 @@ if ($object->fetch($id) >= 0)
}
//$nbtotalofrecords=$object->nbemail; // nbemail is a denormalized field storing nb of targets
$sql .= $db->plimit($limit+1, $offset);
$resql=$db->query($sql);
if ($resql)
{
@ -446,29 +447,12 @@ if ($object->fetch($id) >= 0)
print '<input type="hidden" name="limit" value="'.$limit.'">';
if ($page) $param.= "&amp;page=".$page;
if ($page) $param.= "&amp;page=".$page;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
// Ligne des champs de filtres
print '<tr class="liste_titre">';
print '<tr class="liste_titre_filter">';
// EMail
print '<td class="liste_titre">';
print '<input class="flat maxwidth100" type="text" name="search_email" value="'.dol_escape_htmltag($search_email).'">';
@ -489,7 +473,7 @@ if ($object->fetch($id) >= 0)
print '<td class="liste_titre">';
print '&nbsp';
print '</td>';
// Date sending
print '<td class="liste_titre">';
print '&nbsp';
@ -504,6 +488,25 @@ if ($object->fetch($id) >= 0)
print $searchpitco;
print '</td>';
print '</tr>';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"mc.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"mc.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"mc.firstname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OtherInformations"),$_SERVER["PHP_SELF"],"",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Source"),$_SERVER["PHP_SELF"],"",$param,"",'align="center"',$sortfield,$sortorder);
// Date sending
if ($object->statut < 2)
{
print_liste_field_titre('');
}
else
{
print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print '</tr>';
$i = 0;

View File

@ -80,8 +80,8 @@ class Mailing extends CommonObject
$this->statuts[2] = 'MailingStatusSentPartialy';
$this->statuts[3] = 'MailingStatusSentCompletely';
$this->statut_dest[0] = 'MailingStatusNotSent';
$this->statut_dest[-1] = 'MailingStatusError';
$this->statut_dest[0] = 'MailingStatusNotSent';
$this->statut_dest[1] = 'MailingStatusSent';
$this->statut_dest[2] = 'MailingStatusRead';
$this->statut_dest[3] = 'MailingStatusReadAndUnsubscribe'; // Read but ask to not be contacted anymore

View File

@ -497,7 +497,10 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, 'HT', 0, $lines[$i]->info_bits, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $date_start, $date_end, $array_options, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;

View File

@ -16,9 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
use Luracast\Restler\RestException;
use Luracast\Restler\RestException;
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
/**
* API class for orders
@ -275,9 +276,9 @@ class Proposals extends DolibarrApi
$request_data->array_options,
$request_data->fk_unit,
$this->element,
$request_data->id
// not used anymore ?
// $request_data->fk_remise_except
$request_data->id,
$request_data->pu_ht_devise,
$request_data->fk_remise_except
);
if ($updateRes > 0) {

View File

@ -187,7 +187,7 @@ class Propal extends CommonObject
/**
* Billed or processed quote
*/
const STATUS_BILLED = 4;
const STATUS_BILLED = 4; // Todo rename into STATUS_CLOSE ?
/**
* Constructor
@ -253,6 +253,8 @@ class Propal extends CommonObject
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
if (empty($tva_tx)) $tva_npr=0;
$vat_src_code = ''; // May be defined into tva_tx
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr);
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr);
@ -273,6 +275,7 @@ class Propal extends CommonObject
$line->qty=$qty;
$line->subprice=$price;
$line->remise_percent=$remise_percent;
$line->vat_src_code=$vat_src_code;
$line->tva_tx=$tva_tx;
$line->fk_unit=$prod->fk_unit;
if ($tva_npr) $line->info_bits = 1;
@ -315,6 +318,7 @@ class Propal extends CommonObject
$line->fk_propal=$this->id;
$line->fk_remise_except=$remise->id;
$line->desc=$remise->description; // Description ligne
$line->vat_src_code=$remise->vat_src_code;
$line->tva_tx=$remise->tva_tx;
$line->subprice=-$remise->amount_ht;
$line->fk_product=0; // Id produit predefined
@ -391,15 +395,16 @@ class Propal extends CommonObject
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @param string $origin 'order', ...
* @param int $origin_id Id of origin object
* @return int >0 if OK, <0 if KO
* @param double $pu_ht_devise Unit price in currency
* @param int $fk_remise_except Id discount if line is from a discount
* @return int >0 if OK, <0 if KO
* @see add_product
*/
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0)
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise=0, $fk_remise_except=0)
{
global $mysoc, $conf, $langs;
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type, fk_remise_except=".$fk_remise_except);
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
// Clean parameters
@ -515,6 +520,8 @@ class Propal extends CommonObject
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->fk_product=$fk_product;
$this->line->product_type=$type;
$this->line->fk_remise_except=$fk_remise_except;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
$this->line->rang=$rangtouse;
@ -524,7 +531,6 @@ class Propal extends CommonObject
$this->line->total_localtax1=$total_localtax1;
$this->line->total_localtax2=$total_localtax2;
$this->line->total_ttc=$total_ttc;
$this->line->product_type=$type;
$this->line->special_code=$special_code;
$this->line->fk_parent_line=$fk_parent_line;
$this->line->fk_unit=$fk_unit;
@ -698,7 +704,8 @@ class Propal extends CommonObject
$this->line->label = $label;
$this->line->desc = $desc;
$this->line->qty = $qty;
$this->line->product_type = $type;
$this->line->product_type = $type;
$this->line->vat_src_code = $vat_src_code;
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
@ -708,7 +715,6 @@ class Propal extends CommonObject
$this->line->subprice = $pu_ht;
$this->line->info_bits = $info_bits;
$this->line->vat_src_code = $vat_src_code;
$this->line->total_ht = $total_ht;
$this->line->total_tva = $total_tva;
$this->line->total_localtax1 = $total_localtax1;
@ -1301,7 +1307,7 @@ class Propal extends CommonObject
$this->note = $obj->note_private; // TODO deprecated
$this->note_private = $obj->note_private;
$this->note_public = $obj->note_public;
$this->statut = $obj->fk_statut;
$this->statut = (int) $obj->fk_statut;
$this->statut_libelle = $obj->statut_label;
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated
@ -1366,102 +1372,13 @@ class Propal extends CommonObject
$this->lines = array();
/*
* Lignes propales liees a un produit ou non
* Lines
*/
$sql = "SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,";
$sql.= " d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,";
$sql.= " d.fk_unit,";
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
$sql.= ' d.date_start, d.date_end';
$sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
$sql.= " FROM ".MAIN_DB_PREFIX."propaldet as d";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON d.fk_product = p.rowid";
$sql.= " WHERE d.fk_propal = ".$this->id;
$sql.= " ORDER by d.rang";
$result = $this->db->query($sql);
if ($result)
$result=$this->fetch_lines();
if ($result < 0)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafieldsline=new ExtraFields($this->db);
$line = new PropaleLigne($this->db);
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$line = new PropaleLigne($this->db);
$line->rowid = $objp->rowid; //Deprecated
$line->id = $objp->rowid;
$line->fk_propal = $objp->fk_propal;
$line->fk_parent_line = $objp->fk_parent_line;
$line->product_type = $objp->product_type;
$line->label = $objp->custom_label;
$line->desc = $objp->description; // Description ligne
$line->qty = $objp->qty;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->subprice = $objp->subprice;
$line->fk_remise_except = $objp->fk_remise_except;
$line->remise_percent = $objp->remise_percent;
$line->price = $objp->price; // TODO deprecated
$line->info_bits = $objp->info_bits;
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->special_code = $objp->special_code;
$line->rang = $objp->rang;
$line->fk_product = $objp->fk_product;
$line->ref = $objp->product_ref; // TODO deprecated
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; // TODO deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->fk_product_type = $objp->fk_product_type;
$line->fk_unit = $objp->fk_unit;
$line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end);
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;
$line->multicurrency_code = $objp->multicurrency_code;
$line->multicurrency_subprice = $objp->multicurrency_subprice;
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals($line->id,$extralabelsline);
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
$i++;
}
$this->db->free($result);
return -3;
}
else
{
$this->error=$this->db->lasterror();
return -1;
}
return 1;
}
@ -1475,6 +1392,114 @@ class Propal extends CommonObject
return -1;
}
}
/**
* Load array lines
*
* @param int $only_product Return only physical products
* @return int <0 if KO, >0 if OK
*/
function fetch_lines($only_product=0)
{
$this->lines=array();
$sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,';
$sql.= ' d.info_bits, d.total_ht, d.total_tva, d.total_localtax1, d.total_localtax2, d.total_ttc, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht, d.special_code, d.rang, d.product_type,';
$sql.= ' d.fk_unit,';
$sql.= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label,';
$sql.= ' d.date_start, d.date_end';
$sql.= ' ,d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as d';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (d.fk_product = p.rowid)';
$sql.= ' WHERE d.fk_propal = '.$this->id;
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
$sql.= ' ORDER by d.rang';
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$num = $this->db->num_rows($result);
$i = 0;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$line = new PropaleLigne($this->db);
$line->rowid = $objp->rowid; //Deprecated
$line->id = $objp->rowid;
$line->fk_propal = $objp->fk_propal;
$line->fk_parent_line = $objp->fk_parent_line;
$line->product_type = $objp->product_type;
$line->label = $objp->custom_label;
$line->desc = $objp->description; // Description ligne
$line->qty = $objp->qty;
$line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->subprice = $objp->subprice;
$line->fk_remise_except = $objp->fk_remise_except;
$line->remise_percent = $objp->remise_percent;
$line->price = $objp->price; // TODO deprecated
$line->info_bits = $objp->info_bits;
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
$line->special_code = $objp->special_code;
$line->rang = $objp->rang;
$line->fk_product = $objp->fk_product;
$line->ref = $objp->product_ref; // TODO deprecated
$line->product_ref = $objp->product_ref;
$line->libelle = $objp->product_label; // TODO deprecated
$line->product_label = $objp->product_label;
$line->product_desc = $objp->product_desc; // Description produit
$line->fk_product_type = $objp->fk_product_type;
$line->fk_unit = $objp->fk_unit;
$line->date_start = $this->db->jdate($objp->date_start);
$line->date_end = $this->db->jdate($objp->date_end);
// Multicurrency
$line->fk_multicurrency = $objp->fk_multicurrency;
$line->multicurrency_code = $objp->multicurrency_code;
$line->multicurrency_subprice = $objp->multicurrency_subprice;
$line->multicurrency_total_ht = $objp->multicurrency_total_ht;
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$line->fetch_optionals();
$this->lines[$i] = $line;
//dol_syslog("1 ".$line->fk_product);
//print "xx $i ".$this->lines[$i]->fk_product;
$i++;
}
$this->db->free($result);
return 1;
}
else
{
$this->error=$this->db->lasterror();
return -3;
}
}
/**
* Update value of extrafields on the proposal
@ -3326,8 +3351,10 @@ class Propal extends CommonObject
*/
function getLinesArray()
{
// For other object, here we call fetch_lines. But fetch_lines does not exists on proposal
// TODO Duplicate with fetch_lines ? Wich one to keep ?
$this->lines = array();
$sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,';
$sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code, pt.localtax1_tx, pt.localtax2_tx,';
@ -3591,7 +3618,7 @@ class PropaleLigne extends CommonObjectLine
*/
function fetch($rowid)
{
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.tva_tx,';
$sql = 'SELECT pd.rowid, pd.fk_propal, pd.fk_parent_line, pd.fk_product, pd.label as custom_label, pd.description, pd.price, pd.qty, pd.vat_src_code, pd.tva_tx,';
$sql.= ' pd.remise, pd.remise_percent, pd.fk_remise_except, pd.subprice,';
$sql.= ' pd.info_bits, pd.total_ht, pd.total_tva, pd.total_ttc, pd.fk_product_fournisseur_price as fk_fournprice, pd.buy_price_ht as pa_ht, pd.special_code, pd.rang,';
$sql.= ' pd.fk_unit,';
@ -3617,6 +3644,7 @@ class PropaleLigne extends CommonObjectLine
$this->qty = $objp->qty;
$this->price = $objp->price; // deprecated
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->remise = $objp->remise; // deprecated
$this->remise_percent = $objp->remise_percent;

View File

@ -377,7 +377,10 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit, $object->origin, $lines[$i]->rowid);
if ($result < 0) {
$error++;

View File

@ -1103,6 +1103,7 @@ class Commande extends CommonOrder
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
@ -1466,7 +1467,8 @@ class Commande extends CommonOrder
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
if (empty($tva_tx)) $tva_npr=0;
$vat_src_code = ''; // May be defined into tva_tx
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
@ -1485,6 +1487,7 @@ class Commande extends CommonOrder
$line->qty=$qty;
$line->subprice=$price;
$line->remise_percent=$remise_percent;
$line->vat_src_code=$vat_src_code;
$line->tva_tx=$tva_tx;
$line->localtax1_tx=$localtax1_tx;
$line->localtax2_tx=$localtax2_tx;
@ -1703,6 +1706,7 @@ class Commande extends CommonOrder
$line->fk_commande=$this->id;
$line->fk_remise_except=$remise->id;
$line->desc=$remise->description; // Description ligne
$line->vat_src_code=$remise->vat_src_code;
$line->tva_tx=$remise->tva_tx;
$line->subprice=-$remise->amount_ht;
$line->price=-$remise->amount_ht;
@ -1758,7 +1762,7 @@ class Commande extends CommonOrder
$this->lines=array();
$sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,';
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.fk_remise_except, l.remise_percent, l.subprice, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht, l.rang, l.info_bits, l.special_code,';
$sql.= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,';
$sql.= ' l.fk_unit,';
$sql.= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,';
@ -1795,9 +1799,11 @@ class Commande extends CommonOrder
$line->vat_src_code = $objp->vat_src_code;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->total_ht = $objp->total_ht;
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->total_ht = $objp->total_ht;
$line->total_ttc = $objp->total_ttc;
$line->total_tva = $objp->total_tva;
$line->total_localtax1 = $objp->total_localtax1;
@ -3806,6 +3812,7 @@ class OrderLine extends CommonOrderLine
$this->qty = $objp->qty;
$this->price = $objp->price;
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
$this->localtax2_tx = $objp->localtax2_tx;
@ -4117,6 +4124,7 @@ class OrderLine extends CommonOrderLine
$sql = "UPDATE ".MAIN_DB_PREFIX."commandedet SET";
$sql.= " description='".$this->db->escape($this->desc)."'";
$sql.= " , label=".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null");
$sql.= " , vat_src_code=".(! empty($this->vat_src_code)?"'".$this->db->escape($this->vat_src_code)."'":"''");
$sql.= " , tva_tx=".price2num($this->tva_tx);
$sql.= " , localtax1_tx=".price2num($this->localtax1_tx);
$sql.= " , localtax2_tx=".price2num($this->localtax2_tx);

View File

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
* 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
@ -35,8 +35,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
if (! empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingaccount.class.php';
$langs->load("banks");
$langs->load("bills");
@ -664,7 +664,10 @@ else
print '<tr class="liste_titre_add"><td class="titlefield">'.$langs->trans("AccountancyCode").'</td>';
print '<td>';
if (! empty($conf->accounting->enabled)) {
print length_accountg($object->account_number).'</td></tr>';
$accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch('',$object->account_number);
print $accountingaccount->getNomUrl(0,1,1,'',1);
} else {
print $object->account_number;
}
@ -683,13 +686,11 @@ else
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Categories
@ -703,8 +704,7 @@ else
print '<td>'.dol_htmlentitiesbr($object->comment).'</td></tr>';
print '</table>';
if ($object->type == Account::TYPE_SAVINGS || $object->type == Account::TYPE_CURRENT)
{
print '<br>';

View File

@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
$langs->load("banks");
$langs->load("categories");
$langs->load("accountancy");
$langs->load("compta");
$action=GETPOST('action','alpha');
$massaction=GETPOST('massaction','alpha');
@ -87,6 +88,7 @@ $arrayfields=array(
'b.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'b.number'=>array('label'=>$langs->trans("AccountIdShort"), 'checked'=>1),
'b.account_number'=>array('label'=>$langs->trans("AccountAccounting"), 'checked'=>$conf->accountancy->enabled),
'b.accountancy_journal'=>array('label'=>$langs->trans("AccountancyJournal"), 'checked'=>$conf->accountancy->enabled),
'toreconcile'=>array('label'=>$langs->trans("TransactionsToConciliate"), 'checked'=>1),
'b.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
'b.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
@ -139,7 +141,7 @@ $title=$langs->trans('BankAccounts');
// Load array of financial accounts (opened by default)
$accounts = array();
$sql = "SELECT rowid, label, courant, rappro, account_number, datec as date_creation, tms as date_update";
$sql = "SELECT rowid, label, courant, rappro, account_number, accountancy_journal, datec as date_creation, tms as date_update";
// Add fields from extrafields
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
// Add fields from hooks
@ -286,6 +288,7 @@ print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre_filter">';
// Ref
if (! empty($arrayfields['b.ref']['checked']))
{
@ -306,19 +309,25 @@ if (! empty($arrayfields['accountype']['checked']))
print '<td class="liste_titre">';
print '</td>';
}
// Number
// Bank number
if (! empty($arrayfields['b.number']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat" size="6" type="text" name="search_number" value="'.$search_number.'">';
print '</td>';
}
// Number
// Account number
if (! empty($arrayfields['b.account_number']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
{
print '<td class="liste_titre">';
print '</td>';
}
// Transactions to reconcile
if (! empty($arrayfields['toreconcile']['checked']))
{
@ -394,6 +403,7 @@ if (! empty($arrayfields['b.label']['checked'])) print_liste_field_titr
if (! empty($arrayfields['accountype']['checked'])) print_liste_field_titre($arrayfields['accountype']['label'],$_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.number']['checked'])) print_liste_field_titre($arrayfields['b.number']['label'],$_SERVER["PHP_SELF"],'b.number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.account_number']['checked'])) print_liste_field_titre($arrayfields['b.account_number']['label'],$_SERVER["PHP_SELF"],'b.account_number','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['b.accountancy_journal']['checked'])) print_liste_field_titre($arrayfields['b.accountancy_journal']['label'],$_SERVER["PHP_SELF"],'b.accountancy_journal','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['toreconcile']['checked'])) print_liste_field_titre($arrayfields['toreconcile']['label'],$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -482,6 +492,14 @@ foreach ($accounts as $key=>$type)
if (! $i) $totalarray['nbfield']++;
}
// Accountancy journal
if (! empty($arrayfields['b.accountancy_journal']['checked']))
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
print '<td>'.length_accountg($acc->accountancy_journal).'</td>';
if (! $i) $totalarray['nbfield']++;
}
// Transactions to reconcile
if (! empty($arrayfields['toreconcile']['checked']))
{

View File

@ -1066,7 +1066,7 @@ if (empty($reshook))
{
if ($typeamount == 'amount')
{
$amountdeposit[] = $valuedeposit;
$amountdeposit[0] = $valuedeposit;
}
else
{
@ -1084,9 +1084,11 @@ if (empty($reshook))
}
if ($totalamount != 0) {
$amountdeposit[$lines[$i]->tva] = ($totalamount * $valuedeposit) / 100;
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
$amountdeposit[$tva_tx] = ($totalamount * $valuedeposit) / 100;
} else {
$amountdeposit[] = 0;
$amountdeposit[0] = 0;
}
} else {
setEventMessages($srcobject->error, $srcobject->errors, 'errors');
@ -1211,11 +1213,15 @@ if (empty($reshook))
$array_options = $lines[$i]->array_options;
}
// View third's localtaxes for now
$localtax1_tx = get_localtax($lines[$i]->tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($lines[$i]->tva_tx, 2, $object->thirdparty);
$tva_tx = $lines[$i]->tva_tx;
if (! empty($lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$lines[$i]->vat_src_code.')';
// View third's localtaxes for NOW and do not use value from origin.
// TODO Is this really what we want ? Yes if source if template invoice but what if proposal or order ?
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->situation_percent, $lines[$i]->fk_prev_id, $lines[$i]->fk_unit);
if ($result > 0) {
$lineid = $result;
@ -3623,8 +3629,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr class="liste_titre">';
print '<td>' . $langs->trans('ListOfNextSituationInvoices') . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . $langs->trans('AmountTTC') . '</td>';
print '<td width="18">&nbsp;</td>';
@ -3640,8 +3645,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr ' . $bc[$var] . '>';
print '<td>' . $next_invoice->getNomUrl(1) . '</td>';
print '<td></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right">' . price($next_invoice->total_ht) . '</td>';
print '<td align="right">' . price($next_invoice->total_ttc) . '</td>';
print '<td align="right">' . $next_invoice->getLibStatut(3, $totalpaye) . '</td>';
@ -3652,8 +3656,7 @@ else if ($id > 0 || ! empty($ref))
print '<tr ' . $bc[$var] . '>';
print '<td colspan="2" align="right"></td>';
if (! empty($conf->banque->enabled))
print '<td align="right"></td>';
if (! empty($conf->banque->enabled)) print '<td align="right"></td>';
print '<td align="right"><b>' . price($total_next_ht) . '</b></td>';
print '<td align="right"><b>' . price($total_next_ttc) . '</b></td>';

View File

@ -951,6 +951,7 @@ class Facture extends CommonInvoice
$line->total_ht = $object->lines[$i]->total_ht;
$line->total_tva = $object->lines[$i]->total_tva;
$line->total_ttc = $object->lines[$i]->total_ttc;
$line->vat_src_code = $object->lines[$i]->vat_src_code;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
@ -1550,6 +1551,7 @@ class Facture extends CommonInvoice
$facligne->fk_facture=$this->id;
$facligne->fk_remise_except=$remise->id;
$facligne->desc=$remise->description; // Description ligne
$facligne->vat_src_code=$remise->vat_src_code;
$facligne->tva_tx=$remise->tva_tx;
$facligne->subprice=-$remise->amount_ht;
$facligne->fk_product=0; // Id produit predefini
@ -2398,7 +2400,7 @@ class Facture extends CommonInvoice
* @param string $desc Description of line
* @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity
* @param double $txtva Force Vat rate, -1 for auto
* @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param double $txlocaltax1 Local tax 1 rate (deprecated)
* @param double $txlocaltax2 Local tax 2 rate (deprecated)
* @param int $fk_product Id of predefined product/service
@ -3511,10 +3513,11 @@ class Facture extends CommonInvoice
/**
* Create a withdrawal request for a standing order
* Create a withdrawal request for a standing order.
* Use the remain to pay excluding all existing open direct debit requests.
*
* @param User $fuser User asking standing order
* @param float $amount Amount we request withdraw for
* @param User $fuser User asking the direct debit transfer
* @param float $amount Amount we request direct debit for
* @return int <0 if KO, >0 if OK
*/
function demande_prelevement($fuser, $amount=0)
@ -4225,7 +4228,7 @@ class FactureLigne extends CommonInvoiceLine
*/
function fetch($rowid)
{
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.tva_tx,';
$sql = 'SELECT fd.rowid, fd.fk_facture, fd.fk_parent_line, fd.fk_product, fd.product_type, fd.label as custom_label, fd.description, fd.price, fd.qty, fd.vat_src_code, fd.tva_tx,';
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql.= ' fd.info_bits, fd.special_code, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
@ -4253,6 +4256,7 @@ class FactureLigne extends CommonInvoiceLine
$this->desc = $objp->description;
$this->qty = $objp->qty;
$this->subprice = $objp->subprice;
$this->vat_src_code = $objp->vat_src_code;
$this->tva_tx = $objp->tva_tx;
$this->localtax1_tx = $objp->localtax1_tx;
$this->localtax2_tx = $objp->localtax2_tx;

View File

@ -35,8 +35,9 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
//require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
}
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
@ -891,7 +892,6 @@ if ($action == 'create')
$object = new Facture($db); // Source invoice
$product_static = new Product($db);
$formproject = new FormProjets($db);
if ($object->fetch($id, $ref) > 0)
{

View File

@ -334,7 +334,7 @@ else
// $head[$h][1] = $langs->trans("Info");
// $h++;
dol_fiche_head($head, $hselected, $langs->trans("Cheques"),0,'payment');
dol_fiche_head($head, $hselected, $langs->trans("Cheques"), -1, 'payment');
/*
* Confirmation de la suppression du bordereau
@ -476,8 +476,7 @@ if ($action == 'new')
print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"").'">'."\n";
print '<tr class="liste_titre">';
print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").' ';
print "</td>\n";
print '<td style="min-width: 120px">'.$langs->trans("DateChequeReceived").'</td>'."\n";
print '<td style="min-width: 120px">'.$langs->trans("ChequeNumber")."</td>\n";
print '<td style="min-width: 200px">'.$langs->trans("CheckTransmitter")."</td>\n";
print '<td style="min-width: 200px">'.$langs->trans("Bank")."</td>\n";
@ -487,59 +486,57 @@ if ($action == 'new')
print '<td align="center" width="100px">'.$langs->trans("Select")."<br>";
if ($conf->use_javascript_ajax) print '<a href="#" id="checkall_'.$bid.'">'.$langs->trans("All").'</a> / <a href="#" id="checknone_'.$bid.'">'.$langs->trans("None").'</a>';
print '</td>';
print "</tr>\n";
$var=true;
foreach ($lines[$bid] as $lid => $value)
if (count($lines[$bid]))
{
foreach ($lines[$bid] as $lid => $value)
{
$account_id = $bid;
if (! isset($accounts[$bid]))
$accounts[$bid]=0;
$accounts[$bid] += 1;
$account_id = $bid;
if (! isset($accounts[$bid]))
$accounts[$bid]=0;
$accounts[$bid] += 1;
print '<tr class="oddeven">';
print '<td>'.dol_print_date($value["date"],'day').'</td>';
print '<td>'.$value["numero"]."</td>\n";
print '<td>'.$value["emetteur"]."</td>\n";
print '<td>'.$value["banque"]."</td>\n";
print '<td align="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
print '<tr class="oddeven">';
print '<td>'.dol_print_date($value["date"],'day').'</td>';
print '<td>'.$value["numero"]."</td>\n";
print '<td>'.$value["emetteur"]."</td>\n";
print '<td>'.$value["banque"]."</td>\n";
print '<td align="right">'.price($value["amount"], 0, $langs, 1, -1, -1, $conf->currency).'</td>';
// Link to payment
print '<td align="center">';
$paymentstatic->id=$value["paymentid"];
$paymentstatic->ref=$value["paymentid"];
if ($paymentstatic->id)
{
print $paymentstatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Link to bank transaction
print '<td align="center">';
$accountlinestatic->rowid=$value["id"];
if ($accountlinestatic->rowid)
{
print $accountlinestatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="center">';
print '<input id="'.$value["id"].'" class="flat checkforremise_'.$bid.'" checked type="checkbox" name="toRemise[]" value="'.$value["id"].'">';
print '</td>' ;
print '</tr>';
$i++;
// Link to payment
print '<td align="center">';
$paymentstatic->id=$value["paymentid"];
$paymentstatic->ref=$value["paymentid"];
if ($paymentstatic->id)
{
print $paymentstatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Link to bank transaction
print '<td align="center">';
$accountlinestatic->rowid=$value["id"];
if ($accountlinestatic->rowid)
{
print $accountlinestatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
print '<td align="center">';
print '<input id="'.$value["id"].'" class="flat checkforremise_'.$bid.'" checked type="checkbox" name="toRemise[]" value="'.$value["id"].'">';
print '</td>' ;
print '</tr>';
$i++;
}
}
print "</table>";
print '</div>';
@ -686,65 +683,75 @@ else
print_liste_field_titre('');
print "</tr>\n";
$i=1;
$var=false;
while ($objp = $db->fetch_object($resql))
{
$account_id = $objp->bid;
if (! isset($accounts[$objp->bid]))
$accounts[$objp->bid]=0;
$accounts[$objp->bid] += 1;
print '<tr class="oddeven">';
print '<td align="center">'.$i.'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->date),'day').'</td>'; // Date operation
print '<td align="center">'.($objp->num_chq?$objp->num_chq:'&nbsp;').'</td>';
print '<td>'.dol_trunc($objp->emetteur,24).'</td>';
print '<td>'.dol_trunc($objp->banque,24).'</td>';
print '<td align="right">'.price($objp->amount).'</td>';
// Link to payment
print '<td align="center">';
$paymentstatic->id=$objp->pid;
$paymentstatic->ref=$objp->pid;
if ($paymentstatic->id)
{
print $paymentstatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Link to bank transaction
print '<td align="center">';
$accountlinestatic->rowid=$objp->rowid;
if ($accountlinestatic->rowid)
{
print $accountlinestatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Action button
print '<td align="right">';
if ($object->statut == 0)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a>';
}
if ($object->statut == 1 && $objp->statut != 2)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a>';
}
if ($objp->statut == 2)
{
print ' &nbsp; '.img_picto($langs->trans('CheckRejected'),'statut8').'</a>';
}
print '</td>';
print '</tr>';
$i++;
}
if ($num > 0)
{
while ($objp = $db->fetch_object($resql))
{
$account_id = $objp->bid;
if (! isset($accounts[$objp->bid]))
$accounts[$objp->bid]=0;
$accounts[$objp->bid] += 1;
print '<tr class="oddeven">';
print '<td align="center">'.$i.'</td>';
print '<td align="center">'.dol_print_date($db->jdate($objp->date),'day').'</td>'; // Date operation
print '<td align="center">'.($objp->num_chq?$objp->num_chq:'&nbsp;').'</td>';
print '<td>'.dol_trunc($objp->emetteur,24).'</td>';
print '<td>'.dol_trunc($objp->banque,24).'</td>';
print '<td align="right">'.price($objp->amount).'</td>';
// Link to payment
print '<td align="center">';
$paymentstatic->id=$objp->pid;
$paymentstatic->ref=$objp->pid;
if ($paymentstatic->id)
{
print $paymentstatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Link to bank transaction
print '<td align="center">';
$accountlinestatic->rowid=$objp->rowid;
if ($accountlinestatic->rowid)
{
print $accountlinestatic->getNomUrl(1);
}
else
{
print '&nbsp;';
}
print '</td>';
// Action button
print '<td align="right">';
if ($object->statut == 0)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a>';
}
if ($object->statut == 1 && $objp->statut != 2)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a>';
}
if ($objp->statut == 2)
{
print ' &nbsp; '.img_picto($langs->trans('CheckRejected'),'statut8').'</a>';
}
print '</td>';
print '</tr>';
$i++;
}
}
else
{
print '<td colspan="8" class="opacitymedium">';
print $langs->trans("None");
print '</td>';
}
print "</table>";
print "</div>";
}

View File

@ -50,8 +50,6 @@ llxHeader('',$langs->trans("ChequesArea"));
print load_fiche_titre($langs->trans("ChequesArea"));
//print '<table border="0" width="100%" class="notopnoleftnoright">';
//print '<tr><td valign="top" width="30%" class="notopnoleft">';
print '<div class="fichecenter"><div class="fichethirdleft">';
$sql = "SELECT count(b.rowid)";
@ -90,7 +88,6 @@ else
}
//print '</td><td valign="top" width="70%" class="notopnoleftnoright">';
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
$max=10;
@ -98,15 +95,13 @@ $max=10;
$sql = "SELECT bc.rowid, bc.date_bordereau as db, bc.amount, bc.ref as ref";
$sql.= ", bc.statut, bc.nbcheque";
$sql.= ", ba.label, ba.rowid as bid";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc";
$sql.= ", ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " FROM ".MAIN_DB_PREFIX."bordereau_cheque as bc, ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= " WHERE ba.rowid = bc.fk_bank_account";
$sql.= " AND bc.entity = ".$conf->entity;
$sql.= " ORDER BY bc.date_bordereau DESC, rowid DESC";
$sql.= $db->plimit($max);
$resql = $db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
@ -128,9 +123,8 @@ if ($resql)
$accountstatic->id=$objp->bid;
$accountstatic->label=$objp->label;
print "<tr ".$bc[$var].">\n";
print '<tr class="oddeven">'."\n";
print '<td>'.$checkdepositstatic->getNomUrl(1).'</td>';
print '<td>'.dol_print_date($db->jdate($objp->db),'day').'</td>';
@ -142,15 +136,15 @@ if ($resql)
print '</tr>';
}
print "</table>";
$db->free($resql);
}
else
{
dol_print_error($db);
dol_print_error($db);
}
//print "</td></tr></table>\n";
print '</div></div></div>';
llxFooter();

View File

@ -332,14 +332,20 @@ if (empty($reshook))
else {
$desc = dol_htmlentitiesbr($lines[$i]->desc);
}
$txtva = $lines[$i]->vat_src_code ? $lines[$i]->tva_tx . ' (' . $lines[$i]->vat_src_code . ')' : $lines[$i]->tva_tx;
// View third's localtaxes for now
$localtax1_tx = get_localtax($txtva, 1, $object->thirdparty);
$localtax2_tx = get_localtax($txtva, 2, $object->thirdparty);
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$lines[$i]->tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$txtva,
$localtax1_tx,
$localtax2_tx,
$lines[$i]->fk_product,
$lines[$i]->remise_percent,
$lines[$i]->date_start,

View File

@ -616,7 +616,7 @@ class Contrat extends CommonObject
// Selectionne les lignes contrats liees a un produit
$sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,";
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql.= " d.total_ht,";
$sql.= " d.total_tva,";
$sql.= " d.total_localtax1,";
@ -650,9 +650,12 @@ class Contrat extends CommonObject
$line->fk_contrat = $objp->fk_contrat;
$line->desc = $objp->description; // Description ligne
$line->qty = $objp->qty;
$line->vat_src_code = $objp->vat_src_code ;
$line->tva_tx = $objp->tva_tx;
$line->localtax1_tx = $objp->localtax1_tx;
$line->localtax2_tx = $objp->localtax2_tx;
$line->localtax1_type = $objp->localtax1_type;
$line->localtax2_type = $objp->localtax2_type;
$line->subprice = $objp->subprice;
$line->statut = $objp->statut;
$line->remise_percent = $objp->remise_percent;
@ -2722,6 +2725,7 @@ class ContratLigne extends CommonObjectLine
$this->statut=(int) $this->statut;
$this->label=trim($this->label);
$this->description=trim($this->description);
$this->vat_src_code=trim($this->vat_src_code);
$this->tva_tx=trim($this->tva_tx);
$this->localtax1_tx=trim($this->localtax1_tx);
$this->localtax2_tx=trim($this->localtax2_tx);
@ -2793,6 +2797,7 @@ class ContratLigne extends CommonObjectLine
$sql.= " date_ouverture=".($this->date_ouverture!=''?"'".$this->db->idate($this->date_ouverture)."'":"null").",";
$sql.= " date_fin_validite=".($this->date_fin_validite!=''?"'".$this->db->idate($this->date_fin_validite)."'":"null").",";
$sql.= " date_cloture=".($this->date_cloture!=''?"'".$this->db->idate($this->date_cloture)."'":"null").",";
$sql.= " vat_src_code='".$this->vat_src_code."',";
$sql.= " tva_tx='".$this->tva_tx."',";
$sql.= " localtax1_tx='".$this->localtax1_tx."',";
$sql.= " localtax2_tx='".$this->localtax2_tx."',";
@ -2921,6 +2926,7 @@ class ContratLigne extends CommonObjectLine
$sql.= ") VALUES ($this->fk_contrat, '', '" . $this->db->escape($this->description) . "',";
$sql.= ($this->fk_product>0 ? $this->fk_product : "null").",";
$sql.= " '".$this->qty."',";
$sql.= " '".$this->vat_src_code."',";
$sql.= " '".$this->tva_tx."',";
$sql.= " '".$this->localtax1_tx."',";
$sql.= " '".$this->localtax2_tx."',";

View File

@ -406,60 +406,105 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
$outputlangs->setDefaultLang($newlang);
}
// Create empty PDF
$pdf=pdf_getInstance();
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
if(!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) {
// Create output dir if not exists
dol_mkdir($diroutputmassaction);
// Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/','_',$filename);
// Save merged file
if ($filter=='paye:0')
{
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
}
if ($year) $filename.='_'.$year;
if ($month) $filename.='_'.$month;
if (count($files)>0)
{
$now=dol_now();
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$input_files = '';
foreach($files as $f) {
$input_files.=' '.escapeshellarg($f);
}
$cmd = 'pdftk '.$input_files.' cat output '.escapeshellarg($file);
exec($cmd);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
}
else
{
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
}
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
else {
// Create empty PDF
$pdf=pdf_getInstance();
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
// Add all others
foreach($files as $file)
{
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++)
{
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Add all others
foreach($files as $file)
{
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++)
{
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Create output dir if not exists
dol_mkdir($diroutputmassaction);
// Create output dir if not exists
dol_mkdir($diroutputmassaction);
// Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/','_',$filename);
// Save merged file
if ($filter=='paye:0')
{
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
}
if ($year) $filename.='_'.$year;
if ($month) $filename.='_'.$month;
if ($pagecount)
{
$now=dol_now();
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
// Defined name of merged file
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
$filename=preg_replace('/\s/','_',$filename);
// Save merged file
if ($filter=='paye:0')
{
if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late")));
else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid")));
}
if ($year) $filename.='_'.$year;
if ($month) $filename.='_'.$month;
if ($pagecount)
{
$now=dol_now();
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
$langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
}
else
{
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
$langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
}
else
{
setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors');
}
}
}

View File

@ -360,7 +360,7 @@ abstract class CommonDocGenerator
{
global $conf;
$sumpayed=''; $alreadypayed='';
$sumpayed=$sumdeposit=$sumcreditnote='';
if ($object->element == 'facture')
{
$invoice_source=new Facture($this->db);
@ -369,7 +369,8 @@ abstract class CommonDocGenerator
$invoice_source->fetch($object->fk_facture_source);
}
$sumpayed = $object->getSommePaiement();
$alreadypayed=price($sumpayed,0,$outputlangs);
$sumdeposit = $object->getSumDepositsUsed();
$sumcreditnote = $object->getSumCreditNotesUsed();
}
$resarray=array(
@ -412,11 +413,21 @@ abstract class CommonDocGenerator
$array_key.'_note_private'=>$object->note,
$array_key.'_note_public'=>$object->note_public,
$array_key.'_note'=>$object->note_public, // For backward compatibility
// Payments
$array_key.'_already_payed_locale'=>price($alreadypayed, 0, $outputlangs),
$array_key.'_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs),
$array_key.'_already_payed'=>$alreadypayed,
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed)
$array_key.'_already_payed_locale'=>price($sumpayed, 0, $outputlangs),
$array_key.'_already_payed'=>price2num($sumpayed),
$array_key.'_already_deposit_locale'=>price($sumdeposit, 0, $outputlangs),
$array_key.'_already_deposit'=>price2num($sumdeposit),
$array_key.'_already_creditnote_locale'=>price($sumcreditnote, 0, $outputlangs),
$array_key.'_already_creditnote'=>price2num($sumcreditnote),
$array_key.'_already_payed_all_locale'=>price(price2num($sumpayed + $sumdeposit + $sumcreditnote, 'MT'), 0, $outputlangs),
$array_key.'already_payed_all'=> price2num(($sumpayed + $sumdeposit + $sumcreditnote), 'MT'),
// Remain to pay with all know infrmation (except open direct debit requests)
$array_key.'_remain_to_pay_locale'=>price(price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT'), 0, $outputlangs),
$array_key.'_remain_to_pay'=>price2num($object->total_ttc - $sumpayed - $sumdeposit - $sumcreditnote, 'MT')
);
// Add vat by rates

View File

@ -91,8 +91,8 @@ abstract class CommonInvoice extends CommonObject
/**
* Return remain amount to pay.
* Property ->id and ->total_ttc must be set.
* Return remain amount to pay. Property ->id and ->total_ttc must be set.
* This does not include open direct debit requests.
*
* @param int $multicurrency Return multicurrency_amount instead of amount
* @return int Remain of amount to pay
@ -549,6 +549,12 @@ abstract class CommonInvoiceLine extends CommonObjectLine
*/
public $fk_product;
/**
* VAT code
* @var string
*/
public $vat_src_code;
/**
* VAT %
* @var float

View File

@ -11,6 +11,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -2789,6 +2790,8 @@ abstract class CommonObject
{
global $user,$langs,$conf;
$savElementId=$elementId; // To be used later to know if we were using the method using the id of this or not.
$elementId = (!empty($elementId)?$elementId:$this->id);
$elementTable = (!empty($elementType)?$elementType:$this->table_element);
@ -2812,11 +2815,13 @@ abstract class CommonObject
$error = 0;
$trigkey='';
if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_CLOSE';
if ($this->element == 'supplier_proposal' && $status == 2) $trigkey='SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
if ($this->element == 'supplier_proposal' && $status == 3) $trigkey='SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
if ($this->element == 'supplier_proposal' && $status == 4) $trigkey='SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
if ($this->element == 'fichinter' && $status == 3) $trigkey='FICHINTER_CLASSIFY_DONE';
if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED';
if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED';
if ($trigkey)
{
// Appel des triggers
@ -2832,12 +2837,14 @@ abstract class CommonObject
if (! $error)
{
$this->db->commit();
if (empty($elementId)) // If the element we update was $this (so $elementId is null)
if (empty($savElementId)) // If the element we update was $this (so $elementId is null)
{
$this->statut = $status;
$this->status = $status;
}
return 1;
return 1;
}
else
{
@ -3033,12 +3040,12 @@ abstract class CommonObject
*/
function getTotalWeightVolume()
{
$weightUnit=0;
$volumeUnit=0;
$totalWeight = '';
$totalVolume = '';
$totalOrdered = ''; // defined for shipment only
$totalToShip = ''; // defined for shipment only
$totalWeight = 0;
$totalVolume = 0;
// defined for shipment only
$totalOrdered = '';
// defined for shipment only
$totalToShip = '';
foreach ($this->lines as $line)
{
@ -3053,11 +3060,18 @@ abstract class CommonObject
$totalToShip+=$line->qty_shipped; // defined for shipment only
}
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments
else $qty=$line->qty;
$weight=$line->weight;
$volume=$line->volume;
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') {
// for shipments
$qty = $line->qty_shipped ? $line->qty_shipped : 0;
}
else {
$qty = $line->qty ? $line->qty : 0;
}
$weight = $line->weight ? $line->weight : 0;
$volume = $line->volume ? $line->volume : 0;
$weight_units=$line->weight_units;
$volume_units=$line->volume_units;
@ -3559,7 +3573,7 @@ abstract class CommonObject
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td align="right">'.$langs->trans('VAT').'</td>';
print '<td align="right">'.$langs->trans('VATRate').'</td>';
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
if (!empty($conf->multicurrency->enabled)) print '<td align="right">'.$langs->trans('PriceUHTCurrency').'</td>';
print '<td align="right">'.$langs->trans('Qty').'</td>';
@ -3696,7 +3710,10 @@ abstract class CommonObject
$this->tpl['description'] = '&nbsp;';
}
// VAT Rate
$this->tpl['vat_rate'] = vatrate($line->tva_tx, true);
if (! empty($line->vat_src_code) && ! preg_match('/\(/', $this->tpl['vat_rate'])) $this->tpl['vat_rate'].=' ('.$line->vat_src_code.')';
$this->tpl['price'] = price($line->subprice);
$this->tpl['multicurrency_price'] = price($line->multicurrency_subprice);
$this->tpl['qty'] = (($line->info_bits & 2) != 2) ? $line->qty : '&nbsp;';
@ -4662,7 +4679,159 @@ abstract class CommonObject
return $buyPrice;
}
/**
* Function test if type is date
*
* @param array $info content informations of field
* @return bool
*/
protected function isDate($info)
{
if(isset($info['type']) && $info['type']=='date') return true;
else return false;
}
/**
* Function test if type is array
*
* @param array $info content informations of field
* @return bool
*/
protected function isArray($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='array') return true;
else return false;
}
else return false;
}
/**
* Function test if type is null
*
* @param array $info content informations of field
* @return bool
*/
protected function isNull($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='null') return true;
else return false;
}
else return false;
}
/**
* Function test if type is integer
*
* @param array $info content informations of field
* @return bool
*/
protected function isInt($info)
{
if(is_array($info))
{
if(isset($info['type']) && ($info['type']=='int' || $info['type']=='integer' )) return true;
else return false;
}
else return false;
}
/**
* Function test if type is float
*
* @param array $info content informations of field
* @return bool
*/
protected function isFloat($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='float') return true;
else return false;
}
else return false;
}
/**
* Function test if type is text
*
* @param array $info content informations of field
* @return bool
*/
protected function isText($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='text') return true;
else return false;
}
else return false;
}
/**
* Function test if is indexed
*
* @param array $info content informations of field
* @return bool
*/
protected function isIndex($info)
{
if(is_array($info))
{
if(isset($info['index']) && $info['index']==true) return true;
else return false;
}
else return false;
}
/**
* Function to prepare the values to insert
*
* @return array
*/
private function set_save_query()
{
$query=array();
foreach ($this->fields as $field=>$info)
{
if($this->isDate($info))
{
if(empty($this->{$field}))
{
$query[$field] = NULL;
}
else
{
$query[$field] = $this->db->idate($this->{$field});
}
}
else if($this->isArray($info))
{
$query[$field] = serialize($this->{$field});
}
else if($this->isInt($info))
{
$query[$field] = (int) price2num($this->{$field});
}
else if($this->isFloat($info))
{
$query[$field] = (double) price2num($this->{$field});
}
elseif($this->isNull($info))
{
$query[$field] = (is_null($this->{$field}) || (empty($this->{$field}) && $this->{$field}!==0 && $this->{$field}!=='0') ? null : $this->{$field});
}
else
{
$query[$field] = $this->{$field};
}
}
return $query;
}
/**
* Create object into database
@ -4674,28 +4843,82 @@ abstract class CommonObject
*/
public function createCommon(User $user, $notrigger = false)
{
foreach ($this->fields as $k => $v) {
$keys[] = $k;
$values[] = $this->quote($v);
$fields = array_merge(array('datec'=>$this->db->idate(dol_now())), $this->set_save_query());
foreach ($fields as $k => $v) {
$keys[] = $k;
$values[] = $this->quote($v);
}
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$table.'
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'
( '.implode( ",", $keys ).' )
VALUES ( '.implode( ",", $values ).' ) ';
$res = $this->query($sql);
$res = $this->db->query( $sql );
if($res===false) {
return false;
return false;
}
// TODO Add triggers
return true;
return true;
}
/**
* Function to load data into current object this
*
* @param stdClass $obj Contain data of object from database
*/
private function set_vars_by_db(&$obj)
{
foreach ($this->fields as $field => $info)
{
if($this->isDate($info))
{
if(empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0;
else $this->{$field} = strtotime($obj->{$field});
}
elseif($this->isArray($info))
{
$this->{$field} = @unserialize($obj->{$field});
// Hack for data not in UTF8
if($this->{$field } === FALSE) @unserialize(utf8_decode($obj->{$field}));
}
elseif($this->isInt($info))
{
$this->{$field} = (int) $obj->{$field};
}
elseif($this->isFloat($info))
{
$this->{$field} = (double) $obj->{$field};
}
elseif($this->isNull($info))
{
$val = $obj->{$field};
// zero is not null
$this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val);
}
else
{
$this->{$field} = $obj->{$field};
}
}
}
/**
* Function to concat keys of fields
*
* @return string
*/
private function get_field_list()
{
$keys = array_keys($this->fields);
return implode(',', $keys);
}
/**
* Load object in memory from the database
@ -4708,6 +4931,32 @@ abstract class CommonObject
public function fetchCommon($id, $ref = null)
{
if (empty($id) && empty($ref)) return false;
$sql = 'SELECT '.$this->get_field_list().', datec, tms';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
if(!empty($id)) $sql.= ' WHERE rowid = '.$id;
else $sql.= ' WHERE ref = \''.$this->quote($ref).'\'';
$res = $this->db->query($sql);
if($obj = $this->db->fetch_object($res))
{
$this->id = $id;
$this->set_vars_by_db($obj);
$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);
return $this->id;
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
}
/**
@ -4720,34 +4969,36 @@ abstract class CommonObject
*/
public function updateCommon(User $user, $notrigger = false)
{
foreach ($this->fields as $k => $v) {
if (is_array($key)){
$i=array_search($k, $key);
if ( $i !== false) {
$where[] = $key[$i].'=' . $this->quote( $v ) ;
continue;
}
} else {
if ( $k == $key) {
$where[] = $k.'=' .$this->quote( $v ) ;
continue;
}
}
$tmp[] = $k.'='.$this->quote($v);
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$table.' SET '.implode( ',', $tmp ).' WHERE ' . implode(' AND ',$where) ;
$res = $this->query( $sql );
if($res===false) {
//error
return false;
}
// TODO Add triggers
return true;
$fields = $this->set_save_query();
foreach ($fields as $k => $v) {
if (is_array($key)){
$i=array_search($k, $key);
if ( $i !== false) {
$where[] = $key[$i].'=' . $this->quote( $v ) ;
continue;
}
} else {
if ( $k == $key) {
$where[] = $k.'=' .$this->quote( $v ) ;
continue;
}
}
$tmp[] = $k.'='.$this->quote($v);
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode( ',', $tmp ).' WHERE rowid='.$this->id ;
$res = $this->db->query( $sql );
if($res===false) {
//error
return false;
}
// TODO Add triggers
return true;
}
/**
@ -4760,7 +5011,16 @@ abstract class CommonObject
*/
public function deleteCommon(User $user, $notrigger = false)
{
$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id;
$res = $this->db->query( $sql );
if($res===false) {
return false;
}
// TODO Add triggers
return true;
}
/**
@ -4769,11 +5029,11 @@ abstract class CommonObject
* @param string|int $value value to protect
* @return string|int
*/
function quote($value) {
protected function quote($value) {
if(is_null($value)) return 'NULL';
else if(is_numeric($value)) return $value;
else return "'".$this->escape( $value )."'";
else return "'".$this->db->escape( $value )."'";
}

View File

@ -358,8 +358,8 @@ class Conf
$this->supplier_order->dir_temp=$rootfordata."/fournisseur/commande/temp";
$this->supplier_invoice=new stdClass();
$this->supplier_invoice->enabled=1;
$this->supplier_order->dir_output=$rootfordata."/fournisseur/facture";
$this->supplier_order->dir_temp=$rootfordata."/fournisseur/facture/temp";
$this->supplier_invoice->dir_output=$rootfordata."/fournisseur/facture";
$this->supplier_invoice->dir_temp=$rootfordata."/fournisseur/facture/temp";
}
}

View File

@ -59,10 +59,10 @@ class CoreObject extends CommonObject
{
foreach ($this->fields as $field=>$info)
{
if ($this->is_date($info)) $this->{$field} = time();
elseif ($this->is_array($info)) $this->{$field} = array();
elseif ($this->is_int($info)) $this->{$field} = (int) 0;
elseif ($this->is_float($info)) $this->{$field} = (double) 0;
if ($this->isDate($info)) $this->{$field} = time();
elseif ($this->isArray($info)) $this->{$field} = array();
elseif ($this->isInt($info)) $this->{$field} = (int) 0;
elseif ($this->isFloat($info)) $this->{$field} = (double) 0;
else $this->{$field} = '';
}
@ -97,216 +97,6 @@ class CoreObject extends CommonObject
}
}
/**
* Function test if type is date
*
* @param array $info content informations of field
* @return bool
*/
private function is_date($info)
{
if(isset($info['type']) && $info['type']=='date') return true;
else return false;
}
/**
* Function test if type is array
*
* @param array $info content informations of field
* @return bool
*/
private function is_array($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='array') return true;
else return false;
}
else return false;
}
/**
* Function test if type is null
*
* @param array $info content informations of field
* @return bool
*/
private function is_null($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='null') return true;
else return false;
}
else return false;
}
/**
* Function test if type is integer
*
* @param array $info content informations of field
* @return bool
*/
private function is_int($info)
{
if(is_array($info))
{
if(isset($info['type']) && ($info['type']=='int' || $info['type']=='integer' )) return true;
else return false;
}
else return false;
}
/**
* Function test if type is float
*
* @param array $info content informations of field
* @return bool
*/
private function is_float($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='float') return true;
else return false;
}
else return false;
}
/**
* Function test if type is text
*
* @param array $info content informations of field
* @return bool
*/
private function is_text($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='text') return true;
else return false;
}
else return false;
}
/**
* Function test if is indexed
*
* @param array $info content informations of field
* @return bool
*/
private function is_index($info)
{
if(is_array($info))
{
if(isset($info['index']) && $info['index']==true) return true;
else return false;
}
else return false;
}
/**
* Function to prepare the values to insert
*
* @return array
*/
private function set_save_query()
{
$query=array();
foreach ($this->fields as $field=>$info)
{
if($this->is_date($info))
{
if(empty($this->{$field}))
{
$query[$field] = NULL;
}
else
{
$query[$field] = $this->db->idate($this->{$field});
}
}
else if($this->is_array($info))
{
$query[$field] = serialize($this->{$field});
}
else if($this->is_int($info))
{
$query[$field] = (int) price2num($this->{$field});
}
else if($this->is_float($info))
{
$query[$field] = (double) price2num($this->{$field});
}
elseif($this->is_null($info))
{
$query[$field] = (is_null($this->{$field}) || (empty($this->{$field}) && $this->{$field}!==0 && $this->{$field}!=='0') ? null : $this->{$field});
}
else
{
$query[$field] = $this->{$field};
}
}
return $query;
}
/**
* Function to concat keys of fields
*
* @return string
*/
private function get_field_list()
{
$keys = array_keys($this->fields);
return implode(',', $keys);
}
/**
* Function to load data into current object this
*
* @param stdClass $obj Contain data of object from database
*/
private function set_vars_by_db(&$obj)
{
foreach ($this->fields as $field => $info)
{
if($this->is_date($info))
{
if(empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0;
else $this->{$field} = strtotime($obj->{$field});
}
elseif($this->is_array($info))
{
$this->{$field} = @unserialize($obj->{$field});
// Hack for data not in UTF8
if($this->{$field } === FALSE) @unserialize(utf8_decode($obj->{$field}));
}
elseif($this->is_int($info))
{
$this->{$field} = (int) $obj->{$field};
}
elseif($this->is_float($info))
{
$this->{$field} = (double) $obj->{$field};
}
elseif($this->is_null($info))
{
$val = $obj->{$field};
// zero is not null
$this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val);
}
else
{
$this->{$field} = $obj->{$field};
}
}
}
/**
* Get object and children from database
*
@ -316,31 +106,14 @@ class CoreObject extends CommonObject
*/
public function fetch($id, $loadChild = true)
{
if (empty($id)) return false;
$sql = 'SELECT '.$this->get_field_list().', datec, tms';
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' WHERE rowid = '.$id;
$res = $this->db->query($sql);
if($obj = $this->db->fetch_object($res))
{
$this->id = $id;
$this->set_vars_by_db($obj);
$this->datec = $this->db->idate($obj->datec);
$this->tms = $this->db->idate($obj->tms);
if ($loadChild) $this->fetchChild();
return $this->id;
}
else
{
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}
$res = $this->fetchCommon($id);
if($res>0) {
if ($loadChild) $this->fetchChild();
}
return $res;
}
@ -473,10 +246,7 @@ class CoreObject extends CommonObject
$error = 0;
$this->db->begin();
$query = $this->set_save_query();
$query['rowid'] = $this->id;
$res = $this->db->update($this->table_element, $query, array('rowid'));
$res = $this->updateCommon($user);
if ($res)
{
$result = $this->call_trigger(strtoupper($this->element). '_UPDATE', $user);
@ -516,10 +286,7 @@ class CoreObject extends CommonObject
$error = 0;
$this->db->begin();
$query = $this->set_save_query();
$query['datec'] = date("Y-m-d H:i:s", dol_now());
$res = $this->db->insert($this->table_element, $query);
$res = $this->createCommon($user);
if($res)
{
$this->id = $this->db->last_insert_id($this->table_element);
@ -565,7 +332,7 @@ class CoreObject extends CommonObject
if (!$error)
{
$this->db->delete($this->table_element, array('rowid' => $this->id), array('rowid'));
$this->deleteCommon($user);
if($this->withChild && !empty($this->childtables))
{
foreach($this->childtables as &$childTable)
@ -669,5 +436,5 @@ class CoreObject extends CommonObject
return 1;
}
}

View File

@ -986,18 +986,23 @@ class Form
}
// mode 1
$urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter;
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
$out.='<style type="text/css">
.ui-autocomplete {
z-index: 150;
}
</style>';
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
else $placeholder=' title="'.$langs->trans("RefOrLabel").'"';
if ($hidelabel == 2) {
print img_picto($langs->trans("Search"), 'search');
$out.= img_picto($langs->trans("Search"), 'search');
}
}
print '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
$out.= '<input type="text" class="'.$morecss.'" name="search_'.$htmlname.'" id="search_'.$htmlname.'" value="'.$selected_input_value.'"'.$placeholder.' '.(!empty($conf->global->THIRDPARTY_SEARCH_AUTOFOCUS) ? 'autofocus' : '').' />';
if ($hidelabel == 3) {
print img_picto($langs->trans("Search"), 'search');
$out.= img_picto($langs->trans("Search"), 'search');
}
}
else

View File

@ -54,9 +54,10 @@ class FormActions
* @param string $htmlname Name of html prefix for html fields (selectX and valX)
* @param integer $showempty Show an empty line if select is used
* @param integer $onlyselect 0=Standard, 1=Hide percent of completion and force usage of a select list, 2=Same than 1 and add "Incomplete (Todo+Running)
* @param string $morecss More css on select field
* @return void
*/
function form_select_status_action($formname,$selected,$canedit=1,$htmlname='complete',$showempty=0,$onlyselect=0)
function form_select_status_action($formname, $selected, $canedit=1, $htmlname='complete', $showempty=0, $onlyselect=0, $morecss='maxwidth100')
{
global $langs,$conf;
@ -120,7 +121,7 @@ class FormActions
{
//var_dump($selected);
if ($selected == 'done') $selected='100';
print '<select '.($canedit?'':'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat maxwidth100">';
print '<select '.($canedit?'':'disabled ').'name="'.$htmlname.'" id="select'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'">';
if ($showempty) print '<option value=""'.($selected == ''?' selected':'').'></option>';
foreach($listofstatus as $key => $val)
{

View File

@ -327,7 +327,7 @@ class FormMail extends Form
{
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': '.$this->selectarray('modelmailselected', $modelmail_array, 0, 1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" id="modelselected">';
$out.= ' &nbsp; ';
@ -341,7 +341,7 @@ class FormMail extends Form
{
$out.= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
$out.= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put disabled on option, it is already on select and it makes chrome crazy.
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFrom", $langs->transnoentitiesnoconv('Setup').' - '.$langs->transnoentitiesnoconv('EMails')),1);
$out.= ' &nbsp; ';
$out.= '<input class="button" type="submit" value="'.$langs->trans('Apply').'" name="modelselected" disabled="disabled" id="modelselected">';
$out.= ' &nbsp; ';
@ -1139,7 +1139,7 @@ class FormMail extends Form
complete_substitutions_array($tmparray, $langs, null, $parameters);
foreach($tmparray as $key => $val)
{
$vars[]=$key;
$vars[$key]=$key;
}
return $vars;

View File

@ -32,9 +32,9 @@ class FormMailing extends Form
/**
* Output a select with destinaries status
*
* @param string $selectedid the selected id
* @param string $htmlname name of controm
* @param integer $show_empty show empty option
* @param string $selectedid The selected id
* @param string $htmlname Name of controm
* @param integer $show_empty Show empty option
* @return string HTML select
*/
public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) {
@ -46,13 +46,13 @@ class FormMailing extends Form
$mailing = new Mailing($this->db);
$options = array();
if ($show_empty) {
$options[''] = '';
$options[-2] = ''; // Note -1 is used for error
}
$options = array_merge($options, $mailing->statut_dest);
$options = $options + $mailing->statut_dest;
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
}
}

View File

@ -170,6 +170,7 @@ class Translate
* @param int $forcelangdir To force a different lang directory
* @param int $loadfromfileonly 1=Do not load overwritten translation from file or old conf.
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
* @see loadLangs
*/
function load($domain,$alt=0,$stopafterdirection=0,$forcelangdir='',$loadfromfileonly=0)
{

View File

@ -180,7 +180,7 @@ function length_accounta($accounta)
if ($accounta < 0 || empty($accounta)) return '';
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $account;
if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO)) return $accounta;
$a = $conf->global->ACCOUNTING_LENGTH_AACCOUNT;
if (! empty($a)) {

View File

@ -624,6 +624,11 @@ function defaultvalues_prepare_head()
$head[$h][2] = 'sortorder';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/defaultvalues.php?mode=focus";
$head[$h][1] = $langs->trans("DefaultFocus");
$head[$h][2] = 'focus';
$h++;
/*$head[$h][0] = DOL_URL_ROOT."/admin/translation.php?mode=searchkey";
$head[$h][1] = $langs->trans("TranslationKeySearch");
$head[$h][2] = 'searchkey';

View File

@ -76,7 +76,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">';
print $langs->trans("ActionsToDoBy").' &nbsp; ';
print '</td><td style="padding-bottom: 2px; padding-right: 4px;">';
print $form->select_dolusers($filtert, 'usertodo', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
print $form->select_dolusers($filtert, 'filtert', 1, '', ! $canedit, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
if (empty($conf->dol_optimize_smallscreen)) print ' &nbsp; '.$langs->trans("or") . ' '.$langs->trans("ToUserOfGroup").' &nbsp; ';
print $form->select_dolgroups($usergroupid, 'usergroup', 1, '', ! $canedit);
print '</td></tr>';

View File

@ -181,10 +181,12 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt
});
}
console.log("ajax_autocompleter new value selected, we trigger change on original component so field #search_'.$htmlname.'");
$("#search_'.$htmlname.'").trigger("change"); // We have changed value of the combo select, we must be sure to trigger all js hook binded on this event. This is required to trigger other javascript change method binded on original field by other code.
}
,delay: 500
}).data("ui-autocomplete")._renderItem = function( ul, item ) {
return $("<li>")
.data( "ui-autocomplete-item", item ) // jQuery UI > 1.10.0
.append( \'<a><span class="tag">\' + item.label + "</span></a>" )

View File

@ -1628,8 +1628,26 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
// Wrapping pour les apercu intervention
elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output))
{
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
if ($fuser->rights->ficheinter->lire) $accessallowed=1;
$original_file=$conf->ficheinter->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu supplier proposal
elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output))
{
if ($fuser->rights->supplier_proposal->lire) $accessallowed=1;
$original_file=$conf->supplier_proposal->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu supplier order
elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output))
{
if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1;
$original_file=$conf->fournisseur->commande->dir_output.'/'.$original_file;
}
// Wrapping pour les apercu supplier invoice
elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output))
{
if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1;
$original_file=$conf->fournisseur->facture->dir_output.'/'.$original_file;
}
// Wrapping pour les images des stats propales
elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp))
@ -2040,7 +2058,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
}
// Wrapping pour les dons
else if ($modulepart == 'donation' && !empty($conf->donation->dir_output))
else if ($modulepart == 'donation' && !empty($conf->don->dir_output))
{
if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file))
{

View File

@ -248,70 +248,74 @@ function dol_shutdown()
*/
function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
{
if (empty($method))
{
$out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
// Management of default values
if (! isset($_GET['sortfield'])) // If we did a click on a field to sort, we do no apply default values
{
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
$relativepathstring = $_SERVER["PHP_SELF"];
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
global $user;
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
{
//var_dump($user->default_values[$relativepathstring]['createform']);
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
}
}
// Management of default search_filters and sort order
elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
$relativepathstring = $_SERVER["PHP_SELF"];
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
global $user;
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
{
//var_dump($user->default_values[$relativepathstring]);
if ($paramname == 'sortfield')
{
if (isset($user->default_values[$relativepathstring]['sortorder']))
{
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=$key;
}
}
}
elseif ($paramname == 'sortorder')
{
if (isset($user->default_values[$relativepathstring]['sortorder']))
{
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=$val;
}
}
}
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname])) $out = $user->default_values[$relativepathstring]['filters'][$paramname];
}
}
}
}
if (empty($method)) $out = isset($_GET[$paramname])?$_GET[$paramname]:(isset($_POST[$paramname])?$_POST[$paramname]:'');
elseif ($method==1) $out = isset($_GET[$paramname])?$_GET[$paramname]:'';
elseif ($method==2) $out = isset($_POST[$paramname])?$_POST[$paramname]:'';
elseif ($method==3) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:'');
elseif ($method==4) $out = isset($_POST[$paramname])?$_POST[$paramname]:(isset($_GET[$paramname])?$_GET[$paramname]:(isset($_COOKIE[$paramname])?$_COOKIE[$paramname]:''));
else return 'BadThirdParameterForGETPOST';
if (empty($method) || $method == 3 || $method == 4)
{
global $conf;
// Management of default values
if (! isset($_GET['sortfield']) && empty($conf->global->MAIN_DISABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_DISABLE_DEFAULT_VALUES is on
{
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
$relativepathstring = $_SERVER["PHP_SELF"];
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
global $user;
if (! empty($user->default_values)) // $user->default_values defined from menu default values, and values loaded not at first
{
//var_dump($user->default_values[$relativepathstring]['createform']);
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
}
}
// Management of default search_filters and sort order
//elseif (preg_match('/list.php$/', $_SERVER["PHP_SELF"]) && ! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
elseif (! empty($paramname) && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
{
$relativepathstring = $_SERVER["PHP_SELF"];
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
global $user;
if (! empty($user->default_values)) // $user->default_values defined from menu default values
{
//var_dump($user->default_values[$relativepathstring]);
if ($paramname == 'sortfield')
{
if (isset($user->default_values[$relativepathstring]['sortorder']))
{
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=dol_string_nospecial($key, '');
}
}
}
elseif ($paramname == 'sortorder')
{
if (isset($user->default_values[$relativepathstring]['sortorder']))
{
foreach($user->default_values[$relativepathstring]['sortorder'] as $key => $val)
{
if ($out) $out.=', ';
$out.=dol_string_nospecial($val, '');
}
}
}
elseif (isset($user->default_values[$relativepathstring]['filters'][$paramname]))
$out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$paramname], '');
}
}
}
}
if (! empty($check))
{
// Replace vars like __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__
@ -1065,11 +1069,12 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
$modulepart='unknown';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
if ($object->element == 'user') $modulepart='userphoto';
if ($object->element == 'product') $modulepart='product';
if (class_exists("Imagick"))
{
if ($object->element == 'propal') $modulepart='propal';
@ -1077,6 +1082,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ($object->element == 'facture') $modulepart='facture';
if ($object->element == 'fichinter') $modulepart='ficheinter';
if ($object->element == 'contrat') $modulepart='contract';
if ($object->element == 'supplier_proposal') $modulepart='supplier_proposal';
if ($object->element == 'order_supplier') $modulepart='supplier_order';
if ($object->element == 'invoice_supplier') $modulepart='supplier_invoice';
}
if ($object->element == 'product')
@ -1102,19 +1110,26 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
if ($showimage)
{
if ($modulepart != 'unknown')
if ($modulepart != 'unknown')
{
$phototoshow='';
// Check if a preview file is available
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract')) && class_exists("Imagick"))
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice')) && class_exists("Imagick"))
{
$objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->$modulepart->dir_output . "/";
$filepath = $dir_output . $objectref . "/";
if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
{
$subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref;
}
else
{
$subdir = get_exdir($object->id, 0, 0, 0, $object, $modulepart).$objectref;
}
$filepath = $dir_output . $subdir . "/";
$file = $filepath . $objectref . ".pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf';
$relativepath = $subdir.'/'.$objectref.'.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
$fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
@ -1137,7 +1152,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if (file_exists($fileimage))
{
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
$phototoshow.= '<img height="70" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
$phototoshow.= '</div></div>';
}
// Si fichier png PDF de plus d'1 page trouve
@ -1145,7 +1160,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
{
$preview = preg_replace('/\.png/','',$relativepathimage) . "-0.png";
$phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
$phototoshow.= '<img height="70" class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
$phototoshow.= '<img height="70" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
$phototoshow.= '</div></div>';
}
}
@ -1171,7 +1186,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$width=80;
$cssclass='photorefcenter';
$nophoto=img_picto('', 'title_agenda', '', false, 1);
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
}
else
{
@ -1179,8 +1193,8 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$picto = $object->picto;
if ($object->element == 'project' && ! $object->public) $picto = 'project'; // instead of projectpub
$nophoto=img_picto('', 'object_'.$picto, '', false, 1);
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
}
$morehtmlleft.='<!-- No photo to show --><div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').' src="'.$nophoto.'"></div></div>';
$morehtmlleft.='</div>';
}
}
@ -4466,7 +4480,8 @@ function yn($yesno, $case=1, $color=0)
/**
* Return a path to have a directory according to object.
* New usage: $conf->product->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart')
* or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'modulepart') if multidir_output not defined.
* Old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/"
*
* @param string $num Id of object (deprecated, $object will be used in future)
@ -4487,7 +4502,7 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart)
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product';
if (! empty($level) && in_array($modulepart, $arrayforoldpath))
{
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided
// This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided.
if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num);
else $num = preg_replace('/^.*\-/i','',$num);
$num = substr("000".$num, -$level);

View File

@ -1161,7 +1161,7 @@ function check_value($mask,$value)
// If an offset is asked
if (! empty($reg[2]) && preg_match('/^\+/',$reg[2])) $maskoffset=preg_replace('/^\+/','',$reg[2]);
if (! empty($reg[3]) && preg_match('^\+',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
if (! empty($reg[3]) && preg_match('/^\+/',$reg[3])) $maskoffset=preg_replace('/^\+/','',$reg[3]);
// Define $sqlwhere

View File

@ -599,7 +599,14 @@ function pdf_getSubstitutionArray($outputlangs)
$substitutionarray=array(
'__MYCOMPANY_NAME__' => $mysoc->name,
'__MYCOMPANY_EMAIL__' => $mysoc->email,
'__USER_ID__' => $user->id,
'__MYCOMPANY_PROFID1__' => $mysoc->idprof1,
'__MYCOMPANY_PROFID2__' => $mysoc->idprof2,
'__MYCOMPANY_PROFID3__' => $mysoc->idprof3,
'__MYCOMPANY_PROFID4__' => $mysoc->idprof4,
'__MYCOMPANY_PROFID5__' => $mysoc->idprof5,
'__MYCOMPANY_PROFID6__' => $mysoc->idprof6,
'__MYCOMPANY_CAPITAL__' => $mysoc->capital,
'__USER_ID__' => $user->id,
'__USER_LOGIN__' => $user->login,
'__USER_LASTNAME__' => $user->lastname,
'__USER_FIRSTNAME__' => $user->firstname,

View File

@ -197,12 +197,6 @@ function dol_loginfunction($langs,$conf,$mysoc)
if (! GETPOST("username")) $focus_element='username';
else $focus_element='password';
$login_background=DOL_URL_ROOT.'/theme/login_background.png';
if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/img/login_background.png'))
{
$login_background=DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/login_background.png';
}
$demologin='';
$demopassword='';
if (! empty($dolibarr_main_demo))

View File

@ -426,7 +426,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
print '</td></tr>';
// BackgroundColor
// Background color THEME_ELDY_BACKBODY
if ($foruserprofile)
{
/*
@ -609,7 +609,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
{
print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default"));
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>3c3c14</strong>) ';
print ' &nbsp; ('.$langs->trans("Default").': <strong><span style="color: #3c3c14">3c3c14</span></strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '</td>';
@ -654,9 +654,14 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
else
{
//print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; background-color: #'.$defaultcolor.'" value="'.$langs->trans("Default").'">';
//print '<span style="color: #000078">'.$langs->trans("Default").'</span>';
print $langs->trans("Default");
}
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>000078</strong>) ';
print ' &nbsp; ('.$langs->trans("Default").': <strong><span style="color: #000078">000078</span></strong>) ';
print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis"));
print '</td>';
}

View File

@ -211,14 +211,15 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'accounting', 6__+MAX_llx_menu__, '/accountancy/index.php?leftmenu=accountancy', 'MenuAccountancy', 0, 'accountancy', '! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire', '', 0, 7, __ENTITY__);
-- Setup
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2451__+MAX_llx_menu__, 'accountancy', 'accountancy_admin', 2400__+MAX_llx_menu__, '/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Setup', 1, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 22, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_journal', 2451__+MAX_llx_menu__, '/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingJournals', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 10, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2455__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chartmodel', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Pcg_version', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 20, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2456__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart', 2451__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'Chartofaccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 30, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2457__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_chart_group', 2451__+MAX_llx_menu__, '/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin', 'AccountingCategory', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 40, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2458__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_default', 2451__+MAX_llx_menu__, '/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuDefaultAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 50, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2459__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_vat', 2451__+MAX_llx_menu__, '/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuVatAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 60, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2460__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_tax', 2451__+MAX_llx_menu__, '/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuTaxAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 70, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2461__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_expensereport', 2451__+MAX_llx_menu__, '/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuExpenseReportAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 80, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="accountancy_admin"', __HANDLER__, 'left', 2462__+MAX_llx_menu__, 'accountancy', 'accountancy_admin_product', 2451__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin', 'MenuProductsAccounts', 2, 'accountancy', '$user->rights->accounting->chartofaccount', '', 0, 90, __ENTITY__);
-- Binding
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', 'dispatch_customer', 2400__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=dispatch_customer', 'CustomersVentilation', 1, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 2, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="dispatch_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2401__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 2, 'accountancy', '$user->rights->accounting->bind->write', '', 0, 3, __ENTITY__);

View File

@ -165,7 +165,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
if (! empty($conf->loan->enabled)) $menuqualified++;
$tmpentry=array(
'enabled'=>$menuqualified,
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->plancompte->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)),
'module'=>'comptabilite|accounting|facture|supplier_invoice|don|tax|salaries|loan');
$showmode=dol_eldy_showmenu($type_user, $tmpentry, $listofmodulesforexternal);
if ($showmode)
@ -947,26 +947,27 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
$langs->load("accountancy");
$permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
$permtoshowmenu=(! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire);
$newmenu->add("/accountancy/index.php?leftmenu=accountancy",$langs->trans("MenuAccountancy"), 0, $permtoshowmenu, '', $mainmenu, 'accountancy');
// Chart of account
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 10);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 20);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 22);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingJournals"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_journal', 10);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/accountmodel.php?id=31&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Pcg_version"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chartmodel', 20);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 30);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/categories_list.php?id=32&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("AccountingCategory"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_chart', 31);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuDefaultAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 40);
if (! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled))
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=10&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuVatAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
}
if (! empty($conf->tax->enabled))
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=7&from=accountancy&search_country_id=".$mysoc->country_id."&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuTaxAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
}
if (! empty($conf->expensereport->enabled))
{
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 30);
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("MenuExpenseReportAccounts"),2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_default', 50);
}
/* not required yet, already supported by default account
if (! empty($conf->loan->enabled))
@ -977,7 +978,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
{
if (preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/don/admin/donation.php?from=accountancy&mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuDonationAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_donation', 47);
}*/
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 50);
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/',$leftmenu)) $newmenu->add("/accountancy/admin/productaccount.php?mainmenu=accountancy&amp;leftmenu=accountancy_admin", $langs->trans("MenuProductsAccounts"), 2, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_product', 60);
// Binding
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/customer/index.php?leftmenu=accountancy_dispatch_customer&amp;mainmenu=accountancy",$langs->trans("CustomersVentilation"),1,$user->rights->accounting->bind->write, '', $mainmenu, 'dispatch_customer');
@ -1006,8 +1007,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Multi journal
$sql = "SELECT rowid, code, label, nature";
$sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
// $sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY code";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " ORDER BY nature";
$resql = $db->query($sql);
if ($resql)
@ -1020,14 +1021,25 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
while ($i < $numr)
{
$objp = $db->fetch_object($resql);
if ($objp->nature == 1) $nature="sells";
if ($objp->nature == 2) $nature="purchases";
if ($objp->nature == 3) $nature="bank";
if ($objp->nature == 4) $nature="various";
$nature='';
// Must match array $sourceList defined into journals_list.php
if ($objp->nature == 2) $nature="sells";
if ($objp->nature == 3) $nature="purchases";
if ($objp->nature == 4) $nature="bank";
if ($objp->nature == 1) $nature="various";
if ($objp->nature == 9) $nature="hasnew";
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&code_journal='.$objp->code,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire);
// To enable when page exists
if (empty($conf->global->MAIN_FEATURES_LEVEL))
{
if ($nature == 'various' || $nature == 'hasnew') $nature='';
}
if ($nature)
{
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&code_journal='.$objp->code,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire);
}
$i++;
}
}

View File

@ -49,7 +49,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->db = $db;
$this->name = "rouget";
$this->description = $langs->trans("DocumentModelSimple");
$this->description = $langs->trans("DocumentModelStandardPDF");
$this->type = 'pdf';
$formatarray=pdf_getFormat();

View File

@ -65,7 +65,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->db = $db;
$this->name = 'soleil';
$this->description = $langs->trans("DocumentModelStandard");
$this->description = $langs->trans("DocumentModelStandardPDF");
// Dimension page pour format A4
$this->type = 'pdf';

View File

@ -53,7 +53,7 @@ class modProduct extends DolibarrModules
$this->module_position = 20;
// 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->description = "Gestion des produits";
$this->description = "Product management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
@ -83,7 +83,14 @@ class modProduct extends DolibarrModules
$this->const[$r][3] = 'Module to control product codes';
$this->const[$r][4] = 0;
$r++;
/*$this->const[$r][0] = "PRODUCT_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "standard";
$this->const[$r][3] = 'Default module for document generation';
$this->const[$r][4] = 0;
$r++;*/
// Boxes
$this->boxes = array(
0=>array('file'=>'box_produits.php','enabledbydefaulton'=>'Home'),

View File

@ -51,7 +51,7 @@ class modService extends DolibarrModules
$this->module_position = 30;
// 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->description = "Gestion des services";
$this->description = "Service management";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';

View File

@ -117,91 +117,39 @@ class modStock extends DolibarrModules
$this->rights[4][4] = 'mouvement';
$this->rights[4][5] = 'creer';
/*
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryReadPermission'; // Permission label
$this->rights[$r][3] = 1; // 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)
$r++;
if ($conf->global->MAIN_LEVEL_FEATURES >= 2) {
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[5][0] = 1006;
$this->rights[5][1] = 'inventoryReadPermission'; // Permission label
$this->rights[5][3] = 0; // Permission by default for new user (0/1)
$this->rights[5][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryWritePermission'; // Permission label
$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)
$r++;
$this->rights[6][0] = 1007;
$this->rights[6][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
$this->rights[6][4] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[7][0] = 1008;
$this->rights[7][1] = 'inventoryWritePermission'; // Permission label
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
$this->rights[7][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
$this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
*/
$this->rights[7][0] = 1009;
$this->rights[7][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
$this->rights[7][4] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[7][0] = 1010;
$this->rights[7][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
$this->rights[7][4] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
}
// Main menu entries
$this->menu = array(); // List of menus to add
$r=0;
/*
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'Inventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left',
'url'=>'/inventory/list.php',
'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'NewInventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left_create',
'url'=>'/inventory/inventory.php?action=create',
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->create', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array(
'fk_menu'=>'fk_mainmenu=products,fk_leftmenu=inventory_left', // Put 0 if this is a top menu
'type'=>'left', // This is a Top menu entry
'titre'=>'ListInventory',
'mainmenu'=>'products',
'leftmenu'=>'inventory_left_list',
'url'=>'/inventory/list.php',
'langs'=>'inventory', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100+$r,
'enabled'=>'$conf->inventory->enabled', // Define condition to show or hide menu entry. Use '$conf->inventory->enabled' if entry must be visible if module is enabled.
'perms'=>'$user->rights->inventory->read', // Use 'perms'=>'$user->rights->inventory->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2
); // 0=Menu for internal users, 1=external users, 2=both
$r++;
*/
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.

View File

@ -92,8 +92,8 @@ class pdf_standard extends ModelePDFProduct
$langs->load("companies");
$this->db = $db;
$this->name = "PDF template";
$this->description = $langs->trans("DocumentModelPdf");
$this->name = "standard";
$this->description = $langs->trans("DocumentModelStandardPDF");
// Dimension page pour format A4
$this->type = 'pdf';
@ -107,15 +107,9 @@ class pdf_standard extends ModelePDFProduct
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 0; // Gere option tva PRODUCT_TVAOPTION
$this->option_modereg = 0; // Affiche mode reglement
$this->option_condreg = 0; // Affiche conditions reglement
$this->option_codeproduitservice = 0; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts
$this->option_freetext = 0; // Support add of a personalised text
// Recupere emetteur
$this->emetteur=$mysoc;
@ -262,7 +256,7 @@ class pdf_standard extends ModelePDFProduct
}
if ($object->weight)
{
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.$object->length.'x'.$object->width.'x'.$object->height, 0, 1);
$pdf->writeHTMLCell(190, 3, $this->marge_gauche, $nexY, $langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").': '.($object->length != ''?$object->length:'?').' x '.($object->width != ''?$object->width:'?').' x '.($object->height != ''?$object->height:'?'), 0, 1);
$nexY = $pdf->GetY();
}
if ($object->surface)

View File

@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functionsnumtoword.lib.php';
/**
* Class to generate the supplier invoices with the canelle model
*/
class pdf_cow extends ModelePDFSuppliersPayments
class pdf_standard extends ModelePDFSuppliersPayments
{
var $db;
var $name;
@ -70,8 +70,8 @@ class pdf_cow extends ModelePDFSuppliersPayments
$langs->load("bills");
$this->db = $db;
$this->name = "cow";
$this->description = $langs->trans('SuppliersPaymentModel');
$this->name = "standard";
$this->description = $langs->trans('DocumentModelStandardPDF');
// Dimension page pour format A4
$this->type = 'pdf';
@ -85,10 +85,6 @@ class pdf_cow extends ModelePDFSuppliersPayments
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->option_logo = 1; // Affiche logo
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
$this->option_modereg = 1; // Affiche mode reglement
$this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->franchise=!$mysoc->tva_assuj;

View File

@ -635,16 +635,6 @@ class pdf_aurore extends ModelePDFSupplierProposal
$pdf->SetFont('','', $default_font_size - 1);
// If France, show VAT mention if not applicable
if ($this->emetteur->country_code == 'FR' && $this->franchise == 1)
{
$pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("VATIsNotUsedForInvoice"), 0, 'L', 0);
$posy=$pdf->GetY()+4;
}
$posxval=52;
// Show shipping date
@ -723,7 +713,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$posy=$pdf->GetY()+3;
}
if (empty($conf->global->SUPPLIER_PROPOSAL_PDF_HIDE_PAYMENTTERMCOND))
if (! empty($conf->global->SUPPLIER_PROPOSAL_PDF_SHOW_PAYMENTTERMCOND))
{
// Show payment mode
if ($object->mode_reglement_code
@ -1037,7 +1027,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$resteapayer = $object->total_ttc - $deja_regle;
if (! empty($object->paye)) $resteapayer=0;
*/
if ($deja_regle > 0)
{
$index++;

View File

@ -71,7 +71,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu
$head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), 0, 'intervention');
dol_fiche_head($head, 'attributes', $langs->trans("Interventions"), -1, 'intervention');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -72,7 +72,7 @@ print load_fiche_titre($langs->trans("InterventionsSetup"),$linkback,'title_setu
$head=fichinter_admin_prepare_head();
dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), 0, 'intervention');
dol_fiche_head($head, 'attributesdet', $langs->trans("Interventions"), -1, 'intervention');
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';

View File

@ -1487,6 +1487,9 @@ class CommandeFournisseur extends CommonOrder
$localtax2_type=$localtaxes_type[2];
$subprice = price2num($pu,'MU');
$rangmax = $this->line_max();
$rang = $rangmax + 1;
// Insert line
$this->line=new CommandeFournisseurLigne($this->db);
@ -2669,21 +2672,22 @@ class CommandeFournisseur extends CommonOrder
$sql.= " FROM ".MAIN_DB_PREFIX.'c_input_method';
$sql.= " WHERE active=1 AND rowid = ".$db->escape($this->methode_commande_id);
$query = $db->query($sql);
if ($query && $db->num_rows($query))
$resql = $db->query($sql);
if ($resql)
{
$obj = $db->fetch_object($query);
$string = $langs->trans($obj->code);
if ($string == $obj->code)
if ($db->num_rows($query))
{
$string = $obj->label != '-' ? $obj->label : '';
}
return $string;
$obj = $db->fetch_object($query);
$string = $langs->trans($obj->code);
if ($string == $obj->code)
{
$string = $obj->label != '-' ? $obj->label : '';
}
return $string;
}
}
dol_print_error($db);
else dol_print_error($db);
}
return '';
@ -2817,7 +2821,7 @@ class CommandeFournisseur extends CommonOrder
/**
* Calc status regarding dispatch stock
* Calc status regarding to dispatched stock
*
* @param User $user User action
* @param int $closeopenorder Close if received

View File

@ -128,7 +128,9 @@ class FactureFournisseur extends CommonInvoice
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
//! id of source invoice if replacement invoice or credit note
public $fk_facture_source;
/**
* Standard invoice
*/
@ -263,6 +265,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", fk_multicurrency";
$sql.= ", multicurrency_code";
$sql.= ", multicurrency_tx";
$sql.= ", fk_facture_source";
$sql.= ")";
$sql.= " VALUES (";
$sql.= "'(PROV)'";
@ -286,6 +289,7 @@ class FactureFournisseur extends CommonInvoice
$sql.= ", ".(int) $this->fk_multicurrency;
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
$sql.= ", ".(double) $this->multicurrency_tx;
$sql.= ", ".(isset($this->fk_facture_source)?$this->fk_facture_source:"NULL");
$sql.= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -467,16 +467,14 @@ if ($id > 0 || ! empty($ref)) {
if ($remaintodispatch || empty($conf->global->SUPPLIER_ORDER_DISABLE_STOCK_DISPATCH_WHEN_TOTAL_REACHED)) {
$nbproduct++;
$var = ! $var;
// To show detail cref and description value, we must make calculation by cref
// print ($objp->cref?' ('.$objp->cref.')':'');
// if ($objp->description) print '<br>'.nl2br($objp->description);
$suffix = '_0_' . $i;
print "\n";
print '<!-- Line ' . $suffix . ' -->' . "\n";
print "<tr " . $bc[$var] . ">";
print '<!-- Line to dispatch ' . $suffix . ' -->' . "\n";
print '<tr class="oddeven">';
$linktoprod = '<a href="' . DOL_URL_ROOT . '/product/fournisseurs.php?id=' . $objp->fk_product . '">' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . '</a>';
$linktoprod .= ' - ' . $objp->label . "\n";
@ -500,7 +498,7 @@ if ($id > 0 || ! empty($ref)) {
print "</td>";
}
$var = ! $var;
// Define unit price for PMP calculation
$up_ht_disc = $objp->subprice;
if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP))
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
@ -517,11 +515,21 @@ if ($id > 0 || ! empty($ref)) {
print '<td></td>'; // Warehouse column
print '</tr>';
print '<tr ' . $bc[$var] . ' name="' . $type . $suffix . '">';
print '<tr class="oddeven" name="' . $type . $suffix . '">';
print '<td>';
print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
print '<input name="product_batch' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
print '<input name="pu' . $suffix . '" type="hidden" value="' . $up_ht_disc . '"><!-- This is a up including discount -->';
print '<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested !
{
print $langs->trans("BuyingPrice").': <input class="maxwidth75" name="pu' . $suffix . '" type="text" value="' . price2num($up_ht_disc, 'MU') . '">';
}
else
{
print '<input class="maxwidth75" name="pu' . $suffix . '" type="hidden" value="' . price2num($up_ht_disc, 'MU') . '">';
}
// hidden fields for js function
print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . ( float ) $products_dispatched[$objp->rowid] . '">';
@ -544,11 +552,22 @@ if ($id > 0 || ! empty($ref)) {
print '<td align="right">' . img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"') . '</td>'; // Dispatch column
print '<td></td>';
print '</tr>';
print '<tr ' . $bc[$var] . ' name="' . $type . $suffix . '">';
print '<tr class="oddeven" name="' . $type . $suffix . '">';
print '<td colspan="6">';
print '<input name="fk_commandefourndet' . $suffix . '" type="hidden" value="' . $objp->rowid . '">';
print '<input name="product' . $suffix . '" type="hidden" value="' . $objp->fk_product . '">';
print '<input name="pu' . $suffix . '" type="hidden" value="' . $up_ht_disc . '"><!-- This is a up including discount -->';
print '<!-- This is a up (may include discount or not depending on STOCK_EXCLUDE_DISCOUNT_FOR_PMP. will be used for PMP calculation) -->';
if (! empty($conf->global->SUPPLIER_ORDER_EDIT_BUYINGPRICE_DURING_RECEIPT)) // Not tested !
{
print $langs->trans("BuyingPrice").': <input class="maxwidth75" name="pu' . $suffix . '" type="text" value="' . price2num($up_ht_disc, 'MU') . '">';
}
else
{
print '<input class="maxwidth75" name="pu' . $suffix . '" type="hidden" value="' . price2num($up_ht_disc, 'MU') . '">';
}
// hidden fields for js function
print '<input id="qty_ordered' . $suffix . '" type="hidden" value="' . $objp->qty . '">';
print '<input id="qty_dispatched' . $suffix . '" type="hidden" value="' . ( float ) $products_dispatched[$objp->rowid] . '">';

View File

@ -70,7 +70,7 @@ $projectid = GETPOST('projectid','int');
$origin = GETPOST('origin', 'alpha');
$originid = GETPOST('originid', 'int');
//PDF
// PDF
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
@ -1194,32 +1194,11 @@ if (empty($reshook))
$trackid='sin'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Build document
if ($action == 'builddoc')
{
// Save modele used
$object->fetch($id);
$object->fetch_thirdparty();
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
$outputlangs = $langs;
$newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Actions to build doc
$upload_dir = $conf->fournisseur->facture->dir_output;
$permissioncreate = $user->rights->fournisseur->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
// Make calculation according to calculationrule
if ($action == 'calculate')
{
@ -1234,22 +1213,6 @@ if (empty($reshook))
exit;
}
}
// Delete file in doc form
if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($object->fetch($id))
{
$object->fetch_thirdparty();
$upload_dir = $conf->fournisseur->facture->dir_output . "/";
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
}
if ($action == 'update_extras')
{
// Fill array 'array_options' with data from add form
@ -1924,7 +1887,7 @@ else
$head = facturefourn_prepare_head($object);
$titre=$langs->trans('SupplierInvoice');
dol_fiche_head($head, 'card', $titre, 0, 'bill');
dol_fiche_head($head, 'card', $titre, -1, 'bill');
// Clone confirmation
if ($action == 'clone')
@ -2792,8 +2755,8 @@ else
* Documents generes
*/
$ref=dol_sanitizeFileName($object->ref);
$subdir = get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
$filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id,2,0,0,$object,'invoice_supplier').$ref;
$subdir = get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$ref;
$filedir = $conf->fournisseur->facture->dir_output.'/'.$subdir;
$urlsource=$_SERVER['PHP_SELF'].'?id='.$object->id;
$genallowed=$user->rights->fournisseur->facture->creer;
$delallowed=$user->rights->fournisseur->facture->supprimer;

View File

@ -138,7 +138,7 @@ if ($id > 0 || ! empty($ref))
$head = facturefourn_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), 0, 'bill');
dol_fiche_head($head, 'contact', $langs->trans('SupplierInvoice'), -1, 'bill');
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';

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