Merge remote-tracking branch 'Dolibarr/develop' into develop
This commit is contained in:
commit
6f5720b5b3
13
.gitignore
vendored
13
.gitignore
vendored
@ -41,3 +41,16 @@ htdocs/includes/sebastian/
|
||||
htdocs/includes/squizlabs/
|
||||
htdocs/includes/webmozart/
|
||||
htdocs/.well-known/apple-developer-merchantid-domain-association
|
||||
|
||||
# Node Modules
|
||||
build/yarn-error.log
|
||||
build/node_modules/
|
||||
node_modules/
|
||||
|
||||
#yarn
|
||||
yarn.lock
|
||||
|
||||
#package-lock
|
||||
package-lock.json
|
||||
|
||||
doc/install.lock
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
os: linux
|
||||
dist: xenial
|
||||
#dist: bionic
|
||||
sudo: required
|
||||
# Deprecated: The key sudo has no effect anymore.
|
||||
#sudo: required
|
||||
|
||||
language: php
|
||||
|
||||
|
||||
@ -12,7 +12,8 @@ NEW: Module Reception (for a more accurate management of your receptions) moved
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Properties ->contactid has been renamed into ->contact_id
|
||||
* Properties ->contactid have been renamed into ->contact_id
|
||||
* Properties ->titre have been renamed into ->title
|
||||
* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id (english)
|
||||
* The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you used the old syntax in
|
||||
your email templates.
|
||||
@ -24,6 +25,7 @@ Following changes may create regressions for some external modules, but were nec
|
||||
* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml') so no html will be allowed. Use GETPOST(..., 'restricthtml') to accept HTML.
|
||||
* If you have links in your code with '&action=delete' as a parameter, you must also add '&token='.newToken() as another parameter to avoid CSRF protection errors.
|
||||
* The API addPayment for api_invoice has evolved to accept amount into a foreign currency. You must provide array(amount=>X,mutlicurrency_ammount=>Y) instead of amount.
|
||||
* The method select_thirdparty(), deprecated since 3.8, into html.form.class.php has been removed.
|
||||
|
||||
***** ChangeLog for 12.0.3 compared to 12.0.2 *****
|
||||
FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename
|
||||
|
||||
@ -620,6 +620,9 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/autoload.php`;
|
||||
|
||||
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
|
||||
}
|
||||
|
||||
|
||||
@ -357,8 +357,8 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true)
|
||||
$line = str_replace(" time with time zone", " time", $line);
|
||||
$line = str_replace(" time without time zone", " time", $line);
|
||||
|
||||
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line);
|
||||
$line = str_replace(" timestamp without time zone DEFAULT now()", " timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", $line);
|
||||
|
||||
if (strstr($line, "auto_increment") || preg_match('/ rowid int/', $line) || preg_match('/ id int/', $line)) {
|
||||
$field = getfieldname($line);
|
||||
|
||||
@ -47,9 +47,9 @@ $action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
||||
$list_account_main = array(
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
'ACCOUNTING_ACCOUNT_CUSTOMER',
|
||||
'ACCOUNTING_ACCOUNT_SUPPLIER',
|
||||
'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT',
|
||||
);
|
||||
|
||||
$list_account = array();
|
||||
@ -120,9 +120,9 @@ if ($action == 'update') {
|
||||
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
@ -159,20 +159,20 @@ print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("ThirdParties").' | '.$langs->trans("Users").'</td><td></td></tr>';
|
||||
|
||||
foreach ($list_account_main as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$keydesc = $key.'_Desc';
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
$keydesc = $key.'_Desc';
|
||||
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
$htmltext = $langs->trans($keydesc);
|
||||
print '<td class="fieldrequired" width="50%">';
|
||||
print $form->textwithpicto($label, $htmltext);
|
||||
print '</td>';
|
||||
// Value
|
||||
print '<td>'; // Do not force class=right, or it align also the content of the select box
|
||||
print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -300,16 +300,16 @@ if ($action == 'create')
|
||||
|
||||
if (!empty($user->rights->accounting->fiscalyear->write))
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&token='.newToken().'&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
* \brief Setup page to configure journals
|
||||
*/
|
||||
|
||||
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
if (!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
|
||||
|
||||
@ -59,10 +59,10 @@ if (!$sortfield) $sortfield = "label";
|
||||
if (!$sortorder) $sortorder = "ASC";
|
||||
|
||||
$arrayfields = array(
|
||||
'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
'subaccount'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1),
|
||||
'label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
|
||||
'type'=>array('label'=>$langs->trans("Type"), 'checked'=>1),
|
||||
'reconcilable'=>array('label'=>$langs->trans("Reconcilable"), 'checked'=>1)
|
||||
);
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL < 2) unset($arrayfields['reconcilable']);
|
||||
@ -80,17 +80,17 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (!empty($cancel)) $action = '';
|
||||
if (!empty($cancel)) $action = '';
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_subaccount = "";
|
||||
$search_label = "";
|
||||
$search_type = "";
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All test are required to be compatible with all browsers
|
||||
{
|
||||
$search_subaccount = "";
|
||||
$search_label = "";
|
||||
$search_type = "";
|
||||
$search_array_options = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -273,13 +273,13 @@ if ($resql)
|
||||
print '<div class="warning">'.$langs->trans("WarningCreateSubAccounts").'</div>';
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
$moreforfilter = '';
|
||||
$massactionbutton = '';
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Line for search fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
@ -293,7 +293,7 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['subaccount']['checked'])) print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['label']['checked'])) print_liste_field_titre($arrayfields['label']['label'], $_SERVER["PHP_SELF"], "label", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['type']['checked'])) print_liste_field_titre($arrayfields['type']['label'], $_SERVER["PHP_SELF"], "type", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
|
||||
@ -57,80 +57,80 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $id;
|
||||
|
||||
/**
|
||||
* @var string Date of source document, in db date NOT NULL
|
||||
*/
|
||||
/**
|
||||
* @var string Date of source document, in db date NOT NULL
|
||||
*/
|
||||
public $doc_date;
|
||||
|
||||
/**
|
||||
* @var int Deadline for payment
|
||||
*/
|
||||
/**
|
||||
* @var int Deadline for payment
|
||||
*/
|
||||
public $date_lim_reglement;
|
||||
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $doc_type;
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $doc_type;
|
||||
|
||||
/**
|
||||
* @var string doc_ref
|
||||
*/
|
||||
/**
|
||||
* @var string doc_ref
|
||||
*/
|
||||
public $doc_ref;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_doc;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_docdet;
|
||||
|
||||
/**
|
||||
* @var string thirdparty code
|
||||
*/
|
||||
public $thirdparty_code;
|
||||
/**
|
||||
* @var string thirdparty code
|
||||
*/
|
||||
public $thirdparty_code;
|
||||
|
||||
/**
|
||||
* @var string subledger account
|
||||
*/
|
||||
/**
|
||||
* @var string subledger account
|
||||
*/
|
||||
public $subledger_account;
|
||||
|
||||
/**
|
||||
* @var string subledger label
|
||||
*/
|
||||
/**
|
||||
* @var string subledger label
|
||||
*/
|
||||
public $subledger_label;
|
||||
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
/**
|
||||
* @var string doc_type
|
||||
*/
|
||||
public $numero_compte;
|
||||
|
||||
/**
|
||||
* @var string label compte
|
||||
*/
|
||||
public $label_compte;
|
||||
/**
|
||||
* @var string label compte
|
||||
*/
|
||||
public $label_compte;
|
||||
|
||||
/**
|
||||
* @var string label operation
|
||||
*/
|
||||
public $label_operation;
|
||||
/**
|
||||
* @var string label operation
|
||||
*/
|
||||
public $label_operation;
|
||||
|
||||
/**
|
||||
* @var float FEC:Debit
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Debit
|
||||
*/
|
||||
public $debit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Credit
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Credit
|
||||
*/
|
||||
public $credit;
|
||||
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated Use $amount
|
||||
*/
|
||||
/**
|
||||
* @var float FEC:Amount (Not necessary)
|
||||
* @deprecated Use $amount
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
@ -138,34 +138,34 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var string FEC:Sens (Not necessary)
|
||||
*/
|
||||
/**
|
||||
* @var string FEC:Sens (Not necessary)
|
||||
*/
|
||||
public $sens;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_author;
|
||||
|
||||
/**
|
||||
* @var string key for import
|
||||
*/
|
||||
/**
|
||||
* @var string key for import
|
||||
*/
|
||||
public $import_key;
|
||||
|
||||
/**
|
||||
* @var string code journal
|
||||
*/
|
||||
/**
|
||||
* @var string code journal
|
||||
*/
|
||||
public $code_journal;
|
||||
|
||||
/**
|
||||
* @var string label journal
|
||||
*/
|
||||
/**
|
||||
* @var string label journal
|
||||
*/
|
||||
public $journal_label;
|
||||
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
/**
|
||||
* @var int accounting transaction id
|
||||
*/
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
@ -179,8 +179,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
@ -191,8 +191,8 @@ class BookKeeping extends CommonObject
|
||||
* @param bool $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
public function create(User $user, $notrigger = false)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -504,11 +504,11 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
@ -578,7 +578,7 @@ class BookKeeping extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.$mode.' (';
|
||||
@ -673,8 +673,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, 0 if not found, >0 if OK
|
||||
*/
|
||||
public function fetch($id, $ref = null, $mode = '')
|
||||
{
|
||||
public function fetch($id, $ref = null, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -771,8 +771,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
public function fetchAllByAccount($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -904,11 +904,11 @@ class BookKeeping extends CommonObject
|
||||
* @param int $offset Offset limit
|
||||
* @param array $filter Filter array
|
||||
* @param string $filtermode Filter mode (AND or OR)
|
||||
* @param int $showAlreadyExportMovements Show movements when field 'date_export' is not empty (0:No / 1:Yes (Default))
|
||||
* @param int $showAlreadyExportMovements Show movements when field 'date_export' is not empty (0:No / 1:Yes (Default))
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $showAlreadyExportMovements = 1)
|
||||
{
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND', $showAlreadyExportMovements = 1)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -940,7 +940,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.date_lim_reglement,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
@ -960,8 +960,8 @@ class BookKeeping extends CommonObject
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key.'\''.$this->db->idate($value).'\'';
|
||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} else {
|
||||
@ -970,9 +970,9 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
|
||||
if ($showAlreadyExportMovements == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if ($showAlreadyExportMovements == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND '.implode(' '.$filtermode.' ', $sqlwhere);
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ class BookKeeping extends CommonObject
|
||||
$line->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$line->date_lim_reglement = $this->db->jdate($obj->date_lim_reglement);
|
||||
$line->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
$line->date_export = $this->db->jdate($obj->date_export);
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
@ -1133,8 +1133,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode ('' or _tmp')
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function update(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function update(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -1300,8 +1300,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
public function delete(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
@ -1348,8 +1348,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $importkey Import key
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteByImportkey($importkey)
|
||||
{
|
||||
public function deleteByImportkey($importkey)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// first check if line not yet in bookkeeping
|
||||
@ -1379,11 +1379,11 @@ class BookKeeping extends CommonObject
|
||||
* @param int $delmonth Month
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||
{
|
||||
global $langs;
|
||||
public function deleteByYearAndJournal($delyear = 0, $journal = '', $mode = '', $delmonth = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if (empty($delyear) && empty($journal))
|
||||
if (empty($delyear) && empty($journal))
|
||||
{
|
||||
$this->error = 'ErrorOneFieldRequired';
|
||||
return -1;
|
||||
@ -1428,8 +1428,8 @@ class BookKeeping extends CommonObject
|
||||
* @param int $piecenum Piecenum to delete
|
||||
* @return int Result
|
||||
*/
|
||||
public function deleteMvtNum($piecenum)
|
||||
{
|
||||
public function deleteMvtNum($piecenum)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
@ -1463,8 +1463,8 @@ class BookKeeping extends CommonObject
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
public function createFromClone(User $user, $fromid)
|
||||
{
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
@ -1511,8 +1511,8 @@ class BookKeeping extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
global $user;
|
||||
|
||||
$now = dol_now();
|
||||
@ -1548,8 +1548,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
public function fetchPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT piece_num,doc_date,code_journal,journal_label,doc_ref,doc_type,date_creation";
|
||||
@ -1613,8 +1613,8 @@ class BookKeeping extends CommonObject
|
||||
* @param string $mode Mode
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function fetchAllPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
public function fetchAllPerMvt($piecenum, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
@ -1664,16 +1664,16 @@ class BookKeeping extends CommonObject
|
||||
return 1;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Export bookkeeping
|
||||
*
|
||||
* @param string $model Model
|
||||
* @return int Result
|
||||
*/
|
||||
public function export_bookkeeping($model = 'ebp')
|
||||
{
|
||||
// phpcs:enable
|
||||
public function export_bookkeeping($model = 'ebp')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT rowid, doc_date, doc_type,";
|
||||
@ -1739,10 +1739,10 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($direction == 0)
|
||||
if ($direction == 0)
|
||||
{
|
||||
$next_piecenum = $this->getNextNumMvt();
|
||||
$now = dol_now();
|
||||
$now = dol_now();
|
||||
|
||||
if ($next_piecenum < 0) {
|
||||
$error++;
|
||||
@ -1819,22 +1819,22 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
* Return list of accounts with label by chart of accounts
|
||||
*
|
||||
* @param string $selectid Preselected chart of accounts
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param array $event Event options
|
||||
* @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1)
|
||||
* @param int $select_out Set value returned by select 0=rowid (default), 1=account_number
|
||||
* @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
@ -1891,7 +1891,7 @@ class BookKeeping extends CommonObject
|
||||
return $out;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Description of a root accounting account
|
||||
*
|
||||
@ -1900,7 +1900,7 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function get_compte_racine($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
|
||||
@ -1932,16 +1932,16 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Description of accounting account
|
||||
*
|
||||
* @param string $account Accounting account
|
||||
* @return string Account desc
|
||||
*/
|
||||
public function get_compte_desc($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
public function get_compte_desc($account = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$pcgver = $conf->global->CHARTOFACCOUNTS;
|
||||
@ -1989,13 +1989,13 @@ class BookKeepingLine
|
||||
public $doc_ref;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_doc;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_docdet;
|
||||
|
||||
public $thirdparty_code;
|
||||
@ -2007,26 +2007,26 @@ class BookKeepingLine
|
||||
public $debit;
|
||||
public $credit;
|
||||
|
||||
/**
|
||||
* @var float Amount
|
||||
* @deprecated see $amount
|
||||
*/
|
||||
/**
|
||||
* @var float Amount
|
||||
* @deprecated see $amount
|
||||
*/
|
||||
public $montant;
|
||||
|
||||
/**
|
||||
* @var float Amount
|
||||
*/
|
||||
/**
|
||||
* @var float Amount
|
||||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var string Sens
|
||||
*/
|
||||
public $sens;
|
||||
public $lettering_code;
|
||||
/**
|
||||
* @var string Sens
|
||||
*/
|
||||
public $sens;
|
||||
public $lettering_code;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
* @var int ID
|
||||
*/
|
||||
public $fk_user_author;
|
||||
|
||||
public $import_key;
|
||||
@ -2035,17 +2035,17 @@ class BookKeepingLine
|
||||
public $piece_num;
|
||||
|
||||
/**
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
* @var integer|string date_creation
|
||||
*/
|
||||
public $date_creation;
|
||||
|
||||
/**
|
||||
* @var integer|string $date_modification;
|
||||
*/
|
||||
public $date_modification;
|
||||
public $date_modification;
|
||||
|
||||
/**
|
||||
* @var integer|string $date_export;
|
||||
*/
|
||||
public $date_export;
|
||||
/**
|
||||
* @var integer|string $date_export;
|
||||
*/
|
||||
public $date_export;
|
||||
}
|
||||
|
||||
@ -180,10 +180,10 @@ if ($result) {
|
||||
$account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word
|
||||
$account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word
|
||||
|
||||
$tabcompany = array();
|
||||
$tabuser = array();
|
||||
@ -970,8 +970,9 @@ if (empty($action) || $action == 'view') {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if ($obj->nb > 0)
|
||||
{
|
||||
print '<br>'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print '<br><div class="warning">'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount");
|
||||
print ' : '.$langs->trans("AccountancyAreaDescBank", 9, '<strong>'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'</strong>');
|
||||
print '</div>';
|
||||
}
|
||||
} else dol_print_error($db);
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
if ($object->error) {
|
||||
if ($object->error) {
|
||||
$errmsg = $object->error;
|
||||
} else {
|
||||
foreach ($object->errors as $error) {
|
||||
@ -128,13 +128,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent->cotisation->creer) {
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $adh->error;
|
||||
}
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent);
|
||||
exit;
|
||||
} else {
|
||||
$mesg = $adh->error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,7 +159,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$object->fetch($rowid);
|
||||
$object->fetch($rowid);
|
||||
$result = $adh->fetch($object->fk_adherent);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
@ -172,13 +172,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
print "\n";
|
||||
print "\n";
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
// Ref
|
||||
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td>';
|
||||
print '<td class="valeur" colspan="3">';
|
||||
print $form->showrefnav($object, 'rowid', $linkback, 1);
|
||||
print '</td></tr>';
|
||||
@ -195,24 +195,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ? GETPOST("typeid") : $object->fk_type));
|
||||
print'</td></tr>';
|
||||
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
// Date start subscription
|
||||
print '<tr><td>'.$langs->trans("DateSubscription").'</td><td class="valeur" colspan="2">';
|
||||
print $form->selectDate($object->dateh, 'datesub', 1, 1, 0, 'update', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
|
||||
// Date end subscription
|
||||
print '<tr><td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur" colspan="2">';
|
||||
print $form->selectDate($object->datef, 'datesubend', 0, 0, 0, 'update', 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="10" name="amount" value="'.price($object->amount).'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="2">';
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur" colspan="2">';
|
||||
print '<input type="text" class="flat" size="60" name="note" value="'.$object->note.'"></td></tr>';
|
||||
|
||||
// Bank line
|
||||
@ -234,11 +234,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') {
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print "\n";
|
||||
@ -251,69 +251,69 @@ if ($rowid && $action != 'edit') {
|
||||
*
|
||||
********************************************/
|
||||
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $object->fetch($rowid);
|
||||
$result = $adh->fetch($object->fk_adherent);
|
||||
|
||||
$head = subscription_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'general', $langs->trans("Subscription"), -1, 'payment');
|
||||
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete') {
|
||||
// Confirmation to delete subscription
|
||||
if ($action == 'delete') {
|
||||
//$formquestion=array();
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
//$formquestion['text']='<b>'.$langs->trans("ThisWillAlsoDeleteBankRecord").'</b>';
|
||||
$text = $langs->trans("ConfirmDeleteSubscription");
|
||||
if (!empty($conf->banque->enabled) && !empty($conf->global->ADHERENT_BANK_USE)) $text .= '<br>'.img_warning().' '.$langs->trans("ThisWillAlsoDeleteBankRecord");
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("DeleteSubscription"), $text, "confirm_delete", $formquestion, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/subscription/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
dol_banner_tab($object, 'rowid', $linkback, 1);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
// Member
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Member").'</td><td class="valeur">'.$adh->getNomUrl(1, 0, 'subscription').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ($object->fk_type > 0 || $adh->typeid > 0) {
|
||||
$typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
|
||||
$adht->fetch($typeid);
|
||||
print $adht->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("NoType");
|
||||
}
|
||||
print '</td></tr>';
|
||||
// Type
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">'.$langs->trans("Type").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ($object->fk_type > 0 || $adh->typeid > 0) {
|
||||
$typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid);
|
||||
$adht->fetch($typeid);
|
||||
print $adht->getNomUrl(1);
|
||||
} else {
|
||||
print $langs->trans("NoType");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
// Date subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateSubscription").'</td><td class="valeur">'.dol_print_date($object->dateh, 'day').'</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Date end subscription
|
||||
print '<tr>';
|
||||
// Date end subscription
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DateEndSubscription").'</td><td class="valeur">'.dol_print_date($object->datef, 'day').'</td>';
|
||||
print '</tr>';
|
||||
print '</tr>';
|
||||
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
// Amount
|
||||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur">'.price($object->amount).'</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur">'.$object->note.'</td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (!empty($conf->banque->enabled)) {
|
||||
@ -330,20 +330,20 @@ if ($rowid && $action != 'edit') {
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
if (!$bankline->rappro) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>";
|
||||
} else {
|
||||
@ -351,19 +351,19 @@ if ($rowid && $action != 'edit') {
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
// Delete
|
||||
if ($user->rights->adherent->cotisation->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"]."?rowid=".$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete")."</a></div>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
// Documents generes
|
||||
/*
|
||||
// Documents generes
|
||||
/*
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->facture->dir_output . '/' . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER['PHP_SELF'] . '?facid=' . $object->id;
|
||||
@ -375,23 +375,23 @@ if ($rowid && $action != 'edit') {
|
||||
*/
|
||||
// Show links to link elements
|
||||
//$linktoelem = $form->showLinkToObjectBlock($object, null, array('subscription'));
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
$somethingshown = $form->showLinkedObjectBlock($object, '');
|
||||
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
// Show links to link elements
|
||||
/*$linktoelem = $form->showLinkToObjectBlock($object,array('order'));
|
||||
if ($linktoelem) print ($somethingshown?'':'<br>').$linktoelem;
|
||||
*/
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
// List of actions on element
|
||||
/*
|
||||
// List of actions on element
|
||||
/*
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'invoice', $socid, 1);
|
||||
*/
|
||||
|
||||
print '</div></div></div>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -154,17 +154,20 @@ print "<br>";
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$getentity = ($conf->entity > 1 ? "&entity=".$conf->entity : "");
|
||||
|
||||
// Show message
|
||||
$message = '';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlvcal = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'vcal', $urlvcal);
|
||||
$message .= '<br>';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlical = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlical .=$urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', $urlical);
|
||||
$message .= '<br>';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$urlrss = '<a href="'.$urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : '...').'" target="_blank">';
|
||||
$urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity.'&exportkey='.($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY ?urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY) : 'KEYNOTDEFINED').'</a>';
|
||||
$message .= img_picto('', 'globe').' '.$langs->trans("WebCalUrlForVCalExport", 'rss', $urlrss);
|
||||
$message .= '<br>';
|
||||
$message .= '<br>';
|
||||
|
||||
@ -400,7 +400,7 @@ print '<tr class="liste_titre"><th class="titlefield wordbreak">'.$langs->trans(
|
||||
|
||||
// Name
|
||||
print '<tr class="oddeven"><td class="fieldrequired wordbreak"><label for="name">'.$langs->trans("CompanyName").'</label></td><td>';
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'></td></tr>'."\n";
|
||||
print '<input name="nom" id="name" class="minwidth200" value="'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM ? $conf->global->MAIN_INFO_SOCIETE_NOM : GETPOST("nom", 'nohtml')).'"'.(empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? ' autofocus="autofocus"' : '').'></td></tr>'."\n";
|
||||
|
||||
// Address
|
||||
print '<tr class="oddeven"><td><label for="MAIN_INFO_SOCIETE_ADDRESS">'.$langs->trans("CompanyAddress").'</label></td><td>';
|
||||
|
||||
@ -83,17 +83,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if ($action == 'setMAIN_ENABLE_DEFAULT_VALUES')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_DEFAULT_VALUES', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('actionmodify'))
|
||||
@ -102,57 +102,57 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac
|
||||
|
||||
if (($action == 'add' || (GETPOST('add') && $action != 'update')))
|
||||
{
|
||||
if (empty($defaulturl))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaultkey))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaulturl))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($defaultkey))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
if (empty($urlpage))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($key))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($urlpage))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (empty($key))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Field")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")";
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
}
|
||||
if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")";
|
||||
}
|
||||
if (GETPOST('actionmodify'))
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'";
|
||||
$sql .= " WHERE rowid = ".$id;
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
$defaulturl = '';
|
||||
$defaultkey = '';
|
||||
$defaultvalue = '';
|
||||
} else {
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -189,15 +189,15 @@ $param = '&mode='.$mode;
|
||||
$enabledisablehtml .= $langs->trans("EnableDefaultValues").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_DEFAULT_VALUES&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("DefaultValues"), $enabledisablehtml, 'title_setup');
|
||||
@ -228,7 +228,7 @@ dol_fiche_head($head, $mode, '', -1, '');
|
||||
|
||||
if ($mode == 'sortorder')
|
||||
{
|
||||
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
||||
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
||||
}
|
||||
if ($mode == 'mandatory')
|
||||
{
|
||||
@ -253,30 +253,30 @@ print_liste_field_titre($texturl, $_SERVER["PHP_SELF"], 'page,param', '', $param
|
||||
$texthelp = $langs->trans("TheKeyIsTheNameOfHtmlField");
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
} else {
|
||||
$texthelp = 'field or alias.field';
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
$texthelp = 'field or alias.field';
|
||||
$textkey = $form->textwithpicto($langs->trans("Field"), $texthelp);
|
||||
}
|
||||
print_liste_field_titre($textkey, $_SERVER["PHP_SELF"], 'param', '', $param, '', $sortfield, $sortorder);
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount')); // Must match list into GETPOST
|
||||
if ($mode != 'sortorder')
|
||||
{
|
||||
$substitutionarray = getCommonSubstitutionArray($langs, 2, array('object', 'objectamount')); // Must match list into GETPOST
|
||||
unset($substitutionarray['__USER_SIGNATURE__']);
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp .= $key.' -> '.$val.'<br>';
|
||||
}
|
||||
$textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||
} else {
|
||||
$texthelp = 'ASC or DESC';
|
||||
$textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp);
|
||||
}
|
||||
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'value', '', $param, '', $sortfield, $sortorder);
|
||||
$texthelp = $langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
foreach ($substitutionarray as $key => $val)
|
||||
{
|
||||
$texthelp .= $key.' -> '.$val.'<br>';
|
||||
}
|
||||
$textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip');
|
||||
} 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("Entity", $_SERVER["PHP_SELF"], 'entity,page', '', $param, '', $sortfield, $sortorder);
|
||||
@ -301,9 +301,9 @@ print '</td>';
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultvalue" value="">';
|
||||
print '</td>';
|
||||
}
|
||||
// Limit to superadmin
|
||||
if (!empty($conf->multicompany->enabled) && !$user->entity)
|
||||
@ -361,32 +361,32 @@ if ($result)
|
||||
// Value
|
||||
if ($mode != 'focus' && $mode != 'mandatory')
|
||||
{
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
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 dol_escape_htmltag($obj->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
print '</td>';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) print dol_escape_htmltag($obj->value);
|
||||
else print '<input type="text" name="value" value="'.dol_escape_htmltag($obj->value).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
// Actions
|
||||
print '<td class="center">';
|
||||
if ($action != 'edit' || GETPOST('rowid') != $obj->rowid)
|
||||
{
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=edit&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&mode='.$mode.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
} else {
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$id.'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
|
||||
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 '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$id.'">';
|
||||
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : 'none').'"></div>';
|
||||
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 '</td>';
|
||||
|
||||
@ -395,7 +395,7 @@ if ($result)
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'other', 'ecm'));
|
||||
@ -89,9 +89,9 @@ dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -113,9 +113,9 @@ if ($action == 'create') {
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
|
||||
|
||||
if (!$user->admin)
|
||||
accessforbidden();
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'other', 'ecm'));
|
||||
@ -89,9 +89,9 @@ dol_fiche_end();
|
||||
|
||||
// Buttons
|
||||
if ($action != 'create' && $action != 'edit') {
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
@ -102,9 +102,9 @@ if ($action != 'create' && $action != 'edit') {
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
@ -113,9 +113,9 @@ if ($action == 'create') {
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
if ($action == 'edit' && !empty($attrname)) {
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans("FieldEdition", $attrname));
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -330,10 +330,10 @@ if ($conf->use_javascript_ajax)
|
||||
$entry .= '</td></tr></table>';
|
||||
|
||||
$buttons = '<a class="editfielda marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons .= ' ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> ';
|
||||
$buttons .= ' ';
|
||||
$buttons .= '<a class="marginleftonly marginrightonly" href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&token='.newToken().'&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>';
|
||||
|
||||
$data[] = array(
|
||||
'rowid'=>$menu['rowid'],
|
||||
|
||||
@ -58,50 +58,50 @@ if (!$mode) $mode = 'setup';
|
||||
|
||||
if ($action == 'setconst' && $user->admin)
|
||||
{
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||
$setupconstarray = GETPOST('setupdriver', 'array');
|
||||
|
||||
foreach ($setupconstarray as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
foreach ($setupconstarray as $setupconst) {
|
||||
//print '<pre>'.print_r($setupconst, true).'</pre>';
|
||||
|
||||
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
$constname = dol_escape_htmltag($setupconst['varname']);
|
||||
$constvalue = dol_escape_htmltag($setupconst['value']);
|
||||
$consttype = dol_escape_htmltag($setupconst['type']);
|
||||
$constnote = dol_escape_htmltag($setupconst['note']);
|
||||
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
}
|
||||
$result = dolibarr_set_const($db, $constname, $constvalue, $consttype, 0, $constnote, $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'setvalue' && $user->admin)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
$result = dolibarr_set_const($db, $varname, $value, 'chaine', 0, '', $conf->entity);
|
||||
if (!$result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("SetupSaved"), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
|
||||
@ -131,275 +131,275 @@ if (GETPOST('error')) {
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
{
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("OAuthSetupForLogin")."</span><br><br>\n";
|
||||
|
||||
foreach ($list as $key)
|
||||
{
|
||||
$supported = 0;
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported = 1;
|
||||
if (!$supported) continue; // show only supported
|
||||
foreach ($list as $key)
|
||||
{
|
||||
$supported = 0;
|
||||
if (in_array($key[0], array_keys($supportedoauth2array))) $supported = 1;
|
||||
if (!$supported) continue; // show only supported
|
||||
|
||||
|
||||
$OAUTH_SERVICENAME = 'Unknown';
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'GitHub';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'Google';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if (!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
$OAUTH_SERVICENAME = 'Unknown';
|
||||
if ($key[0] == 'OAUTH_GITHUB_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'GitHub';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'user,public_repo';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://github.com/settings/applications/';
|
||||
} elseif ($key[0] == 'OAUTH_GOOGLE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'Google';
|
||||
// List of keys that will be converted into scopes (from constants 'SCOPE_state_in_uppercase' in file of service).
|
||||
// We pass this param list in to 'state' because we need it before and after the redirect.
|
||||
$shortscope = 'userinfo_email,userinfo_profile,cloud_print';
|
||||
if (!empty($conf->global->OAUTH_GSUITE)){
|
||||
$shortscope .= ',admin_directory_user';
|
||||
}
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeTest';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeLive';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
//$scope.=',gmail_full';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltocheckperms = 'https://security.google.com/settings/security/permissions';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeTest';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripetest_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} elseif ($key[0] == 'OAUTH_STRIPE_LIVE_NAME')
|
||||
{
|
||||
$OAUTH_SERVICENAME = 'StripeLive';
|
||||
$urltorenew = $urlwithroot.'/core/modules/oauth/stripelive_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php');
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
} else {
|
||||
$urltorenew = '';
|
||||
$urltodelete = '';
|
||||
$urltocheckperms = '';
|
||||
}
|
||||
|
||||
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
// Token
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try {
|
||||
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
// Return an error if token not found
|
||||
}
|
||||
// Show value of token
|
||||
$tokenobj = null;
|
||||
// Token
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
|
||||
// Dolibarr storage
|
||||
$storage = new DoliStorage($db, $conf);
|
||||
try {
|
||||
$tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME);
|
||||
} catch (Exception $e)
|
||||
{
|
||||
// Return an error if token not found
|
||||
}
|
||||
|
||||
// Set other properties
|
||||
$refreshtoken = false;
|
||||
$expiredat = '';
|
||||
// Set other properties
|
||||
$refreshtoken = false;
|
||||
$expiredat = '';
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if (is_object($tokenobj)) {
|
||||
$expire = ($tokenobj->getEndOfLife() !== $tokenobj::EOL_NEVER_EXPIRES && $tokenobj->getEndOfLife() !== $tokenobj::EOL_UNKNOWN && time() > ($tokenobj->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
if ($key[1] != '' && $key[2] != '') {
|
||||
if (is_object($tokenobj)) {
|
||||
$refreshtoken = $tokenobj->getRefreshToken();
|
||||
|
||||
$endoflife = $tokenobj->getEndOfLife();
|
||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
}
|
||||
}
|
||||
$endoflife = $tokenobj->getEndOfLife();
|
||||
if ($endoflife == $tokenobj::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $tokenobj::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$submit_enabled = 0;
|
||||
$submit_enabled = 0;
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=setup&driver='.$driver.'" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="setconst">';
|
||||
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th class="titlefieldcreate">'.$langs->trans($key[0]).'</th>';
|
||||
print '<th></th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("SeePreviousTab");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("OAuthIDSecret").'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("SeePreviousTab");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("IsTokenGenerated");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
|
||||
else print $langs->trans("NoAccessToken");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// Links to delete/checks token
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew)
|
||||
{
|
||||
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms)
|
||||
{
|
||||
print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("IsTokenGenerated");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
if (is_object($tokenobj)) print $langs->trans("HasAccessToken");
|
||||
else print $langs->trans("NoAccessToken");
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// Links to delete/checks token
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//test on $storage->hasAccessToken($OAUTH_SERVICENAME) ?
|
||||
print '<a class="button" href="'.$urltodelete.'">'.$langs->trans('DeleteAccess').'</a><br>';
|
||||
}
|
||||
// Request remote token
|
||||
if ($urltorenew)
|
||||
{
|
||||
print '<a class="button" href="'.$urltorenew.'">'.$langs->trans('RequestAccess').'</a><br>';
|
||||
}
|
||||
// Check remote access
|
||||
if ($urltocheckperms)
|
||||
{
|
||||
print '<br>'.$langs->trans("ToCheckDeleteTokenOnProvider", $OAUTH_SERVICENAME).': <a href="'.$urltocheckperms.'" target="_'.strtolower($OAUTH_SERVICENAME).'">'.$urltocheckperms.'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//var_dump($tokenobj);
|
||||
print $tokenobj->getAccessToken().'<br>';
|
||||
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
|
||||
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("Token").'</td>';
|
||||
print '<td colspan="2">';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
//var_dump($tokenobj);
|
||||
print $tokenobj->getAccessToken().'<br>';
|
||||
//print 'Refresh: '.$tokenobj->getRefreshToken().'<br>';
|
||||
//print 'EndOfLife: '.$tokenobj->getEndOfLife().'<br>';
|
||||
//var_dump($tokenobj->getExtraParams());
|
||||
/*print '<br>Extra: <br><textarea class="quatrevingtpercent">';
|
||||
print ''.join(',',$tokenobj->getExtraParams());
|
||||
print '</textarea>';*/
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
// Token refresh
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_REFRESH").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($refreshtoken);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if (is_object($tokenobj))
|
||||
{
|
||||
// Token refresh
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_REFRESH").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($refreshtoken);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Token expired
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($expire);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Token expired
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRED").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print yn($expire);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Token expired at
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
// Token expired at
|
||||
print '<tr class="oddeven">';
|
||||
print '<td'.($key['required'] ? ' class="required"' : '').'>';
|
||||
//var_dump($key);
|
||||
print $langs->trans("TOKEN_EXPIRE_AT").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $expiredat;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
if (!empty($driver))
|
||||
{
|
||||
if ($submit_enabled) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>';
|
||||
}
|
||||
}
|
||||
if (!empty($driver))
|
||||
{
|
||||
if ($submit_enabled) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Modify")).'"></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($mode == 'test' && $user->admin)
|
||||
{
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
print $langs->trans('PrintTestDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
if (!empty($driver))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
if (count($printer->getlistAvailablePrinters())) {
|
||||
if ($printer->listAvailablePrinters() == 0) {
|
||||
print $printer->resprint;
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('PleaseConfigureDriverfromList');
|
||||
}
|
||||
}
|
||||
print '<table class="noborder centpercent">';
|
||||
if (!empty($driver))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php';
|
||||
$classname = 'printing_'.$driver;
|
||||
$langs->load($driver);
|
||||
$printer = new $classname($db);
|
||||
//print '<pre>'.print_r($printer, true).'</pre>';
|
||||
if (count($printer->getlistAvailablePrinters())) {
|
||||
if ($printer->listAvailablePrinters() == 0) {
|
||||
print $printer->resprint;
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('PleaseConfigureDriverfromList');
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($mode == 'userconf' && $user->admin)
|
||||
{
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
print $langs->trans('PrintUserConfDesc'.$driver)."<br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
print '<th>'.$langs->trans("PrintDriver").'</th>';
|
||||
print '<th>'.$langs->trans("Printer").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterLocation").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterId").'</th>';
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("User").'</th>';
|
||||
print '<th>'.$langs->trans("PrintModule").'</th>';
|
||||
print '<th>'.$langs->trans("PrintDriver").'</th>';
|
||||
print '<th>'.$langs->trans("Printer").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterLocation").'</th>';
|
||||
print '<th>'.$langs->trans("PrinterId").'</th>';
|
||||
print '<th>'.$langs->trans("NumberOfCopy").'</th>';
|
||||
print '<th class="center">'.$langs->trans("Delete").'</th>';
|
||||
print "</tr>\n";
|
||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row = $db->fetch_array($resql)) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
print '<td>'.$row['driver'].'</td>';
|
||||
print '<td>'.$row['printer_name'].'</td>';
|
||||
print '<td>'.$row['printer_location'].'</td>';
|
||||
print '<td>'.$row['printer_id'].'</td>';
|
||||
print '<td>'.$row['copy'].'</td>';
|
||||
print '<td class="center">'.img_picto($langs->trans("Delete"), 'delete').'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -53,16 +53,16 @@ if (!$mode) $mode = 'config';
|
||||
|
||||
// used in library escpos maybe useful if php doesn't support gzdecode
|
||||
if (!function_exists('gzdecode')) {
|
||||
/**
|
||||
* Gzdecode
|
||||
*
|
||||
* @param string $data data to deflate
|
||||
* @return string data deflated
|
||||
*/
|
||||
function gzdecode($data)
|
||||
{
|
||||
return gzinflate(substr($data, 10, -8));
|
||||
}
|
||||
/**
|
||||
* Gzdecode
|
||||
*
|
||||
* @param string $data data to deflate
|
||||
* @return string data deflated
|
||||
*/
|
||||
function gzdecode($data)
|
||||
{
|
||||
return gzinflate(substr($data, 10, -8));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -71,167 +71,167 @@ if (!function_exists('gzdecode')) {
|
||||
*/
|
||||
|
||||
if ($action == 'addprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printername)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printername)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterNameEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (empty($parameter)) {
|
||||
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
|
||||
}
|
||||
if (empty($parameter)) {
|
||||
setEventMessages($langs->trans("PrinterParameterEmpty"), null, 'warnings');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addPrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterAdded", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterAdded", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'deleteprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->deletePrinter($printerid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->deletePrinter($printerid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterDeleted", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterDeleted", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'updateprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updatePrinter($printername, GETPOST('printertypeid', 'int'), GETPOST('printerprofileid', 'int'), $parameter, $printerid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterUpdated", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("PrinterUpdated", $printername), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'testprinter' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($printerid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// test
|
||||
$ret = $printer->sendTestToPrinter($printerid);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
// test
|
||||
$ret = $printer->sendTestToPrinter($printerid);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestSentToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'testtemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
// if (empty($printerid)) {
|
||||
// $error++;
|
||||
// setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
// }
|
||||
$error = 0;
|
||||
// if (empty($printerid)) {
|
||||
// $error++;
|
||||
// setEventMessages($langs->trans("PrinterIdEmpty"), null, 'errors');
|
||||
// }
|
||||
|
||||
// if (! $error) {
|
||||
// if (! $error) {
|
||||
// test
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$object = new Facture($db);
|
||||
//$object->initAsSpecimen();
|
||||
$object->fetch(18);
|
||||
//var_dump($object->lines);
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||
if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'updatetemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($templateid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($templateid)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateIdEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->updateTemplate($templatename, $template, $templateid);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateUpdated", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateUpdated", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'addtemplate' && $user->admin) {
|
||||
$error = 0;
|
||||
if (empty($templatename)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||
}
|
||||
$error = 0;
|
||||
if (empty($templatename)) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("TemplateNameEmpty"), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addTemplate($templatename, $template);
|
||||
if ($result > 0) $error++;
|
||||
if (!$error) {
|
||||
$db->begin();
|
||||
$result = $printer->addTemplate($templatename, $template);
|
||||
if ($result > 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateAdded", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
if (!$error) {
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("TemplateAdded", $templatename), null);
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'deletetemplate' && $user->admin) {
|
||||
@ -273,116 +273,116 @@ $head = receiptprinteradmin_prepare_head($mode);
|
||||
|
||||
// mode = config
|
||||
if ($mode == 'config' && $user->admin) {
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<input type="hidden" name="action" value="addprinter">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updateprinter">';
|
||||
}
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=config" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<input type="hidden" name="action" value="addprinter">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updateprinter">';
|
||||
}
|
||||
|
||||
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterDesc")."</span><br><br>\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Type").'</th>';
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listprinters();
|
||||
$nbofprinters = count($printer->listprinters);
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Type").'</th>';
|
||||
print '<th>'.$langs->trans("Profile").'</th>';
|
||||
print '<th>'.$langs->trans("Parameters").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listprinters();
|
||||
$nbofprinters = count($printer->listprinters);
|
||||
|
||||
if ($action != 'editprinter') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="printername"></td>';
|
||||
$ret = $printer->selectTypePrinter();
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter();
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||
print '<td class="right">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if ($action != 'editprinter') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="printername"></td>';
|
||||
$ret = $printer->selectTypePrinter();
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter();
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter"></td>';
|
||||
print '<td class="right">';
|
||||
if ($action != 'editprinter') {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
for ($line = 0; $line < $nbofprinters; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editprinter' && $printer->listprinters[$line]['rowid'] == $printerid) {
|
||||
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
|
||||
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||
print '<td>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_type_name']).'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||
// edit icon
|
||||
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
for ($line = 0; $line < $nbofprinters; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'editprinter' && $printer->listprinters[$line]['rowid'] == $printerid) {
|
||||
print '<input type="hidden" name="printerid" value="'.$printer->listprinters[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="printername" value="'.$printer->listprinters[$line]['name'].'"></td>';
|
||||
$ret = $printer->selectTypePrinter($printer->listprinters[$line]['fk_type']);
|
||||
print '<td>'.$printer->resprint.'</td>';
|
||||
$ret = $printer->selectProfilePrinter($printer->listprinters[$line]['fk_profile']);
|
||||
print '<td>'.$printer->profileresprint.'</td>';
|
||||
print '<td><input size="60" type="text" name="parameter" value="'.$printer->listprinters[$line]['parameter'].'"></td>';
|
||||
print '<td>';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinters[$line]['name'].'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_type_name']).'</td>';
|
||||
print '<td>'.$langs->trans($printer->listprinters[$line]['fk_profile_name']).'</td>';
|
||||
print '<td>'.$printer->listprinters[$line]['parameter'].'</td>';
|
||||
// edit icon
|
||||
print '<td class="right"><a class="editfielda marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=editprinter&printerid='.$printer->listprinters[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=deleteprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=config&action=testprinter&token='.newToken().'&printerid='.$printer->listprinters[$line]['rowid'].'&printername='.$printer->listprinters[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinter"), 'printer');
|
||||
print '</a></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterTypeDesc"), '', '')."\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").':</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
|
||||
print load_fiche_titre($langs->trans("ReceiptPrinterProfileDesc"), '', '')."\n";
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_DEFAULT").':</td><td>'.$langs->trans("PROFILE_DEFAULT_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_SIMPLE").':</td><td>'.$langs->trans("PROFILE_SIMPLE_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_EPOSTEP").':</td><td>'.$langs->trans("PROFILE_EPOSTEP_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_P822D").':</td><td>'.$langs->trans("PROFILE_P822D_HELP").'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("PROFILE_STAR").':</td><td>'.$langs->trans("PROFILE_STAR_HELP").'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
// mode = template
|
||||
@ -390,56 +390,56 @@ if ($mode == 'template' && $user->admin) {
|
||||
dol_fiche_head($head, $mode, $langs->trans("ModuleSetup"), -1, 'technic');
|
||||
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?mode=template" autocomplete="off">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="action" value="addtemplate">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||
}
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="action" value="addtemplate">';
|
||||
} else {
|
||||
print '<input type="hidden" name="action" value="updatetemplate">';
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Template").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listPrintersTemplates();
|
||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
$max = count($printer->listprinterstemplates);
|
||||
for ($line = 0; $line < $max; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||
// edit icon
|
||||
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
print '<th>'.$langs->trans("Template").'</th>';
|
||||
print '<th></th>';
|
||||
print "</tr>\n";
|
||||
$ret = $printer->listPrintersTemplates();
|
||||
//print '<pre>'.print_r($printer->listprinterstemplates, true).'</pre>';
|
||||
if ($ret > 0) {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
} else {
|
||||
$max = count($printer->listprinterstemplates);
|
||||
for ($line = 0; $line < $max; $line++) {
|
||||
print '<tr class="oddeven">';
|
||||
if ($action == 'edittemplate' && $printer->listprinterstemplates[$line]['rowid'] == $templateid) {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">'.$printer->listprinterstemplates[$line]['template'].'</textarea>';
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
} else {
|
||||
print '<td>'.$printer->listprinterstemplates[$line]['name'].'</td>';
|
||||
print '<td>'.nl2br(htmlentities($printer->listprinterstemplates[$line]['template'])).'</td>';
|
||||
// edit icon
|
||||
print '<td><a class="editfielda paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=edittemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print img_picto($langs->trans("Edit"), 'edit');
|
||||
print '</a>';
|
||||
// delete icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=deletetemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("Delete"), 'delete');
|
||||
print '</a>';
|
||||
// test icon
|
||||
print '<a class="paddingleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=template&action=testtemplate&templateid='.$printer->listprinterstemplates[$line]['rowid'].'&templatename='.$printer->listprinterstemplates[$line]['name'].'">';
|
||||
print img_picto($langs->trans("TestPrinterTemplate"), 'printer');
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($action != 'edittemplate') {
|
||||
print '<tr>';
|
||||
if ($action != 'edittemplate') {
|
||||
print '<tr>';
|
||||
print '<td><input size="50" type="text" name="templatename" value="'.$printer->listprinterstemplates[$line]['name'].'"></td>';
|
||||
print '<td>';
|
||||
print '<textarea name="template" wrap="soft" cols="120" rows="12">';
|
||||
@ -448,35 +448,35 @@ if ($mode == 'template' && $user->admin) {
|
||||
print '</td>';
|
||||
print '<td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
if ($action != 'edittemplate') {
|
||||
if ($action != 'edittemplate') {
|
||||
print '<input type="hidden" name="templateid" value="'.$printer->listprinterstemplates[$line]['rowid'].'">';
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Add")).'"></div>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans("Save")).'"></div>';
|
||||
}
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
print "</tr>\n";
|
||||
|
||||
$langs->loadLangs(array("bills", "companies"));
|
||||
foreach ($printer->tags as $key => $val) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><'.$key.'></td><td>'.$langs->trans($val).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
$langs->loadLangs(array("bills", "companies"));
|
||||
foreach ($printer->tags as $key => $val) {
|
||||
print '<tr class="oddeven">';
|
||||
print '<td><'.$key.'></td><td>'.$langs->trans($val).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -45,9 +45,9 @@ $upload_dir = $conf->admin->dir_temp;
|
||||
|
||||
if (GETPOST('sendit') && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
dol_add_file_process($upload_dir, 1, 0, 'userfile');
|
||||
dol_add_file_process($upload_dir, 1, 0, 'userfile');
|
||||
}
|
||||
|
||||
if ($action == 'updateform')
|
||||
@ -144,14 +144,14 @@ print '</td>';
|
||||
print '<td>';
|
||||
if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$basedir = preg_replace('/"/', '', dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
|
||||
$listdir = explode(';', ini_get('safe_mode_exec_dir'));
|
||||
if (!in_array($basedir, $listdir))
|
||||
{
|
||||
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
|
||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||
}
|
||||
$langs->load("errors");
|
||||
$basedir = preg_replace('/"/', '', dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
|
||||
$listdir = explode(';', ini_get('safe_mode_exec_dir'));
|
||||
if (!in_array($basedir, $listdir))
|
||||
{
|
||||
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
|
||||
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" class="minwidth500imp" value="'.(!empty($conf->global->MAIN_ANTIVIRUS_COMMAND) ?dol_escape_htmltag($conf->global->MAIN_ANTIVIRUS_COMMAND) : '').'">';
|
||||
if (defined('MAIN_ANTIVIRUS_COMMAND')) {
|
||||
|
||||
@ -155,19 +155,19 @@ print '<td class="tdtop">';
|
||||
print '<div id="div_container_exportoptions">';
|
||||
print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
|
||||
print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
|
||||
print '<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
|
||||
print '</div>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
|
||||
print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
|
||||
print '<label for="radio_dump_mysql_nobin">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
|
||||
print '</div>';
|
||||
} elseif (in_array($type, array('pgsql'))) {
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
|
||||
print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
|
||||
print '</div>';
|
||||
print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
|
||||
print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
|
||||
print '</div>';
|
||||
} else {
|
||||
print 'No method available with database '.$label;
|
||||
print 'No method available with database '.$label;
|
||||
}
|
||||
print '</fieldset>';
|
||||
print '</div>';
|
||||
@ -178,200 +178,200 @@ print '<td class="tdtop">';
|
||||
|
||||
print '<div id="div_container_sub_exportoptions">';
|
||||
if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print "<!-- Fieldset mysqldump -->\n";
|
||||
print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
|
||||
{
|
||||
$fullpathofmysqldump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofmysqldump = $conf->global->SYSTEMTOOLS_MYSQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</div>';
|
||||
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="NONE" selected>NONE</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '<option value="DB2">DB2</option>';
|
||||
print '<option value="MAXDB">MAXDB</option>';
|
||||
print '<option value="MYSQL323">MYSQL323</option>';
|
||||
print '<option value="MYSQL40">MYSQL40</option>';
|
||||
print '<option value="MSSQL">MSSQL</option>';
|
||||
print '<option value="ORACLE">ORACLE</option>';
|
||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="NONE" selected>NONE</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '<option value="DB2">DB2</option>';
|
||||
print '<option value="MAXDB">MAXDB</option>';
|
||||
print '<option value="MYSQL323">MYSQL323</option>';
|
||||
print '<option value="MYSQL40">MYSQL40</option>';
|
||||
print '<option value="MSSQL">MSSQL</option>';
|
||||
print '<option value="ORACLE">ORACLE</option>';
|
||||
print '<option value="POSTGRESQL">POSTGRESQL</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
||||
print '<label for="checkbox_use_quick">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '<input type="checkbox" name="use_mysql_quick_param" value="yes" id="checkbox_use_quick" />';
|
||||
print '<label for="checkbox_use_quick">';
|
||||
print $form->textwithpicto($langs->trans('ExportUseMySQLQuickParameter'), $langs->trans('ExportUseMySQLQuickParameterHelp'));
|
||||
print '</label>';
|
||||
print '<br/>';
|
||||
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
|
||||
print '<input type="checkbox" name="drop"'.((! GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '<input type="checkbox" name="drop"'.((! GETPOSTISSET("drop") || GETPOST('drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
|
||||
print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
|
||||
print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
|
||||
print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
|
||||
print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print "<!-- Fieldset mysql_nobin -->\n";
|
||||
print '<fieldset id="mysql_nobin_options">';
|
||||
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print "<!-- Fieldset mysql_nobin -->\n";
|
||||
print '<fieldset id="mysql_nobin_options">';
|
||||
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
|
||||
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
|
||||
|
||||
print '</div>';
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</fieldset>';
|
||||
print '</div>';
|
||||
if (!empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
|
||||
print '<div class="formelementrow">';
|
||||
print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
|
||||
print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
|
||||
print '</div>';
|
||||
}
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
|
||||
print '<input type="checkbox" name="nobin_drop"'.((! GETPOSTISSET("nobin_drop") || GETPOST('nobin_drop')) ? ' checked' : '').' id="checkbox_dump_drop" />';
|
||||
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("Datas").'</legend>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("Datas").'</legend>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
|
||||
print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
|
||||
print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
|
||||
print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
|
||||
print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
|
||||
print '<br>';
|
||||
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
}
|
||||
|
||||
if (in_array($type, array('pgsql'))) {
|
||||
print "<!-- Fieldset pg_dump -->\n";
|
||||
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
|
||||
print "<!-- Fieldset pg_dump -->\n";
|
||||
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
|
||||
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
|
||||
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
|
||||
$fullpathofpgdump = $db->getPathOfDump();
|
||||
} else {
|
||||
$fullpathofpgdump = $conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
|
||||
}
|
||||
print '<br>';
|
||||
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
|
||||
print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
|
||||
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
|
||||
print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
|
||||
print '<option value="ANSI">ANSI</option>';
|
||||
print '</select>';
|
||||
print '<br>';
|
||||
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
|
||||
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
|
||||
print '-->';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
|
||||
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
|
||||
print '</legend>';
|
||||
print '</fieldset>';
|
||||
print '<br>';
|
||||
print '<fieldset>';
|
||||
print '<legend>';
|
||||
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
|
||||
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
|
||||
print '</legend>';
|
||||
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
|
||||
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
|
||||
print '<br>';
|
||||
print '</fieldset>';
|
||||
print '</fieldset>';
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
@ -418,16 +418,16 @@ if (in_array($type, array('mysql', 'mysqli'))) {
|
||||
// 'id' => 'radio_compression_zip',
|
||||
// 'label' => $langs->trans("FormatZip")
|
||||
// );
|
||||
$compression['bz'] = array(
|
||||
$compression['bz'] = array(
|
||||
'function' => 'bzopen',
|
||||
'id' => 'radio_compression_bzip',
|
||||
'label' => $langs->trans("Bzip2")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
'id' => 'radio_compression_none',
|
||||
'label' => $langs->trans("None")
|
||||
);
|
||||
} else {
|
||||
$compression['none'] = array(
|
||||
'function' => '',
|
||||
@ -480,14 +480,14 @@ print '<br>';
|
||||
|
||||
if (!empty($_SESSION["commandbackuplastdone"]))
|
||||
{
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
|
||||
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
//print $paramclear;
|
||||
//print $paramclear;
|
||||
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
// Now show result
|
||||
print '<b>'.$langs->trans("BackupResult").':</b> ';
|
||||
print $_SESSION["commandbackupresult"];
|
||||
|
||||
$_SESSION["commandbackuplastdone"] = '';
|
||||
@ -568,20 +568,20 @@ $filecompression['zip'] = array('function' => 'dol_compress_dir', 'id' => 'radio
|
||||
$i = 0;
|
||||
foreach ($filecompression as $key => $val)
|
||||
{
|
||||
if (!$val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
} else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
if (!$val['function'] || function_exists($val['function'])) // Enabled export format
|
||||
{
|
||||
$checked = '';
|
||||
if ($key == 'gz') $checked = ' checked';
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'"'.$checked.'>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
} else // Disabled export format
|
||||
{
|
||||
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
|
||||
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("NotAvailable").')</span>';
|
||||
}
|
||||
print ' ';
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -73,16 +73,16 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$transkey = '';
|
||||
$transvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
$transkey = '';
|
||||
$transvalue = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
|
||||
if ($action == 'setMAIN_ENABLE_OVERWRITE_TRANSLATION')
|
||||
{
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||
if (GETPOST('value')) dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 1, 'chaine', 0, '', $conf->entity);
|
||||
else dolibarr_set_const($db, 'MAIN_ENABLE_OVERWRITE_TRANSLATION', 0, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if ($action == 'update')
|
||||
@ -139,25 +139,25 @@ if ($action == 'add')
|
||||
}
|
||||
if (!$error)
|
||||
{
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".$db->escape($conf->entity).")";
|
||||
$result = $db->query($sql);
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||
$action = "";
|
||||
$transkey = "";
|
||||
$transvalue = "";
|
||||
} else {
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAnEntryAlreadyExistForTransKey"), null, 'warnings');
|
||||
} else {
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
@ -196,15 +196,15 @@ $enabledisablehtml = '';
|
||||
$enabledisablehtml .= $langs->trans("EnableOverwriteTranslation").' ';
|
||||
if (empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button off, click to enable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=1'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
$enabledisablehtml .= '</a>';
|
||||
} else {
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
// Button on, click to disable
|
||||
$enabledisablehtml .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?action=setMAIN_ENABLE_OVERWRITE_TRANSLATION&token='.newToken().'&value=0'.$param.'">';
|
||||
$enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on');
|
||||
$enabledisablehtml .= '</a>';
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("Translation"), $enabledisablehtml, 'title_setup');
|
||||
@ -247,43 +247,43 @@ if ($mode == 'overwrite')
|
||||
if ($action == 'edit' || empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) $disablededit = ' disabled';
|
||||
|
||||
print '<div class="justify"><span class="opacitymedium">';
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print ' ('.$langs->trans("SeeAlso", '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>').')<br>';
|
||||
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||
print '</span></div>';
|
||||
print img_info().' '.$langs->trans("SomeTranslationAreUncomplete");
|
||||
$urlwikitranslatordoc = 'https://wiki.dolibarr.org/index.php/Translator_documentation';
|
||||
print ' ('.$langs->trans("SeeAlso", '<a href="'.$urlwikitranslatordoc.'" target="_blank">'.$langs->trans("Here").'</a>').')<br>';
|
||||
print $langs->trans("TranslationOverwriteDesc", $langs->transnoentitiesnoconv("Language"), $langs->transnoentitiesnoconv("Key"), $langs->transnoentitiesnoconv("NewTranslationStringToShow"))."\n";
|
||||
print ' ('.$langs->trans("TranslationOverwriteDesc2").').'."<br>\n";
|
||||
print '</span></div>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<input type="hidden" name="action" value="'.($action == 'edit' ? 'update' : 'add').'">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("NewTranslationStringToShow", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// Line to add new record
|
||||
print "\n";
|
||||
// Line to add new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue) ? $transvalue : "").'">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $formadmin->select_language(GETPOST('langcode'), 'langcode', 0, null, 1, 0, $disablededit ? 1 : 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone"'.$disablededit.' name="transkey" id="transkey" value="'.(!empty($transkey) ? $transkey : "").'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent"'.$disablededit.' name="transvalue" id="transvalue" value="'.(!empty($transvalue) ? $transvalue : "").'">';
|
||||
print '</td>';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
||||
@ -292,118 +292,118 @@ if ($mode == 'overwrite')
|
||||
}
|
||||
else
|
||||
{*/
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnabledTranslationOverwriteBefore")).'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
print '<td class="center">';
|
||||
print '<input type="hidden" name="entity" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '<input type="submit" class="button"'.$disabled.' value="'.$langs->trans("Add").'" name="add" title="'.dol_escape_htmltag($langs->trans("YouMustEnabledTranslationOverwriteBefore")).'">';
|
||||
print "</td>\n";
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Show constants
|
||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
// Show constants
|
||||
$sql = "SELECT rowid, entity, lang, transkey, transvalue";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE 1 = 1";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print "\n";
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
print '<td>'.$obj->lang.'</td>'."\n";
|
||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||
// 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' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
} else {
|
||||
print dol_escape_htmltag($obj->transvalue);
|
||||
}
|
||||
print '</td>';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.dol_escape_htmltag($obj->transvalue).'">';
|
||||
} else {
|
||||
print dol_escape_htmltag($obj->transvalue);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="submit" class="button buttongen" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button buttongen" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
} else {
|
||||
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print '<td class="center">';
|
||||
if ($action == 'edit' && $obj->rowid == GETPOST('rowid', 'int'))
|
||||
{
|
||||
print '<input type="hidden" class="button" name="rowid" value="'.$obj->rowid.'">';
|
||||
print '<input type="submit" class="button buttongen" name="save" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<input type="submit" class="button buttongen" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
} else {
|
||||
print '<a class="reposition editfielda paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=edit'.((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$obj->entity.'&action=delete&token='.newToken().((empty($user->entity) && $debug) ? '&debug=1' : '').'">'.img_delete().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print "</tr>\n";
|
||||
print "\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
if ($mode == 'searchkey')
|
||||
{
|
||||
$langcode = GETPOST('langcode') ?GETPOST('langcode') : $langs->defaultlang;
|
||||
$langcode = GETPOST('langcode') ?GETPOST('langcode') : $langs->defaultlang;
|
||||
|
||||
$newlang = new Translate('', $conf);
|
||||
$newlang->setDefaultLang($langcode);
|
||||
$newlang = new Translate('', $conf);
|
||||
$newlang->setDefaultLang($langcode);
|
||||
|
||||
$newlangfileonly = new Translate('', $conf);
|
||||
$newlangfileonly->setDefaultLang($langcode);
|
||||
$newlangfileonly = new Translate('', $conf);
|
||||
$newlangfileonly->setDefaultLang($langcode);
|
||||
|
||||
$recordtoshow = array();
|
||||
$recordtoshow = array();
|
||||
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
// Search modules dirs
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
$nbtotaloffiles = 0;
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
$nbtotaloffiles = 0;
|
||||
$nbempty = 0;
|
||||
/*var_dump($langcode);
|
||||
var_dump($transkey);
|
||||
var_dump($transvalue);*/
|
||||
if (empty($langcode) || $langcode == '-1') $nbempty++;
|
||||
if (empty($transkey)) $nbempty++;
|
||||
if (empty($transvalue)) $nbempty++;
|
||||
if ($action == 'search' && ($nbempty > 999)) // 999 to disable this
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
|
||||
} else {
|
||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||
$i = 0;
|
||||
foreach ($modulesdir as $keydir => $tmpsearchdir)
|
||||
{
|
||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||
if (empty($langcode) || $langcode == '-1') $nbempty++;
|
||||
if (empty($transkey)) $nbempty++;
|
||||
if (empty($transvalue)) $nbempty++;
|
||||
if ($action == 'search' && ($nbempty > 999)) // 999 to disable this
|
||||
{
|
||||
setEventMessages($langs->trans("WarningAtLeastKeyOrTranslationRequired"), null, 'warnings');
|
||||
} else {
|
||||
// Search into dir of modules (the $modulesdir is already a list that loop on $conf->file->dol_document_root)
|
||||
$i = 0;
|
||||
foreach ($modulesdir as $keydir => $tmpsearchdir)
|
||||
{
|
||||
$searchdir = $tmpsearchdir; // $searchdir can be '.../htdocs/core/modules/' or '.../htdocs/custom/mymodule/core/modules/'
|
||||
|
||||
// Directory of translation files
|
||||
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
|
||||
$dir_lang_osencoded = dol_osencode($dir_lang);
|
||||
// Directory of translation files
|
||||
$dir_lang = dirname(dirname($searchdir))."/langs/".$langcode; // The 2 dirname is to go up in dir for 2 levels
|
||||
$dir_lang_osencoded = dol_osencode($dir_lang);
|
||||
|
||||
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
foreach ($filearray as $file)
|
||||
{
|
||||
$filearray = dol_dir_list($dir_lang_osencoded, 'files', 0, '', '', $sortfield, (strtolower($sortorder) == 'asc' ?SORT_ASC:SORT_DESC), 1);
|
||||
foreach ($filearray as $file)
|
||||
{
|
||||
$tmpfile = preg_replace('/.lang/i', '', basename($file['name']));
|
||||
$moduledirname = (basename(dirname(dirname($dir_lang))));
|
||||
|
||||
@ -416,135 +416,135 @@ if ($mode == 'searchkey')
|
||||
if ($result < 0) print 'Failed to load language file '.$tmpfile.'<br>'."\n";
|
||||
else $nbtotaloffiles++;
|
||||
//print 'After loading lang '.$langkey.', newlang has '.count($newlang->tab_translate).' records<br>'."\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Now search into translation array
|
||||
foreach ($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) continue;
|
||||
if ($transvalue && !preg_match('/'.preg_quote($transvalue, '/').'/i', $val)) continue;
|
||||
$recordtoshow[$key] = $val;
|
||||
}
|
||||
}
|
||||
// Now search into translation array
|
||||
foreach ($newlang->tab_translate as $key => $val)
|
||||
{
|
||||
if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) continue;
|
||||
if ($transvalue && !preg_match('/'.preg_quote($transvalue, '/').'/i', $val)) continue;
|
||||
$recordtoshow[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
//print '<br>';
|
||||
$nbtotalofrecordswithoutfilters = count($newlang->tab_translate);
|
||||
$nbtotalofrecords = count($recordtoshow);
|
||||
$num = $limit + 1;
|
||||
if (($offset + $num) > $nbtotalofrecords) $num = $limit;
|
||||
//print '<br>';
|
||||
$nbtotalofrecordswithoutfilters = count($newlang->tab_translate);
|
||||
$nbtotalofrecords = count($recordtoshow);
|
||||
$num = $limit + 1;
|
||||
if (($offset + $num) > $nbtotalofrecords) $num = $limit;
|
||||
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
if ($nbtotalofrecords > 0) $title .= ' <span class="opacitymedium colorblack paddingleft">('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')</span>';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
//print 'param='.$param.' $_SERVER["PHP_SELF"]='.$_SERVER["PHP_SELF"].' num='.$num.' page='.$page.' nbtotalofrecords='.$nbtotalofrecords." sortfield=".$sortfield." sortorder=".$sortorder;
|
||||
$title = $langs->trans("TranslationKeySearch");
|
||||
if ($nbtotalofrecords > 0) $title .= ' <span class="opacitymedium colorblack paddingleft">('.$nbtotalofrecords.' / '.$nbtotalofrecordswithoutfilters.' - '.$nbtotaloffiles.' '.$langs->trans("Files").')</span>';
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
print '<input type="hidden" id="action" name="action" value="search">';
|
||||
print '<input type="hidden" id="mode" name="mode" value="'.$mode.'">';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Language_en_US_es_MX_etc", $_SERVER["PHP_SELF"], 'lang,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Key", $_SERVER["PHP_SELF"], 'transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("CurrentTranslationString", $_SERVER["PHP_SELF"], 'transvalue', '', $param, '', $sortfield, $sortorder);
|
||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre("Entity", $_SERVER["PHP_SELF"], 'entity,transkey', '', $param, '', $sortfield, $sortorder);
|
||||
print '<td align="center"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
// Line to search new record
|
||||
print "\n";
|
||||
// Line to search new record
|
||||
print "\n";
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print '<tr class="oddeven"><td>';
|
||||
//print $formadmin->select_language($langcode,'langcode',0,null,$langs->trans("All"),0,0,'',1);
|
||||
print $formadmin->select_language($langcode, 'langcode', 0, null, 0, 0, 0, 'maxwidthonsmartphone', 1);
|
||||
print '</td>'."\n";
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat maxwidthonsmartphone" name="transkey" value="'.$transkey.'">';
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="quatrevingtpercent" name="transvalue" value="'.$transvalue.'">';
|
||||
// Limit to superadmin
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '</td><td>';
|
||||
print '<input type="text" class="flat" size="1" name="entitysearch" value="'.$conf->entity.'">';
|
||||
}
|
||||
else
|
||||
{*/
|
||||
print '<input type="hidden" name="entitysearch" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="nowrap right">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<input type="hidden" name="entitysearch" value="'.$conf->entity.'">';
|
||||
//}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="nowrap right">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'asc') ksort($recordtoshow);
|
||||
if ($sortfield == 'transkey' && strtolower($sortorder) == 'desc') krsort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'asc') asort($recordtoshow);
|
||||
if ($sortfield == 'transvalue' && strtolower($sortorder) == 'desc') arsort($recordtoshow);
|
||||
|
||||
// Show result
|
||||
$i = 0;
|
||||
foreach ($recordtoshow as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($i <= $offset) continue;
|
||||
if ($i > ($offset + $limit)) break;
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td class="right nowraponall">';
|
||||
if (!empty($newlangfileonly->tab_translate[$key]))
|
||||
{
|
||||
if ($val != $newlangfileonly->tab_translate[$key])
|
||||
{
|
||||
// retrieve rowid
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE transkey = '".$key."'";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
}
|
||||
print '<a class="editfielda reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=edit">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
print ' ';
|
||||
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
|
||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
//print $key.'-'.$val;
|
||||
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.$langcode.'&transkey='.$key.'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
|
||||
}
|
||||
// Show result
|
||||
$i = 0;
|
||||
foreach ($recordtoshow as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($i <= $offset) continue;
|
||||
if ($i > ($offset + $limit)) break;
|
||||
print '<tr class="oddeven"><td>'.$langcode.'</td><td>'.$key.'</td><td>';
|
||||
print dol_escape_htmltag($val);
|
||||
print '</td><td class="right nowraponall">';
|
||||
if (!empty($newlangfileonly->tab_translate[$key]))
|
||||
{
|
||||
if ($val != $newlangfileonly->tab_translate[$key])
|
||||
{
|
||||
// retrieve rowid
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||
$sql .= " WHERE transkey = '".$key."'";
|
||||
$sql .= " AND entity IN (".getEntity('overwrite_trans').")";
|
||||
dol_syslog("translation::select from table", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
}
|
||||
print '<a class="editfielda reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=edit">'.img_edit().'</a>';
|
||||
print ' ';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
||||
print ' ';
|
||||
$htmltext = $langs->trans("OriginalValueWas", '<i>'.$newlangfileonly->tab_translate[$key].'</i>');
|
||||
print $form->textwithpicto('', $htmltext, 1, 'info');
|
||||
} elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION))
|
||||
{
|
||||
//print $key.'-'.$val;
|
||||
print '<a class="reposition paddingrightonly" href="'.$_SERVER['PHP_SELF'].'?mode=overwrite&langcode='.$langcode.'&transkey='.$key.'">'.img_edit_add($langs->trans("Overwrite")).'</a>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$transifexlangfile = '$'; // $ means 'All'
|
||||
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
||||
if (!empty($conf->global->MAIN_FEATURES_LEVEL))
|
||||
{
|
||||
$transifexlangfile = '$'; // $ means 'All'
|
||||
//$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?key='.$key;
|
||||
$transifexurl = 'https://www.transifex.com/dolibarr-association/dolibarr/translate/#'.$langcode.'/'.$transifexlangfile.'?q=key%3A'.$key;
|
||||
|
||||
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto($langs->trans('FixOnTransifex'), 'globe').'</a>';
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
print ' <a href="'.$transifexurl.'" target="transifex">'.img_picto($langs->trans('FixOnTransifex'), 'globe').'</a>';
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
/*if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||
{
|
||||
print '<td>'.$val.'</td>';
|
||||
}*/
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -124,252 +124,252 @@ $sourceList = array();
|
||||
// Actions add or modify a website
|
||||
if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
$listfield = explode(',', $tabfield[$id]);
|
||||
$listfieldinsert = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldmodify = explode(',', $tabfieldinsert[$id]);
|
||||
$listfieldvalue = explode(',', $tabfieldvalue[$id]);
|
||||
$listfield = explode(',', $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 ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
// Check that all fields are filled
|
||||
$ok = 1;
|
||||
foreach ($listfield as $f => $value)
|
||||
{
|
||||
if ($value == 'ref' && (!GETPOSTISSET($value) || GETPOST($value) == ''))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
} elseif ($value == 'ref' && !preg_match('/^[a-z0-9_\-\.]+$/i', $_POST[$value]))
|
||||
{
|
||||
$ok = 0;
|
||||
$fieldnamekey = $listfield[$f];
|
||||
setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clean parameters
|
||||
if (!empty($_POST['ref']))
|
||||
{
|
||||
$websitekey = strtolower($_POST['ref']);
|
||||
}
|
||||
// Clean parameters
|
||||
if (!empty($_POST['ref']))
|
||||
{
|
||||
$websitekey = strtolower($_POST['ref']);
|
||||
}
|
||||
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
// Si verif ok et action add, on ajoute la ligne
|
||||
if ($ok && GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/* $website=new Website($db);
|
||||
/* $website=new Website($db);
|
||||
$website->ref=
|
||||
$website->description=
|
||||
$website->virtualhost=
|
||||
$website->create($user); */
|
||||
|
||||
// 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 .= ",status)";
|
||||
$sql .= " VALUES(";
|
||||
// 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 .= ",status)";
|
||||
$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 ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= ",1)";
|
||||
// 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 ($value == 'ref') {
|
||||
$_POST[$listfieldvalue[$i]] = strtolower($_POST[$listfieldvalue[$i]]);
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
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');
|
||||
unset($_POST); // 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
dol_syslog("actionadd", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) // Add is ok
|
||||
{
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
unset($_POST); // 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', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
// Si verif ok et action modify, on modifie la ligne
|
||||
if ($ok && GETPOST('actionmodify', 'alpha'))
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$website = new Website($db);
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$website->fetch($rowid);
|
||||
$website = new Website($db);
|
||||
$rowid = GETPOST('rowid', 'int');
|
||||
$website->fetch($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 == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = ".((int) $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 == 'entity') {
|
||||
$_POST[$listfieldvalue[$i]] = $conf->entity;
|
||||
}
|
||||
if ($i) $sql .= ",";
|
||||
$sql .= $field."=";
|
||||
if ($_POST[$listfieldvalue[$i]] == '') $sql .= "null";
|
||||
else $sql .= "'".$db->escape($_POST[$listfieldvalue[$i]])."'";
|
||||
$i++;
|
||||
}
|
||||
$sql .= " WHERE ".$rowidcol." = ".((int) $rowid);
|
||||
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
||||
dol_syslog("actionmodify", LOG_DEBUG);
|
||||
//print $sql;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$newname = dol_sanitizeFileName(GETPOST('ref', 'aZ09'));
|
||||
if ($newname != $website->ref)
|
||||
{
|
||||
$srcfile = DOL_DATA_ROOT.'/website/'.$website->ref;
|
||||
$destfile = DOL_DATA_ROOT.'/website/'.$newname;
|
||||
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors');
|
||||
} else {
|
||||
@rename($srcfile, $destfile);
|
||||
if (dol_is_dir($destfile))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorDirAlreadyExists', $destfile), null, 'errors');
|
||||
} else {
|
||||
@rename($srcfile, $destfile);
|
||||
|
||||
// We must now rename $website->ref into $newname inside files
|
||||
$arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html');
|
||||
$listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$');
|
||||
// We must now rename $website->ref into $newname inside files
|
||||
$arrayreplacement = array($website->ref.'/htmlheader.html' => $newname.'/htmlheader.html');
|
||||
$listofilestochange = dol_dir_list($destfile, 'files', 0, '\.php$');
|
||||
foreach ($listofilestochange as $key => $value)
|
||||
{
|
||||
dolReplaceInFile($value['fullname'], $arrayreplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
{
|
||||
dolReplaceInFile($value['fullname'], $arrayreplacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
}
|
||||
|
||||
if (GETPOST('actioncancel', 'alpha'))
|
||||
{
|
||||
//$_GET["id"]=GETPOST('id', 'int'); // Force affichage dictionnaire en cours d'edition
|
||||
//$_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"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
$website = new Website($db);
|
||||
$website->fetch($rowid);
|
||||
$website = new Website($db);
|
||||
$website->fetch($rowid);
|
||||
|
||||
if ($website->id > 0)
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if ($website->id > 0)
|
||||
{
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_account WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_page WHERE fk_website = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website_extrafields WHERE fk_object = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
$sql = "DELETE from ".MAIN_DB_PREFIX."website WHERE rowid = ".((int) $rowid);
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
|
||||
{
|
||||
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
if ($website->ref)
|
||||
{
|
||||
dol_delete_dir_recursive($conf->website->dir_output.'/'.$website->ref);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, 'Failed to load website with id '.$rowid);
|
||||
}
|
||||
if ($website->ref)
|
||||
{
|
||||
dol_delete_dir_recursive($conf->website->dir_output.'/'.$website->ref);
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db, 'Failed to load website with id '.$rowid);
|
||||
}
|
||||
}
|
||||
|
||||
// activate
|
||||
if ($action == $acts[0])
|
||||
{
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
if ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 1 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$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 ($tabrowid[$id]) { $rowidcol = $tabrowid[$id]; } else { $rowidcol = "rowid"; }
|
||||
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
if ($rowid) {
|
||||
$sql = "UPDATE ".$tabname[$id]." SET status = 0 WHERE rowid = ".((int) $rowid);
|
||||
}
|
||||
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
$result = $db->query($sql);
|
||||
if (!$result)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -411,7 +411,7 @@ 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, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1, 220);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid, $langs->trans('DeleteWebsite'), $langs->trans('ConfirmDeleteWebsite'), 'confirm_delete', '', 0, 1, 220);
|
||||
}
|
||||
//var_dump($elementList);
|
||||
|
||||
@ -420,205 +420,205 @@ if ($action == 'delete')
|
||||
*/
|
||||
if ($id)
|
||||
{
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
// Complete requete recherche valeurs avec critere de tri
|
||||
$sql = $tabsql[$id];
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused = 0;
|
||||
$var = false;
|
||||
// Form to add a new line
|
||||
if ($tabname[$id])
|
||||
{
|
||||
$alabelisused = 0;
|
||||
$var = false;
|
||||
|
||||
$fieldlist = explode(',', $tabfield[$id]);
|
||||
$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 = '';
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td class="'.$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>';
|
||||
elseif (!empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
// 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 = '';
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($valuetoshow != '')
|
||||
{
|
||||
print '<td class="'.$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>';
|
||||
elseif (!empty($tabhelp[$id][$value]))
|
||||
{
|
||||
if ($value == 'virtualhost') print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltipvirtual');
|
||||
else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value]);
|
||||
} else print $valuetoshow;
|
||||
print '</td>';
|
||||
}
|
||||
if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') $alabelisused = 1;
|
||||
}
|
||||
|
||||
print '<td colspan="4">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<td colspan="4">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
// Line to enter new values
|
||||
print "<tr ".$bcnd[$var].">";
|
||||
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val, 'alpha'))
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
$obj = new stdClass();
|
||||
// If data was already input, we define them in obj to populate input fields.
|
||||
if (GETPOST('actionadd', 'alpha'))
|
||||
{
|
||||
foreach ($fieldlist as $key=>$val)
|
||||
{
|
||||
if (GETPOST($val, 'alpha'))
|
||||
$obj->$val = GETPOST($val);
|
||||
}
|
||||
}
|
||||
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
fieldListWebsites($fieldlist, $obj, $tabname[$id], 'add');
|
||||
|
||||
print '<td colspan="3" class="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
print '<td colspan="3" class="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>";
|
||||
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
$colspan = count($fieldlist) + 2;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
|
||||
// List of websites in database
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<br>';
|
||||
// List of websites in database
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
// Title of lines
|
||||
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
|
||||
$showfield = 1; // Par defaut
|
||||
$align = "left";
|
||||
$sortable = 1;
|
||||
$valuetoshow = '';
|
||||
/*
|
||||
// Title of lines
|
||||
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
|
||||
$showfield = 1; // Par 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]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
$valuetoshow = ucfirst($fieldlist[$field]); // Par defaut
|
||||
$valuetoshow = $langs->trans($valuetoshow); // try to translate
|
||||
if ($fieldlist[$field] == 'lang') { $valuetoshow = $langs->trans("Language"); }
|
||||
if ($fieldlist[$field] == 'type') { $valuetoshow = $langs->trans("Type"); }
|
||||
if ($fieldlist[$field] == 'code') { $valuetoshow = $langs->trans("Code"); }
|
||||
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
// Affiche nom du champ
|
||||
if ($showfield)
|
||||
{
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), "", "align=".$align, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "status", ($page ? 'page='.$page.'&' : ''), "", 'align="center"', $sortfield, $sortorder);
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
print getTitleFieldOfList('');
|
||||
print getTitleFieldOfList('');
|
||||
print '</tr>';
|
||||
|
||||
// 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('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
// 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('editWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist, $obj, $tabname[$id], 'edit');
|
||||
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewWebsiteFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
$error = $hookmanager->error; $errors = $hookmanager->errors;
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$fieldname = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$fieldname;
|
||||
if (empty($reshook))
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$showfield = 1;
|
||||
$align = "left";
|
||||
$fieldname = $fieldlist[$field];
|
||||
$valuetoshow = $obj->$fieldname;
|
||||
|
||||
// Show value for field
|
||||
if ($showfield) print '<td align="'.$align.'">'.$valuetoshow.'</td>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $isdisable = 1; // true by default
|
||||
if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first.
|
||||
// Can an entry be erased or disabled ?
|
||||
$iserasable = 1; $isdisable = 1; // true by default
|
||||
if ($obj->status) $iserasable = 0; // We can't delete a website on. Disable it first.
|
||||
|
||||
$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) : '').'&';
|
||||
$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) : '').'&';
|
||||
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
||||
print "</td>";
|
||||
// Active
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a class="reposition" href="'.$url.'action='.$acts[($obj->status ? 1 : 0)].'">'.$actl[($obj->status ? 1 : 0)].'</a>';
|
||||
print "</td>";
|
||||
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
|
||||
// Modify link
|
||||
print '<td align="center"><a class="reposition" href="'.$url.'action=edit&token='.newToken().'">'.img_edit().'</a></td>';
|
||||
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
|
||||
else print '<td class="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
// Delete link
|
||||
if ($iserasable) print '<td align="center"><a class="reposition" href="'.$url.'action=delete&token='.newToken().'">'.img_delete().'</a></td>';
|
||||
else print '<td class="center">'.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</form>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
dol_fiche_end();
|
||||
@ -649,7 +649,7 @@ function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '')
|
||||
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
$fieldname = $fieldlist[$field];
|
||||
$fieldname = $fieldlist[$field];
|
||||
if ($fieldlist[$field] == 'lang')
|
||||
{
|
||||
print '<td>';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -111,21 +111,21 @@ print '</td>';
|
||||
if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||
print '<td class="linecoledit center">';
|
||||
$coldisplay++;
|
||||
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
|
||||
} else {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
if (($line->info_bits & 2) == 2 || !empty($disableedit)) {
|
||||
} else {
|
||||
print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=editline&lineid='.$line->id.'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="linecoldelete center">';
|
||||
$coldisplay++;
|
||||
if (($line->fk_prev_id == null) && empty($disableremove)) {
|
||||
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="linecoldelete center">';
|
||||
$coldisplay++;
|
||||
if (($line->fk_prev_id == null) && empty($disableremove)) {
|
||||
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&action=deleteline&token='.newToken().'&lineid='.$line->id.'">';
|
||||
print img_delete();
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
|
||||
print '<td class="linecolmove tdlineupdown center">';
|
||||
@ -146,14 +146,14 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') {
|
||||
$coldisplay++;
|
||||
}
|
||||
} else {
|
||||
print '<td colspan="3"></td>';
|
||||
$coldisplay = $coldisplay + 3;
|
||||
print '<td colspan="3"></td>';
|
||||
$coldisplay = $coldisplay + 3;
|
||||
}
|
||||
|
||||
if ($action == 'selectlines') {
|
||||
print '<td class="linecolcheck center">';
|
||||
print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
|
||||
print '</td>';
|
||||
print '<td class="linecolcheck center">';
|
||||
print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i + 1).']" value="'.$line->id.'" >';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
@ -44,8 +44,8 @@ $confirm = GETPOST('confirm');
|
||||
|
||||
if ($id == '' && $label == '')
|
||||
{
|
||||
dol_print_error('', 'Missing parameter id');
|
||||
exit();
|
||||
dol_print_error('', 'Missing parameter id');
|
||||
exit();
|
||||
}
|
||||
|
||||
// Security check
|
||||
@ -70,34 +70,34 @@ if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backwar
|
||||
|
||||
if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && $_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id) {
|
||||
$file = $_FILES['userfile'];
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if (empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]))
|
||||
{
|
||||
setEventMessage($file['name'][$i].' : '.$langs->trans(empty($file['tmp_name'][$i]) ? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
unset($file['name'][$i], $file['type'][$i], $file['tmp_name'][$i], $file['error'][$i], $file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($object->id) {
|
||||
$file = $_FILES['userfile'];
|
||||
if (is_array($file['name']) && count($file['name']) > 0)
|
||||
{
|
||||
foreach ($file['name'] as $i => $name)
|
||||
{
|
||||
if (empty($file['tmp_name'][$i]) || intval($conf->global->MAIN_UPLOAD_DOC) * 1000 <= filesize($file['tmp_name'][$i]))
|
||||
{
|
||||
setEventMessage($file['name'][$i].' : '.$langs->trans(empty($file['tmp_name'][$i]) ? 'ErrorFailedToSaveFile' : 'MaxSizeForUploadedFiles'));
|
||||
unset($file['name'][$i], $file['type'][$i], $file['tmp_name'][$i], $file['error'][$i], $file['size'][$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($file['tmp_name'])) {
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
}
|
||||
if (!empty($file['tmp_name'])) {
|
||||
$object->add_photo($upload_dir, $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer)
|
||||
{
|
||||
$object->delete_photo($upload_dir."/".$_GET["file"]);
|
||||
$object->delete_photo($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
if ($action == 'addthumb' && $_GET["file"])
|
||||
{
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
$object->addThumbs($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +126,7 @@ if ($object->id)
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
foreach ($ways as $way)
|
||||
{
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
@ -137,7 +137,7 @@ if ($object->id)
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type.'&file='.$_GET["file"], $langs->trans('DeletePicture'), $langs->trans('ConfirmDeletePicture'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
@ -159,7 +159,7 @@ if ($object->id)
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -213,62 +213,62 @@ if ($object->id)
|
||||
|
||||
if (is_array($listofphoto) && count($listofphoto))
|
||||
{
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center">';
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center">';
|
||||
|
||||
foreach ($listofphoto as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
foreach ($listofphoto as $key => $obj)
|
||||
{
|
||||
$nbphoto++;
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100 / $nbbyrow).'%" class="photo">';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$obj['photo']).'" alt="Taille origine" target="_blank">';
|
||||
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename = $obj['photo_vignette'];
|
||||
} else {
|
||||
$filename = $obj['photo'];
|
||||
}
|
||||
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
|
||||
if ($obj['photo_vignette'])
|
||||
{
|
||||
$filename = $obj['photo_vignette'];
|
||||
} else {
|
||||
$filename = $obj['photo'];
|
||||
}
|
||||
|
||||
// Nom affiche
|
||||
$viewfilename = $obj['photo'];
|
||||
// Nom affiche
|
||||
$viewfilename = $obj['photo'];
|
||||
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
// Taille de l'image
|
||||
$object->get_image_size($dir.$filename);
|
||||
$imgWidth = ($object->imgWidth < $maxWidth) ? $object->imgWidth : $maxWidth;
|
||||
$imgHeight = ($object->imgHeight < $maxHeight) ? $object->imgHeight : $maxHeight;
|
||||
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
print '<img border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename).'">';
|
||||
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
print '</a>';
|
||||
print '<br>'.$viewfilename;
|
||||
print '<br>';
|
||||
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer)
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
}
|
||||
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100 / $nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100 / $nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($nbphoto < 1)
|
||||
@ -277,7 +277,7 @@ if ($object->id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print $langs->trans("ErrorUnknown");
|
||||
print $langs->trans("ErrorUnknown");
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -83,43 +83,43 @@ $cancel != $langs->trans("Cancel") &&
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
// check parameters
|
||||
$forcelangprod = GETPOST('forcelangprod', 'alpha');
|
||||
$libelle = GETPOST('libelle', 'alpha');
|
||||
$desc = GETPOST('desc', 'restricthtml');
|
||||
$forcelangprod = GETPOST('forcelangprod', 'alpha');
|
||||
$libelle = GETPOST('libelle', 'alpha');
|
||||
$desc = GETPOST('desc', 'restricthtml');
|
||||
|
||||
if (empty($forcelangprod)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Translation'));
|
||||
}
|
||||
if (empty($forcelangprod)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Translation'));
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$forcelangprod).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
if (!$error) {
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$forcelangprod).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// update de l'objet
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
}
|
||||
if (!$error) {
|
||||
// update de l'objet
|
||||
if ($forcelangprod == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
$object->description = dol_htmlcleanlastbr($desc);
|
||||
} else {
|
||||
$object->multilangs[$forcelangprod]["label"] = $libelle;
|
||||
$object->multilangs[$forcelangprod]["description"] = dol_htmlcleanlastbr($desc);
|
||||
}
|
||||
|
||||
// sauvegarde en base
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
}
|
||||
// sauvegarde en base
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'add';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
if ($error) {
|
||||
$action = 'add';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Validation de l'edition
|
||||
@ -132,13 +132,13 @@ $cancel != $langs->trans("Cancel") &&
|
||||
|
||||
foreach ($object->multilangs as $key => $value) // enregistrement des nouvelles valeurs dans l'objet
|
||||
{
|
||||
$libelle = GETPOST('libelle-'.$key, 'alpha');
|
||||
$desc = GETPOST('desc-'.$key);
|
||||
$libelle = GETPOST('libelle-'.$key, 'alpha');
|
||||
$desc = GETPOST('desc-'.$key);
|
||||
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$key).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
if (empty($libelle)) {
|
||||
$error++;
|
||||
$object->errors[] = $langs->trans('Language_'.$key).' : '.$langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Label'));
|
||||
}
|
||||
|
||||
if ($key == $current_lang) {
|
||||
$object->label = $libelle;
|
||||
@ -149,17 +149,17 @@ $cancel != $langs->trans("Cancel") &&
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
if (!$error) {
|
||||
$res = $object->setMultiLangs($user);
|
||||
if ($res < 0) $error++;
|
||||
}
|
||||
|
||||
if ($error) {
|
||||
$action = 'edit';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
if ($error) {
|
||||
$action = 'edit';
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -181,10 +181,10 @@ $head = categories_prepare_head($object, $type);
|
||||
$cnt_trans = 0;
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
}
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$cnt_trans++;
|
||||
}
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'translation', $langs->trans($title), -1, 'category');
|
||||
@ -195,7 +195,7 @@ $object->ref = $object->label;
|
||||
$morehtmlref = '<br><div class="refidno"><a href="'.DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type.'">'.$langs->trans("Root").'</a> >> ';
|
||||
$ways = $object->print_all_ways(" >> ", '', 1);
|
||||
foreach ($ways as $way) {
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
$morehtmlref .= $way."<br>\n";
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
@ -238,11 +238,11 @@ print "\n<div class=\"tabsAction\">\n";
|
||||
|
||||
if ($action == '')
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
|
||||
if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=add&id='.$object->id.'&type='.$type.'">'.$langs->trans('Add').'</a>';
|
||||
if ($cnt_trans > 0) print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$object->id.'&type='.$type.'">'.$langs->trans('Update').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
@ -258,20 +258,20 @@ if ($action == 'edit')
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="vedit">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Label
|
||||
$libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
|
||||
$libelle = (GETPOST('libelle-'.$key, 'alpha') ? GETPOST('libelle-'.$key, 'alpha') : $object->multilangs[$key]['label']);
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$libelle.'"></td></tr>';
|
||||
// Desc
|
||||
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
|
||||
$desc = (GETPOST('desc-'.$key) ? GETPOST('desc-'.$key) : $object->multilangs[$key]['description']);
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';
|
||||
$doleditor = new DolEditor("desc-$key", $desc, '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, ROWS_3, '90%');
|
||||
$doleditor->Create();
|
||||
@ -293,20 +293,20 @@ if ($action == 'edit')
|
||||
print '</form>';
|
||||
} elseif ($action != 'add')
|
||||
{
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
if ($cnt_trans) print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
if (!empty($object->multilangs))
|
||||
if (!empty($object->multilangs))
|
||||
{
|
||||
foreach ($object->multilangs as $key => $value)
|
||||
{
|
||||
$s = picto_from_langcode($key);
|
||||
$s = picto_from_langcode($key);
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.($s ? $s.' ' : '')." <b>".$langs->trans('Language_'.$key).":</b> ".'<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&langtodelete='.$key.'&type='.$type.'">'.img_delete('', '').'</a></td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Label').'</td><td>'.$object->multilangs[$key]["label"].'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Description').'</td><td>'.$object->multilangs[$key]["description"].'</td></tr>';
|
||||
if (!empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION))
|
||||
{
|
||||
print '<tr><td>'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>'.$object->multilangs[$key]["other"].'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Other').' ('.$langs->trans("NotUsed").')</td><td>'.$object->multilangs[$key]["other"].'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
@ -329,11 +329,11 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="vadd">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
print '<input type="hidden" name="type" value="'.$type.'">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<tr><td class="titlefield fieldrequired">'.$langs->trans('Translation').'</td><td>';
|
||||
print $formadmin->select_language(GETPOST('forcelangprod', 'alpha'), 'forcelangprod', 0, $object->multilangs);
|
||||
print $formadmin->select_language(GETPOST('forcelangprod', 'alpha'), 'forcelangprod', 0, $object->multilangs);
|
||||
print '</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td>';
|
||||
print '<td><input name="libelle" class="minwidth200 maxwidth300" value="'.GETPOST('libelle', 'alpha').'"></td></tr>';
|
||||
|
||||
@ -138,12 +138,12 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// customer preferred shipping method
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
if ($action == 'setshippingmethod' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// assujetissement a la TVA
|
||||
if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
@ -191,31 +191,31 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Set sales representatives
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
if ($action == 'set_salesrepresentatives' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setSalesRep(GETPOST('commercial', 'array'));
|
||||
}
|
||||
|
||||
if ($action == 'update_extras') {
|
||||
$object->fetch($id);
|
||||
$object->fetch($id);
|
||||
|
||||
$object->oldcopy = dol_clone($object);
|
||||
$object->oldcopy = dol_clone($object);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) $error++;
|
||||
if (!$error)
|
||||
{
|
||||
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
||||
// Fill array 'array_options' with data from update form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
|
||||
if ($ret < 0) $error++;
|
||||
if (!$error)
|
||||
{
|
||||
$result = $object->insertExtraFields('COMPANY_MODIFY');
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -249,11 +249,11 @@ if ($object->id > 0)
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Prospect/Customer
|
||||
@ -262,16 +262,16 @@ if ($object->id > 0)
|
||||
print '</td></tr>';
|
||||
|
||||
// Prefix
|
||||
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
|
||||
print ($object->prefix_comm ? $object->prefix_comm : ' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td>';
|
||||
print ($object->prefix_comm ? $object->prefix_comm : ' ');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
$langs->load("compta");
|
||||
$langs->load("compta");
|
||||
|
||||
print '<tr><td>';
|
||||
print $langs->trans('CustomerCode').'</td><td>';
|
||||
@ -386,64 +386,64 @@ if ($object->id > 0)
|
||||
// Relative discounts (Discounts-Drawbacks-Rebates)
|
||||
if ($isCustomer)
|
||||
{
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
|
||||
print '</tr>';
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerRelativeDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td><td>'.($object->remise_percent ? '<a href="'.DOL_URL_ROOT.'/comm/remise.php?id='.$object->id.'">'.$object->remise_percent.'%</a>' : '').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount = $object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db, $object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
// Absolute discounts (Discounts-Drawbacks-Rebates)
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding">';
|
||||
print '<tr><td class="nowrap">';
|
||||
print $langs->trans("CustomerAbsoluteDiscountShort");
|
||||
print '<td><td class="right">';
|
||||
if ($user->rights->societe->creer && !$user->socid > 0)
|
||||
{
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.img_edit($langs->trans("Modify")).'</a>';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$amount_discount = $object->getAvailableDiscounts();
|
||||
if ($amount_discount < 0) dol_print_error($db, $object->error);
|
||||
if ($amount_discount > 0) print '<a href="'.DOL_URL_ROOT.'/comm/remx.php?id='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?socid='.$object->id).'">'.price($amount_discount, 1, $langs, 1, -1, -1, $conf->currency).'</a>';
|
||||
//else print $langs->trans("DiscountNone");
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Max outstanding bill
|
||||
if ($object->client)
|
||||
{
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
$limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount';
|
||||
print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->rights->societe->creer, $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($object->client)
|
||||
{
|
||||
if (!empty($conf->commande->enabled) && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT))
|
||||
{
|
||||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '<!-- Minimim amount for orders -->'."\n";
|
||||
print '<tr class="nowrap">';
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer);
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("OrderMinAmount", 'order_min_amount', $object->order_min_amount, $object, $user->rights->societe->creer, $limit_field_type, ($object->order_min_amount != '' ? price($object->order_min_amount) : ''));
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,24 +468,24 @@ if ($object->id > 0)
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Preferred shipping Method
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
// Preferred shipping Method
|
||||
if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '<td>';
|
||||
if (($action != 'editshipping') && $user->rights->societe->creer) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshipping&socid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshipping')
|
||||
{
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none');
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
|
||||
@ -500,70 +500,70 @@ if ($object->id > 0)
|
||||
$parameters = array('socid'=>$object->id);
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
// Sales representative
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
// Module Adherent
|
||||
if (!empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
// Module Adherent
|
||||
if (!empty($conf->adherent->enabled))
|
||||
{
|
||||
$langs->load("members");
|
||||
$langs->load("users");
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td>';
|
||||
$adh = new Adherent($db);
|
||||
$result = $adh->fetch('', '', $object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '<tr><td class="titlefield">'.$langs->trans("LinkedToDolibarrMember").'</td>';
|
||||
print '<td>';
|
||||
$adh = new Adherent($db);
|
||||
$result = $adh->fetch('', '', $object->id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$adh->ref = $adh->getFullName($langs);
|
||||
print $adh->getNomUrl(1);
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans("ThirdpartyNotLinkedToMember").'</span>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
// Prospection level and status
|
||||
if ($object->client == 2 || $object->client == 3)
|
||||
{
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Level of prospection
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editlevel')
|
||||
{
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
|
||||
} else {
|
||||
print $object->getLibProspLevel();
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
// Level of prospection
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td class="right"><a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'), 1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editlevel')
|
||||
{
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1);
|
||||
} else {
|
||||
print $object->getLibProspLevel();
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Status of prospection
|
||||
$object->loadCacheOfProspStatus();
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||
print ' ';
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
// Status of prospection
|
||||
$object->loadCacheOfProspStatus();
|
||||
print '<tr><td>'.$langs->trans("StatusProsp").'</td><td>'.$object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||
print ' ';
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm&token='.newToken().'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
|
||||
}
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
@ -670,9 +670,9 @@ if ($object->id > 0)
|
||||
$langs->load("propal");
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht";
|
||||
$sql .= ", p.tva as total_tva";
|
||||
$sql .= ", p.total as total_ttc";
|
||||
$sql .= ", p.ref, p.ref_client, p.remise";
|
||||
$sql .= ", p.tva as total_tva";
|
||||
$sql .= ", p.total as total_ttc";
|
||||
$sql .= ", p.ref, p.ref_client, p.remise";
|
||||
$sql .= ", p.datep as dp, p.fin_validite as date_limit";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c";
|
||||
$sql .= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
|
||||
@ -686,17 +686,17 @@ if ($object->id > 0)
|
||||
$propal_static = new Propal($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastPropals", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->id.'">'.$langs->trans("AllPropals").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
@ -704,17 +704,17 @@ if ($object->id > 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
$propal_static->id = $objp->propalid;
|
||||
$propal_static->ref = $objp->ref;
|
||||
$propal_static->ref_client = $objp->ref_client;
|
||||
$propal_static->total_ht = $objp->total_ht;
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '<td class="nowrap">';
|
||||
$propal_static->id = $objp->propalid;
|
||||
$propal_static->ref = $objp->ref;
|
||||
$propal_static->ref_client = $objp->ref_client;
|
||||
$propal_static->total_ht = $objp->total_ht;
|
||||
$propal_static->total_tva = $objp->total_tva;
|
||||
$propal_static->total_ttc = $objp->total_ttc;
|
||||
print $propal_static->getNomUrl(1);
|
||||
if (($db->jdate($objp->date_limit) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == $propal_static::STATUS_VALIDATED) {
|
||||
print " ".img_warning();
|
||||
}
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dp), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
print '<td class="right" style="min-width: 60px" class="nowrap">'.$propal_static->LibStatut($objp->fk_statut, 5).'</td></tr>';
|
||||
@ -737,12 +737,12 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
$sql .= ", c.rowid as cid, c.total_ht";
|
||||
$sql .= ", c.tva as total_tva";
|
||||
$sql .= ", c.total_ttc";
|
||||
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
|
||||
$sql .= ", c.date_commande as dc";
|
||||
$sql = "SELECT s.nom, s.rowid";
|
||||
$sql .= ", c.rowid as cid, c.total_ht";
|
||||
$sql .= ", c.tva as total_tva";
|
||||
$sql .= ", c.total_ttc";
|
||||
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
|
||||
$sql .= ", c.date_commande as dc";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid ";
|
||||
$sql .= " AND s.rowid = ".$object->id;
|
||||
@ -795,8 +795,8 @@ if ($object->id > 0)
|
||||
$commande_static->billed = $objp->billed;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '<td class="nowrap">';
|
||||
print $commande_static->getNomUrl(1);
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->dc), 'day')."</td>\n";
|
||||
print '<td class="right" style="min-width: 60px">'.price($objp->total_ht).'</td>';
|
||||
print '<td class="right" style="min-width: 60px" class="nowrap">'.$commande_static->LibStatut($objp->fk_statut, $objp->facture, 5).'</td></tr>';
|
||||
@ -814,78 +814,78 @@ if ($object->id > 0)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Latest shipments
|
||||
*/
|
||||
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut as statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid as socid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND e.entity IN (".getEntity('expedition').")";
|
||||
$sql .= ' GROUP BY e.rowid';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid';
|
||||
$sql .= " ORDER BY e.date_creation DESC";
|
||||
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
$sql = 'SELECT e.rowid as id';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut as statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid as socid';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."expedition as e";
|
||||
$sql .= " WHERE e.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND e.entity IN (".getEntity('expedition').")";
|
||||
$sql .= ' GROUP BY e.rowid';
|
||||
$sql .= ', e.ref';
|
||||
$sql .= ', e.date_creation';
|
||||
$sql .= ', e.fk_statut';
|
||||
$sql .= ', s.nom';
|
||||
$sql .= ', s.rowid';
|
||||
$sql .= " ORDER BY e.date_creation DESC";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sendingstatic = new Expedition($db);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$sendingstatic = new Expedition($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastSendings", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/expedition/list.php?socid='.$object->id.'">'.$langs->trans("AllSendings").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/expedition/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$i = 0;
|
||||
while ($i < $num && $i < $MAXLIST)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$sendingstatic->id = $objp->id;
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
$sendingstatic->id = $objp->id;
|
||||
$sendingstatic->ref = $objp->ref;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">';
|
||||
print $sendingstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if ($objp->date_creation > 0) {
|
||||
print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>';
|
||||
} else {
|
||||
print '<td class="right"><b>!!!</b></td>';
|
||||
}
|
||||
|
||||
print '<td class="nowrap right" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
print '<td class="nowrap right" width="100" >'.$sendingstatic->LibStatut($objp->statut, 5).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
$db->free($resql);
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
if ($num > 0)
|
||||
{
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Latest contracts
|
||||
@ -910,7 +910,7 @@ if ($object->id > 0)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td>';
|
||||
print '<td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
//print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
|
||||
@ -987,7 +987,7 @@ if ($object->id > 0)
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").'<span class="badge marginleftonlyshort">'.$num.'</span></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
@ -1000,11 +1000,11 @@ if ($object->id > 0)
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$fichinter_static->id = $objp->id;
|
||||
$fichinter_static->statut = $objp->fk_statut;
|
||||
$fichinter_static->statut = $objp->fk_statut;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap"><a href="'.DOL_URL_ROOT.'/fichinter/card.php?id='.$objp->id.'">'.img_object($langs->trans("ShowPropal"), "propal").' '.$objp->ref.'</a></td>'."\n";
|
||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||
//print '<td class="right" width="80px">'.dol_print_date($db->jdate($objp->startdate)).'</td>'."\n";
|
||||
print '<td class="right" style="min-width: 60px">'.convertSecondToTime($objp->duration).'</td>'."\n";
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.$fichinter_static->getLibStatut(5).'</td>'."\n";
|
||||
print '</tr>';
|
||||
@ -1130,10 +1130,10 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
$sql .= ', f.datef as df, f.datec as dc, f.paye as paye, f.fk_statut as statut';
|
||||
$sql .= ', s.nom, s.rowid as socid';
|
||||
$sql .= ', SUM(pf.amount) as am';
|
||||
@ -1159,7 +1159,7 @@ if ($object->id > 0)
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="5"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomersBills", ($num <= $MAXLIST ? "" : $MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllBills").'<span class="badge marginleftonlyshort">'.$num.'</span></a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '<td width="20px" class="right"><a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"), 'stats').'</a></td>';
|
||||
print '</tr></table></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1192,9 +1192,9 @@ if ($object->id > 0)
|
||||
|
||||
if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES))
|
||||
{
|
||||
print '<td class="right" style="min-width: 60px">';
|
||||
print price($objp->total_ttc);
|
||||
print '</td>';
|
||||
print '<td class="right" style="min-width: 60px">';
|
||||
print price($objp->total_ttc);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="nowrap right" style="min-width: 60px">'.($facturestatic->LibStatut($objp->paye, $objp->statut, 5, $objp->am)).'</td>';
|
||||
@ -1228,79 +1228,79 @@ if ($object->id > 0)
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->status != 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($object->status != 1)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyIsClosed")).'" href="#">'.$langs->trans("ThirdPartyIsClosed").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propal->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("propal");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/propal/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddProp").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("orders");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddOrder").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->contrat->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
if ($user->rights->contrat->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("contracts");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/contrat/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddContract").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->creer && $object->status == 1)
|
||||
{
|
||||
$langs->load("fichinter");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddIntervention").'</a></div>';
|
||||
}
|
||||
|
||||
// Add invoice
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if (!empty($conf->deplacement->enabled) && $object->status == 1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
// Add invoice
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if (!empty($conf->deplacement->enabled) && $object->status == 1)
|
||||
{
|
||||
$langs->load("trips");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/deplacement/card.php?socid='.$object->id.'&action=create">'.$langs->trans("AddTrip").'</a></div>';
|
||||
}
|
||||
|
||||
if (!empty($conf->facture->enabled) && $object->status == 1)
|
||||
{
|
||||
if (empty($user->rights->facture->creer))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
$langs->loadLangs(array("orders", "bills"));
|
||||
if (!empty($conf->facture->enabled) && $object->status == 1)
|
||||
{
|
||||
if (empty($user->rights->facture->creer))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
$langs->loadLangs(array("orders", "bills"));
|
||||
|
||||
if (!empty($conf->commande->enabled))
|
||||
{
|
||||
if ($object->client != 0 && $object->client != 2) {
|
||||
if (!empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
if (!empty($conf->commande->enabled))
|
||||
{
|
||||
if ($object->client != 0 && $object->client != 2) {
|
||||
if (!empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'&search_billed=0&autoselectall=1">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
} else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
|
||||
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($object->client != 0 && $object->client != 2) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add action
|
||||
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add action
|
||||
if (!empty($conf->agenda->enabled) && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1)
|
||||
{
|
||||
if ($user->rights->agenda->myactions->create)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAction").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddAction").'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -1310,14 +1310,14 @@ if ($object->id > 0)
|
||||
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
|
||||
// List of todo actions
|
||||
// List of todo actions
|
||||
show_actions_todo($conf, $langs, $db, $object);
|
||||
|
||||
// List of done actions
|
||||
// List of done actions
|
||||
show_actions_done($conf, $langs, $db, $object);
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -426,7 +426,7 @@ if ($object->fetch($id) >= 0) {
|
||||
print $form->showrefnav($object, 'id', $linkback);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
|
||||
|
||||
|
||||
@ -465,13 +465,13 @@ if (empty($reshook))
|
||||
$object->email_from = GETPOST("from");
|
||||
$object->email_replyto = GETPOST("replyto");
|
||||
$object->email_errorsto = GETPOST("errorsto");
|
||||
$object->titre = GETPOST("titre");
|
||||
$object->title = GETPOST("title");
|
||||
$object->sujet = GETPOST("sujet");
|
||||
$object->body = GETPOST("bodyemail", 'restricthtml');
|
||||
$object->bgcolor = GETPOST("bgcolor");
|
||||
$object->bgimage = GETPOST("bgimage");
|
||||
|
||||
if (!$object->titre) {
|
||||
if (!$object->title) {
|
||||
$mesgs[] = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
|
||||
}
|
||||
if (!$object->sujet) {
|
||||
@ -496,16 +496,16 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Action update description of emailing
|
||||
if ($action == 'settitre' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
if ($action == 'settitle' || $action == 'setemail_from' || $action == 'setreplyto' || $action == 'setemail_errorsto')
|
||||
{
|
||||
$upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing');
|
||||
|
||||
if ($action == 'settitre') $object->titre = trim(GETPOST('titre', 'alpha'));
|
||||
if ($action == 'settitle') $object->title = trim(GETPOST('title', 'alpha'));
|
||||
elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from', 'alpha'));
|
||||
elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto', 'alpha'));
|
||||
elseif ($action == 'setemail_errorsto') {
|
||||
$object->email_errorsto = trim(GETPOST('email_errorsto', 'alpha'));
|
||||
} elseif ($action == 'settitre' && empty($object->titre)) {
|
||||
} elseif ($action == 'settitle' && empty($object->title)) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTitle"));
|
||||
} elseif ($action == 'setfrom' && empty($object->email_from)) {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom"));
|
||||
@ -854,9 +854,9 @@ if ($action == 'create')
|
||||
|
||||
// Description
|
||||
print '<tr><td class="titlefield">';
|
||||
print $form->editfieldkey("MailTitle", 'titre', $object->titre, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print $form->editfieldkey("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("MailTitle", 'titre', $object->titre, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print $form->editfieldval("MailTitle", 'title', $object->title, $object, $user->rights->mailing->creer && $object->statut < 3, 'string');
|
||||
print '</td></tr>';
|
||||
|
||||
// From
|
||||
@ -1144,7 +1144,7 @@ if ($action == 'create')
|
||||
*/
|
||||
|
||||
// Topic
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
// From
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailFrom").'</td><td colspan="3">'.dol_print_email($object->email_from, 0, 0, 0, 0, 1).'</td></tr>';
|
||||
// To
|
||||
|
||||
@ -237,7 +237,7 @@ if ($object->fetch($id) >= 0)
|
||||
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->titre.'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("MailTitle").'</td><td colspan="3">'.$object->title.'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans("MailFrom").'</td><td colspan="3">';
|
||||
$emailarray = CMailFile::getArrayAddress($object->email_from);
|
||||
|
||||
@ -46,7 +46,7 @@ class Mailing extends CommonObject
|
||||
*/
|
||||
public $picto = 'email';
|
||||
|
||||
public $titre;
|
||||
public $title;
|
||||
public $sujet;
|
||||
public $body;
|
||||
public $nbemail;
|
||||
@ -115,7 +115,7 @@ class Mailing extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$this->titre = trim($this->titre);
|
||||
$this->title = trim($this->title);
|
||||
$this->email_from = trim($this->email_from);
|
||||
|
||||
if (!$this->email_from)
|
||||
@ -130,9 +130,9 @@ class Mailing extends CommonObject
|
||||
$sql .= " (date_creat, fk_user_creat, entity)";
|
||||
$sql .= " VALUES ('".$this->db->idate($now)."', ".$user->id.", ".$conf->entity.")";
|
||||
|
||||
if (!$this->titre)
|
||||
if (!$this->title)
|
||||
{
|
||||
$this->titre = $langs->trans("NoTitle");
|
||||
$this->title = $langs->trans("NoTitle");
|
||||
}
|
||||
|
||||
dol_syslog("Mailing::Create", LOG_DEBUG);
|
||||
@ -167,7 +167,7 @@ class Mailing extends CommonObject
|
||||
public function update($user)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing ";
|
||||
$sql .= " SET titre = '".$this->db->escape($this->titre)."'";
|
||||
$sql .= " SET titre = '".$this->db->escape($this->title)."'";
|
||||
$sql .= ", sujet = '".$this->db->escape($this->sujet)."'";
|
||||
$sql .= ", body = '".$this->db->escape($this->body)."'";
|
||||
$sql .= ", email_from = '".$this->db->escape($this->email_from)."'";
|
||||
@ -198,7 +198,7 @@ class Mailing extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT m.rowid, m.titre, m.sujet, m.body, m.bgcolor, m.bgimage";
|
||||
$sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage";
|
||||
$sql .= ", m.email_from, m.email_replyto, m.email_errorsto";
|
||||
$sql .= ", m.statut, m.nbemail";
|
||||
$sql .= ", m.fk_user_creat, m.fk_user_valid";
|
||||
@ -221,7 +221,7 @@ class Mailing extends CommonObject
|
||||
$this->ref = $obj->rowid;
|
||||
$this->statut = $obj->statut;
|
||||
$this->nbemail = $obj->nbemail;
|
||||
$this->titre = $obj->titre;
|
||||
$this->title = $obj->title;
|
||||
|
||||
$this->sujet = $obj->sujet;
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML401))) {
|
||||
@ -283,7 +283,7 @@ class Mailing extends CommonObject
|
||||
$object->statut = 0;
|
||||
|
||||
// Clear fields
|
||||
$object->titre = $langs->trans("CopyOf").' '.$object->titre.' '.dol_print_date(dol_now());
|
||||
$object->title = $langs->trans("CopyOf").' '.$object->title.' '.dol_print_date(dol_now());
|
||||
|
||||
// If no option copy content
|
||||
if (empty($option1))
|
||||
|
||||
@ -182,7 +182,7 @@ if ($result) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$mailstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.dol_trunc($obj->titre, 38).'</td>';
|
||||
print '<td>'.dol_trunc($obj->title, 38).'</td>';
|
||||
print '<td class="center">'.dol_print_date($db->jdate($obj->date_creat), 'day').'</td>';
|
||||
print '<td class="center">'.($obj->nbemail ? $obj->nbemail : "0").'</td>';
|
||||
print '<td class="right">'.$mailstatic->LibStatut($obj->statut, 5).'</td>';
|
||||
|
||||
@ -238,7 +238,7 @@ if ($resql)
|
||||
print $email->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$obj->titre.'</td>';
|
||||
print '<td>'.$obj->title.'</td>';
|
||||
// Date creation
|
||||
|
||||
print '<td class="center">';
|
||||
|
||||
@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
*/
|
||||
class Proposals extends DolibarrApi
|
||||
{
|
||||
/**
|
||||
/**
|
||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||
*/
|
||||
static $FIELDS = array(
|
||||
@ -65,60 +65,60 @@ class Proposals extends DolibarrApi
|
||||
*/
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
return $this->_fetch($id, '', '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
/**
|
||||
* Get properties of an proposal object by ref
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref Ref of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref/{ref}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRef($ref, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', $ref, '', $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object by ref_ext
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
/**
|
||||
* Get properties of an proposal object by ref_ext
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @url GET ref_ext/{ref_ext}
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
public function getByRefExt($ref_ext, $contact_list = 1)
|
||||
{
|
||||
return $this->_fetch('', '', $ref_ext, $contact_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties of an proposal object
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
/**
|
||||
* Get properties of an proposal object
|
||||
*
|
||||
* Return an array with proposal informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param string $ref Ref of object
|
||||
* @param string $ref_ext External reference of object
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
private function _fetch($id, $ref = '', $ref_ext = '', $contact_list = 1)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -151,8 +151,8 @@ class Proposals extends DolibarrApi
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.datec:<:'20160101')"
|
||||
* @return array Array of order objects
|
||||
*/
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
{
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
$obj_ret = array();
|
||||
@ -201,8 +201,8 @@ class Proposals extends DolibarrApi
|
||||
$sql .= $this->db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
dol_syslog("API Rest request");
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
@ -235,13 +235,13 @@ class Proposals extends DolibarrApi
|
||||
* @param array $request_data Request data
|
||||
* @return int ID of proposal
|
||||
*/
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
}
|
||||
// Check mandatory fields
|
||||
$result = $this->_validate($request_data);
|
||||
|
||||
foreach ($request_data as $field => $value) {
|
||||
$this->propal->$field = $value;
|
||||
@ -258,7 +258,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
return $this->propal->id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get lines of a commercial proposal
|
||||
@ -269,26 +269,26 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getLines($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
public function getLines($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$this->propal->getLinesArray();
|
||||
$result = array();
|
||||
foreach ($this->propal->lines as $line) {
|
||||
array_push($result, $this->_cleanObjectDatas($line));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -309,50 +309,50 @@ class Proposals extends DolibarrApi
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$request_data = (object) $request_data;
|
||||
$request_data = (object) $request_data;
|
||||
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$request_data->fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$request_data->origin,
|
||||
$request_data->origin_id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
$updateRes = $this->propal->addline(
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
$request_data->qty,
|
||||
$request_data->tva_tx,
|
||||
$request_data->localtax1_tx,
|
||||
$request_data->localtax2_tx,
|
||||
$request_data->fk_product,
|
||||
$request_data->remise_percent,
|
||||
'HT',
|
||||
0,
|
||||
$request_data->info_bits,
|
||||
$request_data->product_type,
|
||||
$request_data->rang,
|
||||
$request_data->special_code,
|
||||
$request_data->fk_parent_line,
|
||||
$request_data->fk_fournprice,
|
||||
$request_data->pa_ht,
|
||||
$request_data->label,
|
||||
$request_data->date_start,
|
||||
$request_data->date_end,
|
||||
$request_data->array_options,
|
||||
$request_data->fk_unit,
|
||||
$request_data->origin,
|
||||
$request_data->origin_id,
|
||||
$request_data->multicurrency_subprice,
|
||||
$request_data->fk_remise_except
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
return $updateRes;
|
||||
} else {
|
||||
throw new RestException(400, $this->propal->error);
|
||||
}
|
||||
}
|
||||
if ($updateRes > 0) {
|
||||
return $updateRes;
|
||||
} else {
|
||||
throw new RestException(400, $this->propal->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a line of given commercial proposal
|
||||
@ -388,37 +388,37 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(404, 'Proposal line not found');
|
||||
}
|
||||
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
$updateRes = $this->propal->updateline(
|
||||
$lineid,
|
||||
isset($request_data->subprice) ? $request_data->subprice : $propalline->subprice,
|
||||
isset($request_data->qty) ? $request_data->qty : $propalline->qty,
|
||||
isset($request_data->remise_percent) ? $request_data->remise_percent : $propalline->remise_percent,
|
||||
isset($request_data->tva_tx) ? $request_data->tva_tx : $propalline->tva_tx,
|
||||
isset($request_data->localtax1_tx) ? $request_data->localtax1_tx : $propalline->localtax1_tx,
|
||||
isset($request_data->localtax2_tx) ? $request_data->localtax2_tx : $propalline->localtax2_tx,
|
||||
isset($request_data->desc) ? $request_data->desc : $propalline->desc,
|
||||
'HT',
|
||||
isset($request_data->info_bits) ? $request_data->info_bits : $propalline->info_bits,
|
||||
isset($request_data->special_code) ? $request_data->special_code : $propalline->special_code,
|
||||
isset($request_data->fk_parent_line) ? $request_data->fk_parent_line : $propalline->fk_parent_line,
|
||||
0,
|
||||
isset($request_data->fk_fournprice) ? $request_data->fk_fournprice : $propalline->fk_fournprice,
|
||||
isset($request_data->pa_ht) ? $request_data->pa_ht : $propalline->pa_ht,
|
||||
isset($request_data->label) ? $request_data->label : $propalline->label,
|
||||
isset($request_data->product_type) ? $request_data->product_type : $propalline->product_type,
|
||||
isset($request_data->date_start) ? $request_data->date_start : $propalline->date_start,
|
||||
isset($request_data->date_end) ? $request_data->date_end : $propalline->date_end,
|
||||
isset($request_data->array_options) ? $request_data->array_options : $propalline->array_options,
|
||||
isset($request_data->fk_unit) ? $request_data->fk_unit : $propalline->fk_unit,
|
||||
isset($request_data->multicurrency_subprice) ? $request_data->multicurrency_subprice : $propalline->subprice
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
unset($result->line);
|
||||
return $this->_cleanObjectDatas($result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -432,13 +432,13 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*/
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
@ -460,7 +460,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Add a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
@ -471,66 +471,66 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
*/
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->add_contact($contactid, $type, 'external');
|
||||
$result = $this->propal->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
return $this->propal;
|
||||
}
|
||||
return $this->propal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
/**
|
||||
* Delete a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $contactid Row key of the contact in the array contact_ids.
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||
*
|
||||
* @url DELETE {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*/
|
||||
public function deleteContact($id, $contactid, $type)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||
@ -556,12 +556,12 @@ class Proposals extends DolibarrApi
|
||||
* @param array $request_data Datas
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
*/
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
@ -631,14 +631,14 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a proposal to draft
|
||||
*
|
||||
* @param int $id Order ID
|
||||
*
|
||||
* @url POST {id}/settodraft
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
* Set a proposal to draft
|
||||
*
|
||||
* @param int $id Order ID
|
||||
*
|
||||
* @url POST {id}/settodraft
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function settodraft($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
@ -690,14 +690,14 @@ class Proposals extends DolibarrApi
|
||||
* @url POST {id}/validate
|
||||
*
|
||||
* @throws RestException 304
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
* @throws RestException 401
|
||||
* @throws RestException 404
|
||||
* @throws RestException 500
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validate($id, $notrigger = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
@ -718,19 +718,19 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(500, 'Error when validating Commercial Proposal: '.$this->propal->error);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
$this->propal->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close (Accept or refuse) a quote / commercial proposal
|
||||
@ -780,47 +780,47 @@ class Proposals extends DolibarrApi
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a commercial proposal billed. Could be also called setbilled
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @url POST {id}/setinvoiced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
/**
|
||||
* Set a commercial proposal billed. Could be also called setbilled
|
||||
*
|
||||
* @param int $id Commercial proposal ID
|
||||
*
|
||||
* @url POST {id}/setinvoiced
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function setinvoiced($id)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Commercial Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error : '.$this->propal->error);
|
||||
}
|
||||
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error : '.$this->propal->error);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
$result = $this->propal->fetch($id);
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$this->propal->fetchObjectLinked();
|
||||
$this->propal->fetchObjectLinked();
|
||||
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -842,25 +842,25 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Clean sensible object datas
|
||||
*
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
protected function _cleanObjectDatas($object)
|
||||
{
|
||||
// phpcs:enable
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
|
||||
unset($object->note);
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
unset($object->note);
|
||||
unset($object->name);
|
||||
unset($object->lastname);
|
||||
unset($object->firstname);
|
||||
unset($object->civility_id);
|
||||
unset($object->address);
|
||||
|
||||
return $object;
|
||||
}
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
@ -573,13 +573,13 @@ class Orders extends DolibarrApi
|
||||
$contacts = $this->commande->liste_contact();
|
||||
|
||||
foreach ($contacts as $contact) {
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
$result = $this->commande->delete_contact($contact['rowid']);
|
||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||
$result = $this->commande->delete_contact($contact['rowid']);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
}
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
@ -3531,6 +3531,8 @@ class Commande extends CommonOrder
|
||||
$billedtext = '';
|
||||
if (empty($donotshowbilled)) $billedtext .= ($billed ? ' - '.$langs->trans("Billed") : '');
|
||||
|
||||
$labelTooltip = '';
|
||||
|
||||
if ($status == self::STATUS_CANCELED) {
|
||||
$labelStatus = $langs->trans('StatusOrderCanceled');
|
||||
$labelStatusShort = $langs->trans('StatusOrderCanceledShort');
|
||||
@ -3544,8 +3546,9 @@ class Commande extends CommonOrder
|
||||
$labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext;
|
||||
$statusType = 'status1';
|
||||
} elseif ($status == self::STATUS_SHIPMENTONPROCESS) {
|
||||
$labelStatus = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelStatus = $langs->trans('StatusOrderSent').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext;
|
||||
$labelTooltip = $langs->trans("StatusOrderSent").' - '.$langs->trans("DateDeliveryPlanned").dol_print_date($this->date_livraison).$billedtext;
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderToBill');
|
||||
@ -3553,11 +3556,11 @@ class Commande extends CommonOrder
|
||||
$statusType = 'status4';
|
||||
} elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext;
|
||||
$labelStatusShort = $langs->trans('StatusOrderProcessedShort').$billedtext;
|
||||
$statusType = 'status6';
|
||||
} elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) {
|
||||
$labelStatus = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDelivered');
|
||||
$labelStatusShort = $langs->trans('StatusOrderDeliveredShort');
|
||||
$statusType = 'status6';
|
||||
} else {
|
||||
$labelStatus = $langs->trans('Unknown');
|
||||
@ -3566,7 +3569,7 @@ class Commande extends CommonOrder
|
||||
$mode = 0;
|
||||
}
|
||||
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode);
|
||||
return dolGetStatus($labelStatus, $labelStatusShort, '', $statusType, $mode, '', array('tooltip' => $labelTooltip));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills'));
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
@ -680,9 +680,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.$search_town.'"></td>';
|
||||
if (!empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
|
||||
// Zip
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
|
||||
if (!empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).'"></td>';
|
||||
// State
|
||||
if (!empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
@ -905,6 +905,7 @@ if ($resql)
|
||||
$total = 0;
|
||||
$subtotal = 0;
|
||||
$productstat_cache = array();
|
||||
$productstat_cachevirtual = array();
|
||||
$getNomUrl_cache = array();
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
@ -962,7 +963,6 @@ if ($resql)
|
||||
// Show shippable Icon (create subloop, so may be slow)
|
||||
if ($conf->stock->enabled)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if (($obj->fk_statut > 0) && ($obj->fk_statut < 3))
|
||||
{
|
||||
$numlines = count($generic_commande->lines); // Loop on each line of order
|
||||
@ -986,16 +986,16 @@ if ($resql)
|
||||
|
||||
if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) // Default code. Default is when this option is not set, setting it create strange result
|
||||
{
|
||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel;
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique;
|
||||
$text_info .= $generic_commande->lines[$lig]->qty.' X '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 25);
|
||||
$text_info .= ' - '.$langs->trans("Stock").': <span class="'.($generic_product->stock_reel > 0 ? 'ok' : 'error').'">'.$generic_product->stock_reel.'</span>';
|
||||
$text_info .= ' - '.$langs->trans("VirtualStock").': <span class="'.($generic_product->stock_theorique > 0 ? 'ok' : 'error').'">'.$generic_product->stock_theorique.'</span>';
|
||||
$text_info .= '<br>';
|
||||
|
||||
if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel)
|
||||
{
|
||||
$notshippable++;
|
||||
}
|
||||
} else { // Detailed code, looks bugged
|
||||
} else { // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
|
||||
// stock order and stock order_supplier
|
||||
$stock_order = 0;
|
||||
$stock_order_supplier = 0;
|
||||
|
||||
@ -182,7 +182,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
$sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT;
|
||||
}
|
||||
// Paiements of salaries
|
||||
// Payments of salaries
|
||||
if (GETPOST('selectpaymentsofsalaries')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, t.fk_user as fk_soc, t.datep as date, t.dateep as date_due, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum, ".PAY_DEBIT." as sens";
|
||||
@ -203,7 +203,7 @@ if (($action == 'searchfiles' || $action == 'dl')) {
|
||||
// Various payments
|
||||
if (GETPOST('selectvariouspayment')) {
|
||||
if (!empty($sql)) $sql .= " UNION ALL";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.label as ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
|
||||
$sql .= " SELECT t.rowid as id, t.entity, t.ref, 1 as paid, t.amount as total_ht, t.amount as total_ttc, 0 as total_vat, '".$db->escape($conf->currency)."' as currency, 0 as fk_soc, t.datep as date, t.datep as date_due, 'VariousPayment' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum, sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."payment_various as t";
|
||||
$sql .= " WHERE datep between ".$wheretail;
|
||||
$sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')';
|
||||
@ -581,7 +581,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0);
|
||||
}
|
||||
print '<form name="dl" action="?action=dl" method="POST" >'."\n";
|
||||
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.currentToken().'">';
|
||||
|
||||
echo dol_print_date($date_start, 'day')." - ".dol_print_date($date_stop, 'day');
|
||||
@ -592,7 +592,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
|
||||
}
|
||||
|
||||
print '<input class="butAction" type="submit" value="'.$langs->trans("Download").'" />';
|
||||
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />';
|
||||
print '</form>'."\n";
|
||||
|
||||
print '<br>';
|
||||
@ -606,13 +606,14 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print_liste_field_titre($arrayfields['ref']['label'], $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'nowraponall ');
|
||||
print '<td>'.$langs->trans("Document").'</td>';
|
||||
print '<td>'.$langs->trans("Paid").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalHT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalTTC").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td align="right">'.$langs->trans("TotalVAT").($conf->multicurrency->enabled ? ' ('.$conf->currency.')' : '').'</td>';
|
||||
print '<td>'.$langs->trans("ThirdParty").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Code").'</td>';
|
||||
print '<td class="center">'.$langs->trans("Country").'</td>';
|
||||
print '<td class="center">'.$langs->trans("VATIntra").'</td>';
|
||||
if ($conf->multicurrency->enabled) print '<td class="center">'.$langs->trans("Currency").'</td>';
|
||||
print '</tr>';
|
||||
if ($result)
|
||||
{
|
||||
@ -620,7 +621,11 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
|
||||
if (empty($TData))
|
||||
{
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td></tr>';
|
||||
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '</tr>';
|
||||
} else {
|
||||
// Sort array by date ASC to calculate balance
|
||||
|
||||
@ -647,7 +652,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print dol_print_date($data['date'], 'day');
|
||||
print "</td>\n";
|
||||
|
||||
// Date
|
||||
// Date due
|
||||
print '<td class="center">';
|
||||
print dol_print_date($data['date_due'], 'day');
|
||||
print "</td>\n";
|
||||
@ -658,10 +663,18 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
if ($data['item'] == 'Invoice') {
|
||||
$invoice->id = $data['id'];
|
||||
$invoice->ref = $data['ref'];
|
||||
$invoice->total_ht = $data['amount_ht'];
|
||||
$invoice->total_ttc = $data['amount_ttc'];
|
||||
$invoice->total_tva = $data['amount_vat'];
|
||||
$invoice->multicurrency_code = $data['currency'];
|
||||
print $invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'SupplierInvoice') {
|
||||
$supplier_invoice->id = $data['id'];
|
||||
$supplier_invoice->ref = $data['ref'];
|
||||
$supplier_invoice->total_ht = $data['amount_ht'];
|
||||
$supplier_invoice->total_ttc = $data['amount_ttc'];
|
||||
$supplier_invoice->total_tva = $data['amount_vat'];
|
||||
$supplier_invoice->multicurrency_code = $data['currency'];
|
||||
print $supplier_invoice->getNomUrl(1, '', 0, 0, '', 0, 0, 0);
|
||||
} elseif ($data['item'] == 'ExpenseReport') {
|
||||
$expensereport->id = $data['id'];
|
||||
@ -712,7 +725,7 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
// Total VAT
|
||||
print '<td align="right">'.price($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'])."</td>\n";
|
||||
|
||||
print '<td>'.$data['thirdparty_name']."</td>\n";
|
||||
print '<td class="tdoverflowmax150" title="'.$data['thirdparty_name'].'">'.$data['thirdparty_name']."</td>\n";
|
||||
|
||||
print '<td class="center">'.$data['thirdparty_code']."</td>\n";
|
||||
|
||||
@ -730,6 +743,10 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
$totalVAT_debit -= $data['amount_vat'];
|
||||
}
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td class="center">'.$data['currency']."</td>\n";
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
@ -740,6 +757,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_credit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Total debits
|
||||
print '<tr class="liste_total">';
|
||||
@ -748,6 +768,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
// Balance
|
||||
print '<tr class="liste_total">';
|
||||
@ -756,6 +779,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td align="right">'.price(price2num($totalIT_credit + $totalIT_debit, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT_credit + $totalVAT_debit, 'MT')).'</td>';
|
||||
print '<td colspan="4"></td>';
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
print '<td></td>';
|
||||
}
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -338,6 +338,24 @@ class PaymentVarious extends CommonObject
|
||||
$this->fk_user_modif = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a miscellaneous payment can be created into database
|
||||
*
|
||||
* @return boolean True or false
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$newamount = price2num($this->amount, 'MT');
|
||||
|
||||
// Validation of parameters
|
||||
if (!($newamount) > 0 || empty($this->datep))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create in database
|
||||
*
|
||||
|
||||
@ -41,8 +41,9 @@ $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy", "cat
|
||||
|
||||
// Get parameters
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm');
|
||||
$cancel = GETPOST('cancel', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
$accountid = GETPOST("accountid") > 0 ? GETPOST("accountid", "int") : 0;
|
||||
@ -225,6 +226,64 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm != 'yes') { $action = ''; }
|
||||
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->banque->modifier))
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$originalId = $id;
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->id = $object->ref = null;
|
||||
|
||||
if (GETPOST('clone_label', 'alphanohtml')) {
|
||||
$object->label = GETPOST('clone_label', 'alphanohtml');
|
||||
} else {
|
||||
$object->label = $langs->trans("CopyOf").' '.$object->label;
|
||||
}
|
||||
|
||||
$newdatepayment = dol_mktime(0, 0, 0, GETPOST('clone_date_paymentmonth', 'int'), GETPOST('clone_date_paymentday', 'int'), GETPOST('clone_date_paymentyear', 'int'));
|
||||
$newdatevalue = dol_mktime(0, 0, 0, GETPOST('clone_date_valuemonth', 'int'), GETPOST('clone_date_valueday', 'int'), GETPOST('clone_date_valueyear', 'int'));
|
||||
if ($newdatepayment) $object->datep = $newdatepayment;
|
||||
if (!empty($newdatevalue)) {
|
||||
$object->datev = $newdatevalue;
|
||||
} else {
|
||||
$object->datev = $newdatepayment;
|
||||
}
|
||||
|
||||
if ($object->check())
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if ($id > 0)
|
||||
{
|
||||
$db->commit();
|
||||
$db->close();
|
||||
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
$id = $originalId;
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$id = $originalId;
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -419,6 +478,19 @@ if ($id)
|
||||
|
||||
$head = various_payment_prepare_head($object);
|
||||
|
||||
// Clone confirmation
|
||||
if ($action === 'clone')
|
||||
{
|
||||
$formquestion = array(
|
||||
array('type' => 'text', 'name' => 'clone_label', 'label' => $langs->trans("Label"), 'value' => $langs->trans("CopyOf").' '.$object->label),
|
||||
);
|
||||
$formquestion[] = array('type' => 'date', 'tdclass'=>'fieldrequired', 'name' => 'clone_date_payment', 'label' => $langs->trans("DatePayment"), 'value' => -1);
|
||||
$formquestion[] = array('type' => 'date', 'name' => 'clone_date_value', 'label' => $langs->trans("DateValue"), 'value' => -1);
|
||||
$formquestion[] = array('type' => 'other', 'tdclass'=>'fieldrequired', 'name' => 'accountid', 'label' => $langs->trans("BankAccount"), 'value' => $form->select_comptes($accountid, "accountid", 0, '', 1));
|
||||
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneVariousPayment', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 300);
|
||||
}
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("VariousPayment"), -1, $object->picto);
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
@ -542,6 +614,12 @@ if ($id)
|
||||
// TODO
|
||||
// Add button modify
|
||||
|
||||
// Clone
|
||||
if ($user->rights->banque->modifier)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.dol_buildpath("/compta/bank/various_payment/card.php", 1).'?id='.$object->id.'&action=clone">'.$langs->trans("ToClone")."</a></div>";
|
||||
}
|
||||
|
||||
// Delete
|
||||
if (empty($object->rappro))
|
||||
{
|
||||
|
||||
@ -490,9 +490,9 @@ if ($result)
|
||||
print $accountstatic->getNomUrl(1);
|
||||
} else {
|
||||
print ' ';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Bank entry
|
||||
|
||||
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/deplacement/class/deplacement.class.php'
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
@ -62,138 +62,138 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
|
||||
if ($action == 'validate' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT)
|
||||
{
|
||||
$result = $object->setStatut(1);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT)
|
||||
{
|
||||
$result = $object->setStatut(1);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED)
|
||||
{
|
||||
$result = $object->setStatut(Deplacement::STATUS_REFUNDED);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED)
|
||||
{
|
||||
$result = $object->setStatut(Deplacement::STATUS_REFUNDED);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer)
|
||||
{
|
||||
$result = $object->delete($id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$result = $object->delete($id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'add' && $user->rights->deplacement->creer)
|
||||
{
|
||||
if (!GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$error = 0;
|
||||
if (!GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$error = 0;
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type', 'alpha');
|
||||
$object->socid = (int) GETPOST('socid', 'int');
|
||||
$object->fk_user = (int) GETPOST('fk_user', 'int');
|
||||
$object->note_private = GETPOST('note_private', 'alpha');
|
||||
$object->note_public = GETPOST('note_public', 'alpha');
|
||||
$object->statut = Deplacement::STATUS_DRAFT;
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type', 'alpha');
|
||||
$object->socid = (int) GETPOST('socid', 'int');
|
||||
$object->fk_user = (int) GETPOST('fk_user', 'int');
|
||||
$object->note_private = GETPOST('note_private', 'alpha');
|
||||
$object->note_public = GETPOST('note_public', 'alpha');
|
||||
$object->statut = Deplacement::STATUS_DRAFT;
|
||||
|
||||
if (!$object->date)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($object->type == '-1')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!($object->fk_user > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Person")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!$object->date)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($object->type == '-1')
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!($object->fk_user > 0))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Person")), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
if (!$error)
|
||||
{
|
||||
$id = $object->create($user);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
if ($id > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
$action = 'create';
|
||||
}
|
||||
} else {
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
} // Update record
|
||||
elseif ($action == 'update' && $user->rights->deplacement->creer)
|
||||
{
|
||||
if (!GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if (!GETPOST('cancel', 'alpha'))
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type', 'alpha');
|
||||
$object->socid = (int) GETPOST('socid', 'int');
|
||||
$object->fk_user = (int) GETPOST('fk_user', 'int');
|
||||
$object->note_private = GETPOST('note_private', 'alpha');
|
||||
$object->note_public = GETPOST('note_public', 'alpha');
|
||||
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
|
||||
$object->type = GETPOST('type', 'alpha');
|
||||
$object->socid = (int) GETPOST('socid', 'int');
|
||||
$object->fk_user = (int) GETPOST('fk_user', 'int');
|
||||
$object->note_private = GETPOST('note_private', 'alpha');
|
||||
$object->note_public = GETPOST('note_public', 'alpha');
|
||||
|
||||
$result = $object->update($user);
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
} // Set into a project
|
||||
elseif ($action == 'classin' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject(GETPOST('projectid', 'int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject(GETPOST('projectid', 'int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
} // Set fields
|
||||
elseif ($action == 'setdated' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
} elseif ($action == 'setkm' && $user->rights->deplacement->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('km', GETPOST('km', 'int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('km', GETPOST('km', 'int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY');
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
@ -210,327 +210,327 @@ $form = new Form($db);
|
||||
*/
|
||||
if ($action == 'create')
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
print load_fiche_titre($langs->trans("NewTrip"));
|
||||
print load_fiche_titre($langs->trans("NewTrip"));
|
||||
|
||||
$datec = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
$datec = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||
$form->select_type_fees(GETPOST('type', 'int'), 'type', 1);
|
||||
print '</td></tr>';
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||
$form->select_type_fees(GETPOST('type', 'int'), 'type', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
print $form->selectDate($datec ? $datec : -1, '', '', '', '', 'add', 1, 1);
|
||||
print '</td></tr>';
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
print $form->selectDate($datec ? $datec : -1, '', '', '', '', 'add', 1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Km
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value="'.GETPOST("km").'"></td></tr>';
|
||||
// Km
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td><input name="km" size="10" value="'.GETPOST("km").'"></td></tr>';
|
||||
|
||||
// Company
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||
print $form->select_company(GETPOST('socid', 'int'), 'socid', '', 1);
|
||||
print '</td></tr>';
|
||||
// Company
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||
print $form->select_company(GETPOST('socid', 'int'), 'socid', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('note_public', GETPOST('note_public', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<br><div class="center">';
|
||||
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
} elseif ($id)
|
||||
{
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$head = trip_prepare_head($object);
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0)
|
||||
{
|
||||
$head = trip_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
if ($action == 'edit' && $user->rights->deplacement->creer)
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if ($action == 'edit' && $user->rights->deplacement->creer)
|
||||
{
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid)
|
||||
{
|
||||
$soc->fetch($object->socid);
|
||||
}
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid)
|
||||
{
|
||||
$soc->fetch($object->socid);
|
||||
}
|
||||
|
||||
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Ref
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
// Ref
|
||||
print "<tr>";
|
||||
print '<td class="titlefield">'.$langs->trans("Ref").'</td><td>';
|
||||
print $object->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||
$form->select_type_fees(GETPOST('type', 'int') ?GETPOST('type', 'int') : $object->type, 'type', 0);
|
||||
print '</td></tr>';
|
||||
// Type
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Type").'</td><td>';
|
||||
$form->select_type_fees(GETPOST('type', 'int') ?GETPOST('type', 'int') : $object->type, 'type', 0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Who
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user', 'int') ?GETPOST('fk_user', 'int') : $object->fk_user, 'fk_user', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
// Who
|
||||
print "<tr>";
|
||||
print '<td class="fieldrequired">'.$langs->trans("Person").'</td><td>';
|
||||
print $form->select_dolusers(GETPOST('fk_user', 'int') ?GETPOST('fk_user', 'int') : $object->fk_user, 'fk_user', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
print $form->selectDate($object->date, '', 0, 0, 0, 'update', 1, 0);
|
||||
print '</td></tr>';
|
||||
// Date
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Date").'</td><td>';
|
||||
print $form->selectDate($object->date, '', 0, 0, 0, 'update', 1, 0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Km
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
||||
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
||||
print '</td></tr>';
|
||||
// Km
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("FeesKilometersOrAmout").'</td><td>';
|
||||
print '<input name="km" class="flat" size="10" value="'.$object->km.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Where
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||
print $form->select_company($soc->id, 'socid', '', 1);
|
||||
print '</td></tr>';
|
||||
// Where
|
||||
print "<tr>";
|
||||
print '<td>'.$langs->trans("CompanyVisited").'</td><td>';
|
||||
print $form->select_company($soc->id, 'socid', '', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Public note
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td>';
|
||||
// Public note
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NotePublic").'</td>';
|
||||
print '<td>';
|
||||
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('note_public', $object->note_public, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
print "</td></tr>";
|
||||
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td>';
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr><td class="tdtop">'.$langs->trans("NotePrivate").'</td>';
|
||||
print '<td>';
|
||||
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('note_private', $object->note_private, '', 200, 'dolibarr_notes', 'In', false, true, true, ROWS_8, '90%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<br><div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
} else {
|
||||
/*
|
||||
print '</div>';
|
||||
} else {
|
||||
/*
|
||||
* Confirm delete trip
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete");
|
||||
}
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete");
|
||||
}
|
||||
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid) $soc->fetch($object->socid);
|
||||
$soc = new Societe($db);
|
||||
if ($object->socid) $soc->fetch($object->socid);
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/deplacement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
// Ref
|
||||
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
|
||||
print '</td></tr>';
|
||||
|
||||
$form->load_cache_types_fees();
|
||||
$form->load_cache_types_fees();
|
||||
|
||||
// Type
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print '</td></tr>';
|
||||
// Type
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print '</td></tr>';
|
||||
|
||||
// Who
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||
$userfee = new User($db);
|
||||
$userfee->fetch($object->fk_user);
|
||||
print $userfee->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
// Who
|
||||
print '<tr><td>'.$langs->trans("Person").'</td><td>';
|
||||
$userfee = new User($db);
|
||||
$userfee->fetch($object->fk_user);
|
||||
print $userfee->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print '</td></tr>';
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print '</td></tr>';
|
||||
|
||||
// Km/Price
|
||||
print '<tr><td class="tdtop">';
|
||||
print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print "</td></tr>";
|
||||
// Km/Price
|
||||
print '<tr><td class="tdtop">';
|
||||
print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print "</td></tr>";
|
||||
|
||||
// Where
|
||||
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
||||
print '<td>';
|
||||
if ($soc->id) print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
// Where
|
||||
print '<tr><td>'.$langs->trans("CompanyVisited").'</td>';
|
||||
print '<td>';
|
||||
if ($soc->id) print $soc->getNomUrl(1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load('projects');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify' && $user->rights->deplacement->creer)
|
||||
{
|
||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify')
|
||||
{
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
||||
} else {
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify' && $user->rights->deplacement->creer)
|
||||
{
|
||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'classify')
|
||||
{
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1);
|
||||
} else {
|
||||
$form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('socid'=>$object->id);
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
// Other attributes
|
||||
$parameters = array('socid'=>$object->id);
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print "</table><br>";
|
||||
print "</table><br>";
|
||||
|
||||
// Notes
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
// Notes
|
||||
$blocname = 'notes';
|
||||
$title = $langs->trans('Notes');
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
/*
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT) // if draft
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT) // if draft
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
}
|
||||
}
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated
|
||||
{
|
||||
if ($user->rights->deplacement->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($user->rights->deplacement->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
if ($user->rights->deplacement->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$id.'">'.$langs->trans('Delete').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -188,8 +188,8 @@ if (empty($reshook))
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$object->titre = GETPOST('titre', 'nohtml'); // deprecated
|
||||
$object->title = GETPOST('titre', 'nohtml');
|
||||
$object->titre = GETPOST('title', 'nohtml'); // deprecated
|
||||
$object->title = GETPOST('title', 'nohtml');
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
$object->model_pdf = GETPOST('modelpdf', 'alpha');
|
||||
|
||||
@ -1499,7 +1499,7 @@ class Invoices extends DolibarrApi
|
||||
$amount = price2num($amountarray["multicurrency_amount"], 'MT');
|
||||
}
|
||||
|
||||
if ($amount > $remainstopay && $accepthigherpayment == false) {
|
||||
if ($amount > $remainstopay && !$accepthigherpayment) {
|
||||
$this->db->rollback();
|
||||
throw new RestException(400, 'Payment amount on invoice ID '.$id.' ('.$amount.') is higher than remain to pay ('.$remainstopay.')');
|
||||
}
|
||||
|
||||
@ -74,6 +74,11 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
protected $table_ref_field = 'titre';
|
||||
|
||||
/**
|
||||
* @var string The label of recurring invoice
|
||||
*/
|
||||
public $title;
|
||||
|
||||
public $number;
|
||||
public $date;
|
||||
public $remise;
|
||||
|
||||
@ -1040,8 +1040,10 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
}
|
||||
|
||||
if ($othernb) {
|
||||
$colspan = 6;
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<td class="nowrap" colspan="'.$colspan.'">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
@ -1174,8 +1176,10 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU
|
||||
}
|
||||
|
||||
if ($othernb) {
|
||||
$colspan = 6;
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++;
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap" colspan="5">';
|
||||
print '<td class="nowrap" colspan="'.$colspan.'">';
|
||||
print '<span class="opacitymedium">'.$langs->trans("More").'... ('.$othernb.')</span>';
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -98,7 +98,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
}
|
||||
$object->amount = $amount;
|
||||
$object->label = GETPOST("label", 'alpha');
|
||||
$object->note = GETPOST("note", 'restricthtml');
|
||||
$object->note_private = GETPOST("note", 'restricthtml');
|
||||
|
||||
if (empty($object->datep))
|
||||
{
|
||||
@ -239,7 +239,7 @@ if ($action == 'create')
|
||||
print '<label for="radiorefund">';
|
||||
print '<input type="radio" id="radiorefund" data-label="'.$langs->trans('VATRefund').'" class="flat" name="refund" value="1"'.($refund ? ' checked="checked"' : '').'>';
|
||||
print ' ';
|
||||
print $langs->trans("Refund");
|
||||
print $langs->trans("PaymentBack");
|
||||
print '</label>';
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
@ -165,7 +165,7 @@ foreach ($object->fields as $key => $val)
|
||||
}
|
||||
|
||||
// Add none object fields for "search in all"
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
$fieldstosearchall['s.nom'] = "ThirdParty";
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ foreach ($object->fields as $key => $val) {
|
||||
|
||||
// Add none object fields to fields for list
|
||||
$arrayfields['country.code_iso'] = array('label'=>"Country", 'position'=>22, 'checked'=>0);
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
|
||||
$arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1);
|
||||
}
|
||||
|
||||
|
||||
@ -30,413 +30,413 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
|
||||
*/
|
||||
class box_activity extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "activity";
|
||||
public $boximg = "object_bill";
|
||||
public $boxlabel = 'BoxGlobalActivity';
|
||||
public $depends = array("facture");
|
||||
public $boxcode = "activity";
|
||||
public $boximg = "object_bill";
|
||||
public $boxlabel = 'BoxGlobalActivity';
|
||||
public $depends = array("facture");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
public $param;
|
||||
public $enabled = 1;
|
||||
public $param;
|
||||
public $enabled = 1;
|
||||
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
public function __construct($db, $param)
|
||||
{
|
||||
global $conf, $user;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $param More parameters
|
||||
*/
|
||||
public function __construct($db, $param)
|
||||
{
|
||||
global $conf, $user;
|
||||
|
||||
$this->db = $db;
|
||||
$this->db = $db;
|
||||
|
||||
// FIXME: Pb into some status
|
||||
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
|
||||
// FIXME: Pb into some status
|
||||
$this->enabled = ($conf->global->MAIN_FEATURES_LEVEL); // Not enabled by default due to bugs (see previous comments)
|
||||
|
||||
$this->hidden = !((!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|| (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
|| (!empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
);
|
||||
}
|
||||
$this->hidden = !((!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
|| (!empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
|| (!empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Charge les donnees en memoire pour affichage ulterieur
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
/**
|
||||
* Charge les donnees en memoire pour affichage ulterieur
|
||||
*
|
||||
* @param int $max Maximum number of records to load
|
||||
* @return void
|
||||
*/
|
||||
public function loadBox($max = 5)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$totalnb = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache';
|
||||
$now = dol_now();
|
||||
$nbofperiod = 3;
|
||||
$totalnb = 0;
|
||||
$line = 0;
|
||||
$cachetime = 3600;
|
||||
$fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache';
|
||||
$now = dol_now();
|
||||
$nbofperiod = 3;
|
||||
|
||||
if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
||||
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
|
||||
$this->info_box_head = array(
|
||||
'text' => $textHead,
|
||||
'limit'=> dol_strlen($textHead),
|
||||
);
|
||||
if (!empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofperiod = $conf->global->MAIN_BOX_ACTIVITY_DURATION;
|
||||
$textHead = $langs->trans("Activity").' - '.$langs->trans("LastXMonthRolling", $nbofperiod);
|
||||
$this->info_box_head = array(
|
||||
'text' => $textHead,
|
||||
'limit'=> dol_strlen($textHead),
|
||||
);
|
||||
|
||||
// compute the year limit to show
|
||||
$tmpdate = dol_time_plus_duree(dol_now(), -1 * $nbofperiod, "m");
|
||||
// compute the year limit to show
|
||||
$tmpdate = dol_time_plus_duree(dol_now(), -1 * $nbofperiod, "m");
|
||||
|
||||
|
||||
// list the summary of the propals
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic = new Propal($this->db);
|
||||
// list the summary of the propals
|
||||
if (!empty($conf->propal->enabled) && $user->rights->propale->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$propalstatic = new Propal($this->db);
|
||||
|
||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||
$filename = '/boxactivity-propal'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh)
|
||||
{
|
||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('propal').")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND p.datep >= '".$this->db->idate($tmpdate)."'";
|
||||
$sql .= " AND p.date_cloture IS NULL"; // just unclosed
|
||||
$sql .= " GROUP BY p.fk_statut";
|
||||
$sql .= " ORDER BY p.fk_statut DESC";
|
||||
$cachedir = DOL_DATA_ROOT.'/propale/temp';
|
||||
$filename = '/boxactivity-propal'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh)
|
||||
{
|
||||
$sql = "SELECT p.fk_statut, SUM(p.total) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE p.entity IN (".getEntity('propal').")";
|
||||
$sql .= " AND p.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND p.datep >= '".$this->db->idate($tmpdate)."'";
|
||||
$sql .= " AND p.date_cloture IS NULL"; // just unclosed
|
||||
$sql .= " GROUP BY p.fk_statut";
|
||||
$sql .= " ORDER BY p.fk_statut DESC";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $this->db->num_rows($result);
|
||||
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
if (!empty($data))
|
||||
{
|
||||
$j = 0;
|
||||
while ($j < count($data))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
'logo' => 'object_propal'
|
||||
);
|
||||
if (!empty($data))
|
||||
{
|
||||
$j = 0;
|
||||
while ($j < count($data))
|
||||
{
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
'logo' => 'object_propal'
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut,
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut,
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut, 3),
|
||||
);
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $propalstatic->LibStatut($data[$j]->fk_statut, 3),
|
||||
);
|
||||
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list the summary of the orders
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic = new Commande($this->db);
|
||||
// list the summary of the orders
|
||||
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$commandestatic = new Commande($this->db);
|
||||
|
||||
$langs->load("orders");
|
||||
$langs->load("orders");
|
||||
|
||||
$cachedir = DOL_DATA_ROOT.'/commande/temp';
|
||||
$filename = '/boxactivity-order'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
$cachedir = DOL_DATA_ROOT.'/commande/temp';
|
||||
$filename = '/boxactivity-order'.$fileid;
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
|
||||
if ($refresh) {
|
||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'";
|
||||
$sql .= " GROUP BY c.fk_statut";
|
||||
$sql .= " ORDER BY c.fk_statut DESC";
|
||||
if ($refresh) {
|
||||
$sql = "SELECT c.fk_statut, sum(c.total_ttc) as Mnttot, count(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND c.date_commande >= '".$this->db->idate($tmpdate)."'";
|
||||
$sql .= " GROUP BY c.fk_statut";
|
||||
$sql .= " ORDER BY c.fk_statut DESC";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
'logo' => 'object_order',
|
||||
);
|
||||
if (!empty($data)) {
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
'logo' => 'object_order',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut,
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0),
|
||||
'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut,
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($data[$j]->fk_statut, 0, 3),
|
||||
);
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $commandestatic->LibStatut($data[$j]->fk_statut, 0, 3),
|
||||
);
|
||||
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// list the summary of the bills
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic = new Facture($this->db);
|
||||
// list the summary of the bills
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$facturestatic = new Facture($this->db);
|
||||
|
||||
// part 1
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice'.$fileid;
|
||||
// part 1
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice'.$fileid;
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh)
|
||||
{
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1";
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
$sql .= " ORDER BY f.fk_statut DESC";
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$data = array();
|
||||
if ($refresh)
|
||||
{
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= ")";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=1";
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
$sql .= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$billurl = "search_status=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
if (!empty($data)) {
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$billurl = "search_status=2&paye=1&year=".$data[$j]->annee;
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0)." ".$data[$j]->annee,
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
|
||||
'text' => $data[$j]->nb,
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1, $data[$j]->fk_statut, 0),
|
||||
'text' => $data[$j]->nb,
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
);
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency)
|
||||
);
|
||||
|
||||
// We add only for the current year
|
||||
$totalnb += $data[$j]->nb;
|
||||
// We add only for the current year
|
||||
$totalnb += $data[$j]->nb;
|
||||
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(1, $data[$j]->fk_statut, 3),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if (count($data) == 0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
}
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(1, $data[$j]->fk_statut, 3),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if (count($data) == 0)
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
}
|
||||
|
||||
// part 2
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice2'.$fileid;
|
||||
// part 2
|
||||
$cachedir = DOL_DATA_ROOT.'/facture/temp';
|
||||
$filename = '/boxactivity-invoice2'.$fileid;
|
||||
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
$refresh = dol_cache_refresh($cachedir, $filename, $cachetime);
|
||||
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0";
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
$sql .= " ORDER BY f.fk_statut DESC";
|
||||
$data = array();
|
||||
if ($refresh) {
|
||||
$sql = "SELECT f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
$sql .= " AND f.datef >= '".$this->db->idate($tmpdate)."' AND f.paye=0";
|
||||
$sql .= " GROUP BY f.fk_statut";
|
||||
$sql .= " ORDER BY f.fk_statut DESC";
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$num = $this->db->num_rows($result);
|
||||
$j = 0;
|
||||
while ($j < $num) {
|
||||
$data[$j] = $this->db->fetch_object($result);
|
||||
$j++;
|
||||
}
|
||||
if (!empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
dol_filecache($cachedir, $filename, $data);
|
||||
}
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
} else {
|
||||
$data = dol_readcachefile($cachedir, $filename);
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$alreadypaid = -1;
|
||||
if (!empty($data)) {
|
||||
$alreadypaid = -1;
|
||||
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$billurl = "search_status=".$data[$j]->fk_statut."&paye=0";
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
$j = 0;
|
||||
while ($j < count($data)) {
|
||||
$billurl = "search_status=".$data[$j]->fk_statut."&paye=0";
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="left" width="16"',
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
'logo' => 'bill',
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
);
|
||||
$this->info_box_contents[$line][1] = array(
|
||||
'td' => '',
|
||||
'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
);
|
||||
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(0, $data[$j]->fk_statut, 3, $alreadypaid),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if (count($data) == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->info_box_contents[$line][2] = array(
|
||||
'td' => 'class="right"',
|
||||
'text' => $data[$j]->nb,
|
||||
'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0, $data[$j]->fk_statut, 0),
|
||||
'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills",
|
||||
);
|
||||
$totalnb += $data[$j]->nb;
|
||||
$this->info_box_contents[$line][3] = array(
|
||||
'td' => 'class="nowraponall right"',
|
||||
'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency),
|
||||
);
|
||||
$this->info_box_contents[$line][4] = array(
|
||||
'td' => 'class="right" width="18"',
|
||||
'text' => $facturestatic->LibStatut(0, $data[$j]->fk_statut, 3, $alreadypaid),
|
||||
);
|
||||
$line++;
|
||||
$j++;
|
||||
}
|
||||
if (count($data) == 0) {
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center"',
|
||||
'text'=>$langs->trans("NoRecordedInvoices"),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add the sum in the bottom of the boxes
|
||||
$this->info_box_contents[$line][0] = array('tr' => 'class="liste_total_wrap"');
|
||||
@ -444,19 +444,19 @@ class box_activity extends ModeleBoxes
|
||||
$this->info_box_contents[$line][2] = array('td' => 'class="liste_total right" ', 'text' => $totalnb);
|
||||
$this->info_box_contents[$line][3] = array('td' => 'class="liste_total right" ', 'text' => '');
|
||||
$this->info_box_contents[$line][4] = array('td' => 'class="liste_total right" ', 'text' => "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return string
|
||||
*/
|
||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||
{
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
/**
|
||||
* Method to show box
|
||||
*
|
||||
* @param array $head Array with properties of box title
|
||||
* @param array $contents Array with properties of box lines
|
||||
* @param int $nooutput No print, only return string
|
||||
* @return string
|
||||
*/
|
||||
public function showBox($head = null, $contents = null, $nooutput = 0)
|
||||
{
|
||||
return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -30,9 +30,9 @@
|
||||
class HookManager
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
@ -44,18 +44,18 @@ class HookManager
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
||||
public $contextarray = array();
|
||||
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
||||
public $contextarray = array();
|
||||
|
||||
// Array with instantiated classes
|
||||
public $hooks = array();
|
||||
public $hooks = array();
|
||||
|
||||
// Array result
|
||||
public $resArray = array();
|
||||
public $resArray = array();
|
||||
// Printable result
|
||||
public $resPrint = '';
|
||||
public $resPrint = '';
|
||||
// Nb of qualified hook ran
|
||||
public $resNbOfHooks = 0;
|
||||
public $resNbOfHooks = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -84,9 +84,9 @@ class HookManager
|
||||
global $conf;
|
||||
|
||||
// Test if there is hooks to manage
|
||||
if (!is_array($conf->modules_parts['hooks']) || empty($conf->modules_parts['hooks'])) return;
|
||||
if (!is_array($conf->modules_parts['hooks']) || empty($conf->modules_parts['hooks'])) return;
|
||||
|
||||
// For backward compatibility
|
||||
// For backward compatibility
|
||||
if (!is_array($arraycontext)) $arraycontext = array($arraycontext);
|
||||
|
||||
$this->contextarray = array_unique(array_merge($arraycontext, $this->contextarray)); // All contexts are concatenated
|
||||
@ -130,29 +130,29 @@ class HookManager
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute hooks (if they were initialized) for the given method
|
||||
*
|
||||
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
|
||||
* @param array $parameters Array of parameters
|
||||
* @param Object $object Object to use hooks on
|
||||
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return mixed For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
*/
|
||||
/**
|
||||
* Execute hooks (if they were initialized) for the given method
|
||||
*
|
||||
* @param string $method Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...)
|
||||
* @param array $parameters Array of parameters
|
||||
* @param Object $object Object to use hooks on
|
||||
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
|
||||
* @return mixed For 'addreplace' hooks (doActions, formConfirm, formObjectOptions, pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop/replace standard actions, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint. Things to return are returned into ->results by hook and set into ->resArray for caller.
|
||||
* All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller.
|
||||
* $this->error or this->errors are also defined by class called by this function if error.
|
||||
*/
|
||||
public function executeHooks($method, $parameters = array(), &$object = '', &$action = '')
|
||||
{
|
||||
if (!is_array($this->hooks) || empty($this->hooks)) return 0; // No hook available, do nothing.
|
||||
if (!is_array($this->hooks) || empty($this->hooks)) return 0; // No hook available, do nothing.
|
||||
|
||||
$parameters['context'] = join(':', $this->contextarray);
|
||||
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
||||
$parameters['context'] = join(':', $this->contextarray);
|
||||
//dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
|
||||
|
||||
// Define type of hook ('output' or 'addreplace').
|
||||
// TODO Remove hooks with type 'output'. All hooks must be converted into 'addreplace' hooks.
|
||||
$hooktype = 'output';
|
||||
if (in_array(
|
||||
// Define type of hook ('output' or 'addreplace').
|
||||
// TODO Remove hooks with type 'output'. All hooks must be converted into 'addreplace' hooks.
|
||||
$hooktype = 'output';
|
||||
if (in_array(
|
||||
$method,
|
||||
array(
|
||||
'addCalendarChoice',
|
||||
@ -172,33 +172,33 @@ class HookManager
|
||||
'formattachOptions',
|
||||
'formBuilddocLineOptions',
|
||||
'formatNotificationMessage',
|
||||
'formConfirm',
|
||||
'formConfirm',
|
||||
'getAccessForbiddenMessage',
|
||||
'getDirList',
|
||||
'getFormMail',
|
||||
'getFormatedCustomerRef',
|
||||
'getFormatedSupplierRef',
|
||||
'getFormatedSupplierRef',
|
||||
'getIdProfUrl',
|
||||
'getInputIdProf',
|
||||
'moveUploadedFile',
|
||||
'moreHtmlStatus',
|
||||
'pdf_build_address',
|
||||
'pdf_writelinedesc',
|
||||
'pdf_getlinenum',
|
||||
'pdf_getlineref',
|
||||
'pdf_getlineref_supplier',
|
||||
'pdf_getlinevatrate',
|
||||
'pdf_getlineupexcltax',
|
||||
'pdf_getlineupwithtax',
|
||||
'pdf_getlineqty',
|
||||
'pdf_getlineqty_asked',
|
||||
'pdf_getlineqty_shipped',
|
||||
'pdf_getlineqty_keeptoship',
|
||||
'pdf_getlineunit',
|
||||
'pdf_getlineremisepercent',
|
||||
'pdf_getlineprogress',
|
||||
'pdf_getlinetotalexcltax',
|
||||
'pdf_getlinetotalwithtax',
|
||||
'pdf_getlinenum',
|
||||
'pdf_getlineref',
|
||||
'pdf_getlineref_supplier',
|
||||
'pdf_getlinevatrate',
|
||||
'pdf_getlineupexcltax',
|
||||
'pdf_getlineupwithtax',
|
||||
'pdf_getlineqty',
|
||||
'pdf_getlineqty_asked',
|
||||
'pdf_getlineqty_shipped',
|
||||
'pdf_getlineqty_keeptoship',
|
||||
'pdf_getlineunit',
|
||||
'pdf_getlineremisepercent',
|
||||
'pdf_getlineprogress',
|
||||
'pdf_getlinetotalexcltax',
|
||||
'pdf_getlinetotalwithtax',
|
||||
'paymentsupplierinvoices',
|
||||
'printAddress',
|
||||
'printEmail',
|
||||
@ -213,88 +213,88 @@ class HookManager
|
||||
'showLinkToObjectBlock',
|
||||
'setContentSecurityPolicy',
|
||||
'setHtmlTitle',
|
||||
'completeTabsHead'
|
||||
'completeTabsHead'
|
||||
)
|
||||
)) $hooktype = 'addreplace';
|
||||
|
||||
// Init return properties
|
||||
$this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0;
|
||||
// Init return properties
|
||||
$this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0;
|
||||
|
||||
// Loop on each hook to qualify modules that have declared context
|
||||
$modulealreadyexecuted = array();
|
||||
$resaction = 0; $error = 0;
|
||||
foreach ($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||
{
|
||||
if (!empty($modules))
|
||||
{
|
||||
foreach ($modules as $module => $actionclassinstance)
|
||||
{
|
||||
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
// Loop on each hook to qualify modules that have declared context
|
||||
$modulealreadyexecuted = array();
|
||||
$resaction = 0; $error = 0;
|
||||
foreach ($this->hooks as $context => $modules) // $this->hooks is an array with context as key and value is an array of modules that handle this context
|
||||
{
|
||||
if (!empty($modules))
|
||||
{
|
||||
foreach ($modules as $module => $actionclassinstance)
|
||||
{
|
||||
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
|
||||
// test to avoid running twice a hook, when a module implements several active contexts
|
||||
if (in_array($module, $modulealreadyexecuted)) continue;
|
||||
// test to avoid running twice a hook, when a module implements several active contexts
|
||||
if (in_array($module, $modulealreadyexecuted)) continue;
|
||||
|
||||
// jump to next module/class if method does not exist
|
||||
if (!method_exists($actionclassinstance, $method)) continue;
|
||||
// jump to next module/class if method does not exist
|
||||
if (!method_exists($actionclassinstance, $method)) continue;
|
||||
|
||||
$this->resNbOfHooks++;
|
||||
$this->resNbOfHooks++;
|
||||
|
||||
$modulealreadyexecuted[$module] = $module; // Use the $currentcontext in method to avoid running twice
|
||||
$modulealreadyexecuted[$module] = $module; // Use the $currentcontext in method to avoid running twice
|
||||
|
||||
// Clean class (an error may have been set from a previous call of another method for same module/hook)
|
||||
$actionclassinstance->error = 0;
|
||||
$actionclassinstance->errors = array();
|
||||
// Clean class (an error may have been set from a previous call of another method for same module/hook)
|
||||
$actionclassinstance->error = 0;
|
||||
$actionclassinstance->errors = array();
|
||||
|
||||
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", action=".$action." context=".$context, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", action=".$action." context=".$context, LOG_DEBUG);
|
||||
|
||||
// Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
|
||||
$parameters['currentcontext'] = $context;
|
||||
// Hooks that must return int (hooks with type 'addreplace')
|
||||
if ($hooktype == 'addreplace')
|
||||
{
|
||||
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
|
||||
{
|
||||
$error++;
|
||||
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
|
||||
}
|
||||
// Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
|
||||
$parameters['currentcontext'] = $context;
|
||||
// Hooks that must return int (hooks with type 'addreplace')
|
||||
if ($hooktype == 'addreplace')
|
||||
{
|
||||
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
|
||||
{
|
||||
$error++;
|
||||
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
|
||||
}
|
||||
|
||||
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (!empty($actionclassinstance->resprints)) $this->resPrint .= $actionclassinstance->resprints;
|
||||
}
|
||||
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||
else {
|
||||
// TODO. this test should be done into the method of hook by returning nothing
|
||||
if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
|
||||
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (!empty($actionclassinstance->resprints)) $this->resPrint .= $actionclassinstance->resprints;
|
||||
}
|
||||
// Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
|
||||
else {
|
||||
// TODO. this test should be done into the method of hook by returning nothing
|
||||
if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
|
||||
|
||||
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
||||
$resaction = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
||||
$resaction = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||
|
||||
if (!empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (!empty($actionclassinstance->resprints)) $this->resPrint .= $actionclassinstance->resprints;
|
||||
if (is_numeric($resaction) && $resaction < 0)
|
||||
{
|
||||
$error++;
|
||||
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
|
||||
}
|
||||
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
|
||||
if (!is_array($resaction) && !is_numeric($resaction))
|
||||
{
|
||||
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
|
||||
if (empty($actionclassinstance->resprints)) { $this->resPrint .= $resaction; $resaction = 0; }
|
||||
}
|
||||
}
|
||||
if (!empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
|
||||
if (!empty($actionclassinstance->resprints)) $this->resPrint .= $actionclassinstance->resprints;
|
||||
if (is_numeric($resaction) && $resaction < 0)
|
||||
{
|
||||
$error++;
|
||||
$this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||
dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
|
||||
}
|
||||
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
|
||||
if (!is_array($resaction) && !is_numeric($resaction))
|
||||
{
|
||||
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
|
||||
if (empty($actionclassinstance->resprints)) { $this->resPrint .= $resaction; $resaction = 0; }
|
||||
}
|
||||
}
|
||||
|
||||
//print "After hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
//print "After hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction."<br>\n";
|
||||
|
||||
unset($actionclassinstance->results);
|
||||
unset($actionclassinstance->resprints);
|
||||
}
|
||||
}
|
||||
}
|
||||
unset($actionclassinstance->results);
|
||||
unset($actionclassinstance->resprints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ($error ? -1 : $resaction);
|
||||
return ($error ? -1 : $resaction);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,25 +1083,6 @@ class Form
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return HTML code to select a company.
|
||||
*
|
||||
* @param int $selected Preselected products
|
||||
* @param string $htmlname Name of HTML select field (must be unique in page)
|
||||
* @param int $filter Filter on thirdparty
|
||||
* @param int $limit Limit on number of returned lines
|
||||
* @param array $ajaxoptions Options for ajax_autocompleter
|
||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||
* @return string Return select box for thirdparty.
|
||||
* @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0)
|
||||
*/
|
||||
public function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
return $this->select_thirdparty_list($selected, $htmlname, $filter, 1, 0, $forcecombo, array(), '', 0, $limit);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Output html form to select a third party
|
||||
@ -3460,6 +3441,7 @@ class Form
|
||||
}
|
||||
print '</select>';
|
||||
if ($user->admin && empty($noinfoadmin)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print ajax_combobox($htmlname);
|
||||
}
|
||||
|
||||
|
||||
@ -3529,6 +3511,7 @@ class Form
|
||||
}
|
||||
print '</select>';
|
||||
if ($user->admin && !$noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print ajax_combobox('select'.$htmlname);
|
||||
}
|
||||
|
||||
|
||||
@ -5315,6 +5298,7 @@ class Form
|
||||
}
|
||||
|
||||
// Analysis of the pre-selection date
|
||||
$reg = array();
|
||||
if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/', $set_time, $reg)) // deprecated usage
|
||||
{
|
||||
// Date format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS'
|
||||
@ -5807,7 +5791,7 @@ class Form
|
||||
* @param int $disabled 1=Html component is disabled
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @return string Return HTML string
|
||||
* @see selectForFormsList() select_thirdparty()
|
||||
* @see selectForFormsList() select_thirdparty_list()
|
||||
*/
|
||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '')
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -170,7 +170,7 @@ class FormProjets
|
||||
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql .= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
|
||||
elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||
{
|
||||
$sql .= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)";
|
||||
$sql .= " AND (p.fk_soc IN (".$socid.", ".((int) $conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY).") OR p.fk_soc IS NULL)";
|
||||
}
|
||||
}
|
||||
if (!empty($filterkey)) $sql .= natural_search(array('p.title', 'p.ref'), $filterkey);
|
||||
@ -368,6 +368,7 @@ class FormProjets
|
||||
} else $out .= ' ';
|
||||
$out .= '</option>';
|
||||
}
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@ -388,6 +389,18 @@ class FormProjets
|
||||
|
||||
$labeltoshow = '';
|
||||
|
||||
$disabled = 0;
|
||||
if ($obj->fk_statut == Project::STATUS_DRAFT)
|
||||
{
|
||||
$disabled = 1;
|
||||
} elseif ($obj->fk_statut == Project::STATUS_CLOSED)
|
||||
{
|
||||
if ($discard_closed == 2) $disabled = 1;
|
||||
} elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled = 1;
|
||||
}
|
||||
|
||||
if ($showproject == 'all')
|
||||
{
|
||||
$labeltoshow .= dol_trunc($obj->ref, 18); // Project ref
|
||||
|
||||
@ -173,6 +173,7 @@ class Menubase
|
||||
global $conf, $langs;
|
||||
|
||||
// Clean parameters
|
||||
if (!isset($this->enabled)) $this->enabled = '1';
|
||||
$this->menu_handler = trim($this->menu_handler);
|
||||
$this->module = trim($this->module);
|
||||
$this->type = trim($this->type);
|
||||
|
||||
@ -90,7 +90,7 @@ abstract class DoliDB implements Database
|
||||
public function idate($param)
|
||||
{
|
||||
// TODO GMT $param should be gmt, so we should add tzouptut to 'gmt'
|
||||
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
|
||||
return dol_print_date($param, "%Y-%m-%d %H:%M:%S", 'tzserver');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -234,8 +234,11 @@ class DoliDBPgsql extends DoliDB
|
||||
// on update defaulted by now
|
||||
$line = preg_replace('/(\s*)tms(\s*)timestamp/i', '\\1tms timestamp without time zone DEFAULT now() NOT NULL', $line);
|
||||
|
||||
// nuke DEFAULT CURRENT_TIMESTAMP
|
||||
$line = preg_replace('/(\s*)DEFAULT(\s*)CURRENT_TIMESTAMP/i', '\\1', $line);
|
||||
|
||||
// nuke ON UPDATE CURRENT_TIMESTAMP
|
||||
$line = preg_replace('/(\s*)on(\s*)update(\s*)CURRENT_TIMESTAMP/i', '\\1', $line);
|
||||
$line = preg_replace('/(\s*)ON(\s*)UPDATE(\s*)CURRENT_TIMESTAMP/i', '\\1', $line);
|
||||
|
||||
// unique index(field1,field2)
|
||||
if (preg_match('/unique index\s*\((\w+\s*,\s*\w+)\)/i', $line))
|
||||
|
||||
@ -146,30 +146,30 @@ function ecm_prepare_head_fm($object)
|
||||
*/
|
||||
function ecm_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf;
|
||||
$langs->load("ecm");
|
||||
global $langs, $conf;
|
||||
$langs->load("ecm");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/ecm.php";
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$head[$h][2] = 'ecm';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT."/admin/ecm.php";
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$head[$h][2] = 'ecm';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsEcmFiles");
|
||||
$head[$h][2] = 'attributes_ecm_files';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_files_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsEcmFiles");
|
||||
$head[$h][2] = 'attributes_ecm_files';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories");
|
||||
$head[$h][2] = 'attributes_ecm_directories';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/ecm_directories_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsEcmDirectories");
|
||||
$head[$h][2] = 'attributes_ecm_directories';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin');
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin');
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin', 'remove');
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'ecm_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -1533,7 +1533,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
$nbok = 0;
|
||||
for ($i = 0; $i < $nbfile; $i++)
|
||||
{
|
||||
if (empty($TFile['name'][$i])) continue; // For example, when submitting a form with no file name
|
||||
if (empty($TFile['name'][$i])) continue; // For example, when submitting a form with no file name
|
||||
|
||||
// Define $destfull (path to file including filename) and $destfile (only filename)
|
||||
$destfull = $upload_dir."/".$TFile['name'][$i];
|
||||
@ -2053,7 +2053,7 @@ function dol_uncompress($inputfile, $outputdir)
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
if (preg_match('/\.\./', $zip->getNameIndex($i))) {
|
||||
dol_syslog("Warning: Try to unzip a file with a transversal path ".$zip->getNameIndex($i), LOG_WARNING);
|
||||
continue; // Discard the file
|
||||
continue; // Discard the file
|
||||
}
|
||||
$zip->extractTo($outputdir.'/', array($zip->getNameIndex($i)));
|
||||
}
|
||||
|
||||
@ -84,8 +84,8 @@ function getEntity($element, $shared = 1, $currentobject = null)
|
||||
|
||||
// fix different element names (France to English)
|
||||
switch ($element) {
|
||||
case 'contrat': $element = 'contract'; break; // "/contrat/class/contrat.class.php"
|
||||
case 'order_supplier': $element = 'supplier_order'; break; // "/fourn/class/fournisseur.commande.class.php"
|
||||
case 'contrat': $element = 'contract'; break; // "/contrat/class/contrat.class.php"
|
||||
case 'order_supplier': $element = 'supplier_order'; break; // "/fourn/class/fournisseur.commande.class.php"
|
||||
}
|
||||
|
||||
if (is_object($mc))
|
||||
@ -1209,6 +1209,38 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML code to output a button to open a dialog popup box.
|
||||
* Such buttons must be included inside a HTML form.
|
||||
*
|
||||
* @param string $name A name for the html component
|
||||
* @param string $label Label of button
|
||||
* @param string $buttonstring button string
|
||||
* @param string $url Url to open
|
||||
* @param string $disabled Disabled text
|
||||
* @return string HTML component with button
|
||||
*/
|
||||
function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled = '')
|
||||
{
|
||||
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
|
||||
$out = '<a class="button bordertransp button_'.$name.'"'.$disabled.' title="'.dol_escape_htmltag($label).'">'.$buttonstring.'</a>';
|
||||
$out .= '<script language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
jQuery(".button_'.$name.'").click(function () {
|
||||
var $dialog = $(\'<div></div>\').html(\'<iframe class="iframedialog" style="border: 0px;" src="'.DOL_URL_ROOT.$url.'" width="100%" height="98%"></iframe>\')
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
modal: true,
|
||||
height: (window.innerHeight - 150),
|
||||
width: \'80%\',
|
||||
title: "'.dol_escape_js($label).'"
|
||||
});
|
||||
$dialog.dialog(\'open\');
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show tab header of a card
|
||||
@ -1224,6 +1256,7 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename =
|
||||
* @param int $limittoshow Limit number of tabs to show. Use 0 to use automatic default value.
|
||||
* @param string $moretabssuffix A suffix to use when you have several dol_get_fiche_head() in same page
|
||||
* @return void
|
||||
* @deprecated Use print dol_get_fiche_head() instead
|
||||
*/
|
||||
function dol_fiche_head($links = array(), $active = '0', $title = '', $notab = 0, $picto = '', $pictoisfullpath = 0, $morehtmlright = '', $morecss = '', $limittoshow = 0, $moretabssuffix = '')
|
||||
{
|
||||
@ -1371,7 +1404,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
$tabsname = $moretabssuffix;
|
||||
if (empty($tabsname)) { $tabsname = str_replace("@", "", $picto); }
|
||||
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
|
||||
$out .= '<a href="#" class="tab moretab inline-block tabunactive">'.$langs->trans("More").'... ('.$nbintab.')</a>'; // Do not use "reposition" class in the "More".
|
||||
$out .= '<a href="#" class="tab moretab inline-block tabunactive">'.$langs->trans("More").'... ('.$nbintab.')</a>'; // Do not use "reposition" class in the "More".
|
||||
$out .= '<div id="moretabsList'.$tabsname.'" style="width: '.$widthofpopup.'px; position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px; z-index:10;">';
|
||||
$out .= $outmore;
|
||||
$out .= '</div>';
|
||||
@ -1382,7 +1415,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
||||
$out .= "$('#moretabs".$tabsname."').mouseenter( function() {
|
||||
var x = this.offsetLeft, y = this.offsetTop;
|
||||
console.log('mouseenter ".$left." x='+x+' y='+y+' window.innerWidth='+window.innerWidth);
|
||||
if ((window.innerWidth - x) < ".($widthofpopup+10).") {
|
||||
if ((window.innerWidth - x) < ".($widthofpopup + 10).") {
|
||||
$('#moretabsList".$tabsname."').css('".$right."','8px');
|
||||
}
|
||||
$('#moretabsList".$tabsname."').css('".$left."','auto');
|
||||
@ -2775,7 +2808,7 @@ function getUserRemoteIP()
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here
|
||||
}
|
||||
} else {
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; // value is clean here
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; // value is clean here
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
@ -3100,7 +3133,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title',
|
||||
'help', 'holiday',
|
||||
'intervention', 'label', 'language', 'list', 'listlight', 'lot',
|
||||
'map-marker-alt', 'money-bill-alt', 'mrp', 'note',
|
||||
'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'next',
|
||||
'object_accounting', 'object_account', 'object_accountline', 'object_action', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom',
|
||||
'object_category', 'object_conversation', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder',
|
||||
'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser',
|
||||
@ -3114,7 +3147,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member',
|
||||
'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'object_website',
|
||||
'off', 'on', 'order',
|
||||
'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
|
||||
'paiment', 'play', 'playdisabled', 'previous', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip',
|
||||
'setup', 'share-alt', 'sign-out', 'split', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
|
||||
'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
|
||||
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
|
||||
@ -3148,7 +3181,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'email'=>'at',
|
||||
'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'question-circle',
|
||||
'generic'=>'file', 'holiday'=>'umbrella-beach', 'label'=>'layer-group',
|
||||
'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users',
|
||||
'member'=>'users', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
|
||||
'trip'=>'wallet', 'group'=>'users',
|
||||
'sign-out'=>'sign-out-alt',
|
||||
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
|
||||
'bank'=>'university', 'close_title'=>'window-close', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
|
||||
@ -3159,7 +3193,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature',
|
||||
'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
|
||||
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
|
||||
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
|
||||
'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'previous'=>'arrow-alt-circle-left', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell',
|
||||
'refresh'=>'redo', 'resource'=>'laptop-house',
|
||||
'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
|
||||
'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
|
||||
@ -4015,7 +4049,7 @@ function dol_print_error($db = '', $error = '', $errors = null)
|
||||
}
|
||||
|
||||
// Return a http error code if possible
|
||||
if (! headers_sent()) {
|
||||
if (!headers_sent()) {
|
||||
http_response_code(500);
|
||||
}
|
||||
|
||||
@ -4342,6 +4376,7 @@ function print_barre_liste($titre, $page, $file, $options = '', $sortfield = '',
|
||||
|
||||
// Right
|
||||
print '<td class="nobordernopadding valignmiddle right">';
|
||||
print '<input type="hidden" name="pageplusoneold" value="'.($page+1).'">';
|
||||
if ($sortfield) $options .= "&sortfield=".urlencode($sortfield);
|
||||
if ($sortorder) $options .= "&sortorder=".urlencode($sortorder);
|
||||
// Show navigation bar
|
||||
@ -7800,7 +7835,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
$numnewcrit = price2num($newcrit);
|
||||
if (is_numeric($numnewcrit))
|
||||
{
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$db->sanitize($numnewcrit); // should be a numeric
|
||||
} else {
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false
|
||||
}
|
||||
@ -7808,7 +7843,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
|
||||
}
|
||||
} elseif ($mode == 2 || $mode == -2)
|
||||
{
|
||||
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
|
||||
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '').$field." ".($mode == -2 ? 'NOT ' : '');
|
||||
$newres .= $crit ? "IN (".$db->sanitize($db->escape($crit)).")" : "IN (0)";
|
||||
if ($mode == -2) $newres .= ' OR '.$field.' IS NULL';
|
||||
@ -8336,7 +8371,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
|
||||
|
||||
/**
|
||||
* Function dolGetStatus
|
||||
* Output the badge of a status.
|
||||
*
|
||||
* @param string $statusLabel Label of badge no html : use in alt attribute for accessibility
|
||||
* @param string $statusLabelShort Short label of badge no html
|
||||
@ -8344,7 +8379,7 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
|
||||
* @param string $statusType status0 status1 status2 status3 status4 status5 status6 status7 status8 status9 : image name or badge name
|
||||
* @param int $displayMode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto
|
||||
* @param string $url The url for link
|
||||
* @param array $params Various params for future : recommended rather than adding more function arguments
|
||||
* @param array $params Various params. Example: array('tooltip'=>'...', 'badgeParams'=>...)
|
||||
* @return string Html status string
|
||||
*/
|
||||
function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $statusType = 'status0', $displayMode = 0, $url = '', $params = array())
|
||||
@ -8413,7 +8448,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
$statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort);
|
||||
|
||||
$dolGetBadgeParams['attr']['class'] = 'badge-status';
|
||||
$dolGetBadgeParams['attr']['title'] = $statusLabel;
|
||||
$dolGetBadgeParams['attr']['title'] = empty($params['tooltip']) ? $statusLabel : $params['tooltip'];
|
||||
|
||||
if ($displayMode == 3) {
|
||||
$return = dolGetBadge((empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)), '', $statusType, 'dot', $url, $dolGetBadgeParams);
|
||||
@ -8946,8 +8981,8 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
|
||||
|
||||
if ($method == -1) {
|
||||
$method = 0;
|
||||
if (! empty($conf->global->MAIN_FORCE_READFILE_WITH_FREAD)) $method = 1;
|
||||
if (! empty($conf->global->MAIN_FORCE_READFILE_WITH_STREAM_COPY)) $method = 2;
|
||||
if (!empty($conf->global->MAIN_FORCE_READFILE_WITH_FREAD)) $method = 1;
|
||||
if (!empty($conf->global->MAIN_FORCE_READFILE_WITH_STREAM_COPY)) $method = 2;
|
||||
}
|
||||
|
||||
// Be sure we don't have output buffering enabled to have readfile working correctly
|
||||
|
||||
@ -2384,3 +2384,77 @@ function price2fec($amount)
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the syntax of some PHP code.
|
||||
*
|
||||
* @param string $code PHP code to check.
|
||||
* @return boolean|array If false, then check was successful, otherwise an array(message,line) of errors is returned.
|
||||
*/
|
||||
function phpSyntaxError($code)
|
||||
{
|
||||
if (!defined("CR")) define("CR", "\r");
|
||||
if (!defined("LF")) define("LF", "\n");
|
||||
if (!defined("CRLF")) define("CRLF", "\r\n");
|
||||
|
||||
$braces=0;
|
||||
$inString=0;
|
||||
foreach (token_get_all('<?php ' . $code) as $token) {
|
||||
if (is_array($token)) {
|
||||
switch ($token[0]) {
|
||||
case T_CURLY_OPEN:
|
||||
case T_DOLLAR_OPEN_CURLY_BRACES:
|
||||
case T_START_HEREDOC: ++$inString; break;
|
||||
case T_END_HEREDOC: --$inString; break;
|
||||
}
|
||||
} elseif ($inString & 1) {
|
||||
switch ($token) {
|
||||
case '`':
|
||||
case '\'':
|
||||
case '"': --$inString; break;
|
||||
}
|
||||
} else {
|
||||
switch ($token) {
|
||||
case '`':
|
||||
case '\'':
|
||||
case '"': ++$inString; break;
|
||||
case '{': ++$braces; break;
|
||||
case '}':
|
||||
if ($inString) {
|
||||
--$inString;
|
||||
} else {
|
||||
--$braces;
|
||||
if ($braces < 0) break 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$inString = @ini_set('log_errors', false);
|
||||
$token = @ini_set('display_errors', true);
|
||||
ob_start();
|
||||
$code = substr($code, strlen('<?php '));
|
||||
$braces || $code = "if(0){{$code}\n}";
|
||||
if (eval($code) === false) {
|
||||
if ($braces) {
|
||||
$braces = PHP_INT_MAX;
|
||||
} else {
|
||||
false !== strpos($code, CR) && $code = strtr(str_replace(CRLF, LF, $code), CR, LF);
|
||||
$braces = substr_count($code, LF);
|
||||
}
|
||||
$code = ob_get_clean();
|
||||
$code = strip_tags($code);
|
||||
if (preg_match("'syntax error, (.+) in .+ on line (\d+)$'s", $code, $code)) {
|
||||
$code[2] = (int) $code[2];
|
||||
$code = $code[2] <= $braces
|
||||
? array($code[1], $code[2])
|
||||
: array('unexpected $end' . substr($code[1], 14), $braces);
|
||||
} else $code = array('syntax error', 0);
|
||||
} else {
|
||||
ob_end_clean();
|
||||
$code = false;
|
||||
}
|
||||
@ini_set('display_errors', $token);
|
||||
@ini_set('log_errors', $inString);
|
||||
return $code;
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
// Define size of logo small and mini
|
||||
$maxwidthsmall = 350; $maxheightsmall = 200; // Near 16/9eme
|
||||
$maxwidthsmall = 480; $maxheightsmall = 270; // Near 16/9eme
|
||||
$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme
|
||||
$quality = 80;
|
||||
|
||||
|
||||
@ -29,30 +29,30 @@
|
||||
function payment_prepare_head(Paiement $object)
|
||||
{
|
||||
|
||||
global $langs, $conf;
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Payment");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Payment");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment');
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove');
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment', 'remove');
|
||||
|
||||
return $head;
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -64,30 +64,30 @@ function payment_prepare_head(Paiement $object)
|
||||
*/
|
||||
function bankline_prepare_head($id)
|
||||
{
|
||||
global $langs, $conf;
|
||||
global $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$id;
|
||||
$head[$h][1] = $langs->trans('BankTransaction');
|
||||
$head[$h][2] = 'bankline';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$id;
|
||||
$head[$h][1] = $langs->trans('BankTransaction');
|
||||
$head[$h][2] = 'bankline';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bankline');
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bankline');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/info.php?rowid='.$id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bankline', 'remove');
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'bankline', 'remove');
|
||||
|
||||
return $head;
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,11 +109,11 @@ function payment_supplier_prepare_head(Paiement $object)
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier');
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_supplier');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/paiement/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Info');
|
||||
@ -170,7 +170,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
global $langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('payment', 'stripe'));
|
||||
$langs->loadLangs(array('payment', 'stripe'));
|
||||
|
||||
$servicename = $langs->transnoentitiesnoconv('Online');
|
||||
|
||||
@ -194,7 +194,7 @@ function showOnlinePaymentUrl($type, $ref)
|
||||
*/
|
||||
function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag = 'your_tag', $localorexternal = 0)
|
||||
{
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
global $conf, $dolibarr_main_url_root;
|
||||
|
||||
$ref = str_replace(' ', '', $ref);
|
||||
$out = '';
|
||||
@ -209,7 +209,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
|
||||
if ($type == 'free')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?amount='.($mode ? '<font color="#666666">' : '').$amount.($mode ? '</font>' : '').'&tag='.($mode ? '<font color="#666666">' : '').$freetag.($mode ? '</font>' : '');
|
||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
||||
{
|
||||
if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN;
|
||||
@ -218,7 +218,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
//if ($mode) $out.='&noidempotency=1';
|
||||
} elseif ($type == 'order')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=order&ref='.($mode ? '<font color="#666666">' : '');
|
||||
if ($mode == 1) $out .= 'order_ref';
|
||||
if ($mode == 0) $out .= urlencode($ref);
|
||||
$out .= ($mode ? '</font>' : '');
|
||||
@ -234,7 +234,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
} elseif ($type == 'invoice')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=invoice&ref='.($mode ? '<font color="#666666">' : '');
|
||||
if ($mode == 1) $out .= 'invoice_ref';
|
||||
if ($mode == 0) $out .= urlencode($ref);
|
||||
$out .= ($mode ? '</font>' : '');
|
||||
@ -250,7 +250,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
} elseif ($type == 'contractline')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=contractline&ref='.($mode ? '<font color="#666666">' : '');
|
||||
if ($mode == 1) $out .= 'contractline_ref';
|
||||
if ($mode == 0) $out .= urlencode($ref);
|
||||
$out .= ($mode ? '</font>' : '');
|
||||
@ -266,7 +266,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
} elseif ($type == 'member' || $type == 'membersubscription')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=membersubscription&ref='.($mode ? '<font color="#666666">' : '');
|
||||
if ($mode == 1) $out .= 'member_ref';
|
||||
if ($mode == 0) $out .= urlencode($ref);
|
||||
$out .= ($mode ? '</font>' : '');
|
||||
@ -283,7 +283,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
}
|
||||
if ($type == 'donation')
|
||||
{
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : '');
|
||||
$out = $urltouse.'/public/payment/newpayment.php?source=donation&ref='.($mode ? '<font color="#666666">' : '');
|
||||
if ($mode == 1) $out .= 'donation_ref';
|
||||
if ($mode == 0) $out .= urlencode($ref);
|
||||
$out .= ($mode ? '</font>' : '');
|
||||
@ -319,82 +319,82 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag
|
||||
*/
|
||||
function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, $suffix = '', $object = null)
|
||||
{
|
||||
global $conf;
|
||||
global $conf;
|
||||
|
||||
// Juridical status
|
||||
$line1 = "";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
// Juridical status
|
||||
$line1 = "";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$line1 .= ($line1 ? " - " : "").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$line1 .= ($line1 ? " - " : "").$langs->transnoentities("CapitalOf", $fromcompany->capital)." ".$langs->transnoentities("Currency".$conf->currency);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2))
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId1", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof1;
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->idprof2)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId2", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line1 .= ($line1 ? " - " : "").$field.": ".$fromcompany->idprof2;
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
$line2 = "";
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
// Second line of company infos
|
||||
$line2 = "";
|
||||
// Prof Id 3
|
||||
if ($fromcompany->idprof3)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId3", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof3;
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->idprof4)
|
||||
{
|
||||
$field = $langs->transcountrynoentities("ProfId4", $fromcompany->country_code);
|
||||
if (preg_match('/\((.*)\)/i', $field, $reg)) $field = $reg[1];
|
||||
$line2 .= ($line2 ? " - " : "").$field.": ".$fromcompany->idprof4;
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$line2 .= ($line2 ? " - " : "").$langs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
|
||||
}
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<div class="center">'."\n";
|
||||
if ($addformmessage)
|
||||
{
|
||||
print '<!-- object = '.$object->element.' -->';
|
||||
print '<br>';
|
||||
print '<div class="center">'."\n";
|
||||
if ($addformmessage)
|
||||
{
|
||||
print '<!-- object = '.$object->element.' -->';
|
||||
print '<br>';
|
||||
|
||||
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
|
||||
if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
|
||||
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORM_'.$suffix;
|
||||
if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORM)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORM);
|
||||
|
||||
// Add other message if VAT exists
|
||||
if ($object->total_vat != 0 || $object->total_tva != 0)
|
||||
{
|
||||
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
|
||||
if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
|
||||
}
|
||||
}
|
||||
// Add other message if VAT exists
|
||||
if ($object->total_vat != 0 || $object->total_tva != 0)
|
||||
{
|
||||
$parammessageform = 'ONLINE_PAYMENT_MESSAGE_FORMIFVAT_'.$suffix;
|
||||
if (!empty($conf->global->$parammessageform)) print $langs->transnoentities($conf->global->$parammessageform);
|
||||
elseif (!empty($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT)) print $langs->transnoentities($conf->global->ONLINE_PAYMENT_MESSAGE_FORMIFVAT);
|
||||
}
|
||||
}
|
||||
|
||||
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
||||
print $fromcompany->name.'<br>';
|
||||
print $line1;
|
||||
if (strlen($line1.$line2) > 50) print '<br>';
|
||||
else print ' - ';
|
||||
print $line2;
|
||||
print '</font></div>'."\n";
|
||||
print '<font style="font-size: 10px;"><br><hr>'."\n";
|
||||
print $fromcompany->name.'<br>';
|
||||
print $line1;
|
||||
if (strlen($line1.$line2) > 50) print '<br>';
|
||||
else print ' - ';
|
||||
print $line2;
|
||||
print '</font></div>'."\n";
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ function pdf_getInstance($format = '', $metric = 'mm', $pagetype = 'P')
|
||||
define('K_SMALL_RATIO', 2 / 3);
|
||||
define('K_THAI_TOPCHARS', true);
|
||||
define('K_TCPDF_CALLS_IN_HTML', true);
|
||||
if (! empty($conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE)) {
|
||||
if (!empty($conf->global->TCPDF_THROW_ERRORS_INSTEAD_OF_DIE)) {
|
||||
define('K_TCPDF_THROW_EXCEPTION_ERROR', true);
|
||||
} else {
|
||||
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
|
||||
@ -2140,11 +2140,11 @@ function pdf_getLinkedObjects($object, $outputlangs)
|
||||
if (empty($object->linkedObjects['commande']) && $object->element != 'commande') // There is not already a link to order and object is not the order, so we show also info with order
|
||||
{
|
||||
$elementobject->fetchObjectLinked(null, '', null, '', 'OR', 1, 'sourcetype', 0);
|
||||
if (! empty($elementobject->linkedObjectsIds['commande'])){
|
||||
if (!empty($elementobject->linkedObjectsIds['commande'])) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$order = new Commande($db);
|
||||
$ret = $order->fetch(reset($elementobject->linkedObjectsIds['commande']));
|
||||
if ($ret < 1) { $order=null; }
|
||||
if ($ret < 1) { $order = null; }
|
||||
}
|
||||
}
|
||||
if (!is_object($order))
|
||||
|
||||
@ -30,23 +30,23 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
/**
|
||||
* Prepare array with list of tabs
|
||||
*
|
||||
* @param Object $object Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
* @param Project $project Object related to tabs
|
||||
* @return array Array of tabs to show
|
||||
*/
|
||||
function project_prepare_head($object)
|
||||
function project_prepare_head(Project $project)
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/card.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("Project");
|
||||
$head[$h][2] = 'project';
|
||||
$h++;
|
||||
|
||||
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$object->id;
|
||||
$nbContact = count($project->liste_contact(-1, 'internal')) + count($project->liste_contact(-1, 'external'));
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/contact.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("ProjectContact");
|
||||
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbContact.'</span>';
|
||||
$head[$h][2] = 'contact';
|
||||
@ -55,12 +55,12 @@ function project_prepare_head($object)
|
||||
if (empty($conf->global->PROJECT_HIDE_TASKS))
|
||||
{
|
||||
// Then tab for sub level of projet, i mean tasks
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("Tasks");
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
|
||||
$taskstatic = new Task($db);
|
||||
$nbTasks = count($taskstatic->getTasksArray(0, 0, $object->id, 0, 0));
|
||||
$nbTasks = count($taskstatic->getTasksArray(0, 0, $project->id, 0, 0));
|
||||
if ($nbTasks > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbTasks).'</span>';
|
||||
$head[$h][2] = 'tasks';
|
||||
$h++;
|
||||
@ -71,7 +71,7 @@ function project_prepare_head($object)
|
||||
//$sql .= " WHERE t.fk_user = u.rowid AND t.fk_task = pt.rowid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t, ".MAIN_DB_PREFIX."projet_task as pt";
|
||||
$sql .= " WHERE t.fk_task = pt.rowid";
|
||||
$sql .= " AND pt.fk_projet =".$object->id;
|
||||
$sql .= " AND pt.fk_projet =".$project->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -79,7 +79,7 @@ function project_prepare_head($object)
|
||||
if ($obj) $nbTimeSpent = 1;
|
||||
} else dol_print_error($db);
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&projectid='.$project->id;
|
||||
$head[$h][1] = $langs->trans("TimeSpent");
|
||||
if ($nbTimeSpent > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">...</span>';
|
||||
$head[$h][2] = 'timespent';
|
||||
@ -91,8 +91,32 @@ function project_prepare_head($object)
|
||||
|| !empty($conf->facture->enabled) || !empty($conf->contrat->enabled)
|
||||
|| !empty($conf->ficheinter->enabled) || !empty($conf->agenda->enabled) || !empty($conf->deplacement->enabled))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
|
||||
$count = 0;
|
||||
|
||||
if (!empty($conf->propal->enabled)) $count += $project->getElementCount('propal', 'propal');
|
||||
if (!empty($conf->commande->enabled)) $count += $project->getElementCount('order', 'commande');
|
||||
if (!empty($conf->facture->enabled)) $count += $project->getElementCount('invoice', 'facture');
|
||||
if (!empty($conf->facture->enabled)) $count += $project->getElementCount('invoice_predefined', 'facture_rec');
|
||||
if (!empty($conf->supplier_proposal->enabled)) $count += $project->getElementCount('proposal_supplier', 'supplier_proposal');
|
||||
if (!empty($conf->supplier_order->enabled)) $count += $project->getElementCount('order_supplier', 'commande_fournisseur');
|
||||
if (!empty($conf->supplier_invoice->enabled)) $count += $project->getElementCount('invoice_supplier', 'facture_fourn');
|
||||
if (!empty($conf->contrat->enabled)) $count += $project->getElementCount('contract', 'contrat');
|
||||
if (!empty($conf->ficheinter->enabled)) $count += $project->getElementCount('intervention', 'fichinter');
|
||||
if (!empty($conf->expedition->enabled)) $count += $project->getElementCount('shipping', 'expedition');
|
||||
if (!empty($conf->mrp->enabled)) $count += $project->getElementCount('mrp', 'mrp_mo', 'fk_project');
|
||||
if (!empty($conf->deplacement->enabled)) $count += $project->getElementCount('trip', 'deplacement');
|
||||
if (!empty($conf->expensereport->enabled)) $count += $project->getElementCount('expensereport', 'expensereport');
|
||||
if (!empty($conf->don->enabled)) $count += $project->getElementCount('donation', 'don');
|
||||
if (!empty($conf->loan->enabled)) $count += $project->getElementCount('loan', 'loan');
|
||||
if (!empty($conf->tax->enabled)) $count += $project->getElementCount('chargesociales', 'chargesociales');
|
||||
if (!empty($conf->projet->enabled)) $count += $project->getElementCount('project_task', 'projet_task');
|
||||
if (!empty($conf->stock->enabled)) $count += $project->getElementCount('stock_mouvement', 'stock');
|
||||
if (!empty($conf->salaries->enabled)) $count += $project->getElementCount('salaries', 'payment_salary');
|
||||
if (!empty($conf->banque->enabled)) $count += $project->getElementCount('variouspayment', 'payment_various');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("ProjectOverview");
|
||||
if ($count > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$count.'</span>';
|
||||
$head[$h][2] = 'element';
|
||||
$h++;
|
||||
}
|
||||
@ -101,15 +125,15 @@ function project_prepare_head($object)
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'project');
|
||||
complete_head_from_modules($conf, $langs, $project, $head, $h, 'project');
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||
{
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) $nbNote++;
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$object->id;
|
||||
if (!empty($project->note_private)) $nbNote++;
|
||||
if (!empty($project->note_public)) $nbNote++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/note.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbNote.'</span>';
|
||||
$head[$h][2] = 'notes';
|
||||
@ -118,10 +142,10 @@ function project_prepare_head($object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($project->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$object->id;
|
||||
$nbLinks = Link::count($db, $project->element, $project->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/document.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][2] = 'document';
|
||||
@ -130,15 +154,15 @@ function project_prepare_head($object)
|
||||
// Manage discussion
|
||||
if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT))
|
||||
{
|
||||
$nbComments = $object->getNbComments();
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$object->id;
|
||||
$nbComments = $project->getNbComments();
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/comment.php?id='.$project->id;
|
||||
$head[$h][1] = $langs->trans("CommentLink");
|
||||
if ($nbComments > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbComments.'</span>';
|
||||
$head[$h][2] = 'project_comment';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/projet/info.php?id='.$project->id;
|
||||
$head[$h][1] .= $langs->trans("Events");
|
||||
if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
|
||||
{
|
||||
@ -148,7 +172,7 @@ function project_prepare_head($object)
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'project', 'remove');
|
||||
complete_head_from_modules($conf, $langs, $project, $head, $h, 'project', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -1048,7 +1048,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills_paid&search_status=2", $langs->trans("BillShortStatusPaid"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_paid');
|
||||
}
|
||||
|
||||
$newmenu->add("/fourn/facture/paiement.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
|
||||
$newmenu->add("/fourn/paiement/list.php?leftmenu=suppliers_bills_payment", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_payment');
|
||||
|
||||
$newmenu->add("/fourn/facture/rapport.php?leftmenu=suppliers_bills_report", $langs->trans("Reportings"), 2, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills_report');
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||
|
||||
/**
|
||||
* Class to build export files with Excel format
|
||||
@ -59,6 +60,8 @@ class ExportExcel2007new extends ModeleExports
|
||||
|
||||
public $worksheet; // Handle sheet
|
||||
|
||||
public $styleArray;
|
||||
|
||||
public $row;
|
||||
|
||||
public $col;
|
||||
@ -436,4 +439,204 @@ class ExportExcel2007new extends ModeleExports
|
||||
|
||||
return $letter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cell value and automatically merge if we give an endcell
|
||||
*
|
||||
* @param string $val cell value
|
||||
* @param string $startCell starting cell
|
||||
* @param string $endCell ending cell
|
||||
* @return int 1 if success -1 if failed
|
||||
*/
|
||||
public function setCellValue($val, $startCell, $endCell = '')
|
||||
{
|
||||
try {
|
||||
$this->workbook->getActiveSheet()->setCellValue($startCell, $val);
|
||||
|
||||
if (! empty($endCell)) {
|
||||
$cellRange = $startCell.':'.$endCell;
|
||||
$this->workbook->getActiveSheet()->mergeCells($startCell.':'.$endCell);
|
||||
}
|
||||
else $cellRange = $startCell;
|
||||
if (! empty($this->styleArray)) $this->workbook->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styleArray);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set border style
|
||||
*
|
||||
* @param string $thickness style \PhpOffice\PhpSpreadsheet\Style\Border
|
||||
* @param string $color color \PhpOffice\PhpSpreadsheet\Style\Color
|
||||
* @return int 1 if ok
|
||||
*/
|
||||
public function setBorderStyle($thickness, $color)
|
||||
{
|
||||
$this->styleArray['borders'] = array(
|
||||
'outline' => array(
|
||||
'borderStyle' => $thickness,
|
||||
'color' => array('argb' => $color)
|
||||
)
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set font style
|
||||
*
|
||||
* @param bool $bold true if bold
|
||||
* @param string $color color \PhpOffice\PhpSpreadsheet\Style\Color
|
||||
* @return int 1
|
||||
*/
|
||||
public function setFontStyle($bold, $color)
|
||||
{
|
||||
$this->styleArray['font'] = array(
|
||||
'color' => array('argb' => $color),
|
||||
'bold' => $bold
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set alignment style (horizontal, left, right, ...)
|
||||
*
|
||||
* @param string $horizontal PhpOffice\PhpSpreadsheet\Style\Alignment
|
||||
* @return int 1
|
||||
*/
|
||||
public function setAlignmentStyle($horizontal)
|
||||
{
|
||||
$this->styleArray['alignment'] = array('horizontal' => $horizontal);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset Style
|
||||
* @return int 1
|
||||
*/
|
||||
public function resetStyle()
|
||||
{
|
||||
$this->styleArray = array();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a NxN Block in sheet
|
||||
*
|
||||
* @param string $startCell starting cell
|
||||
* @param array $TDatas array(ColumnName=>array(Row value 1, row value 2, etc ...))
|
||||
* @param bool $boldTitle true if bold headers
|
||||
* @return int 1 if OK, -1 if KO
|
||||
*/
|
||||
public function setBlock($startCell, $TDatas = array(), $boldTitle = false)
|
||||
{
|
||||
try {
|
||||
if (! empty($TDatas)) {
|
||||
$startCell = $this->workbook->getActiveSheet()->getCell($startCell);
|
||||
$startColumn = Coordinate::columnIndexFromString($startCell->getColumn());
|
||||
$startRow = $startCell->getRow();
|
||||
foreach ($TDatas as $column => $TRows) {
|
||||
if ($boldTitle) $this->setFontStyle(true, $this->styleArray['font']['color']['argb']);
|
||||
$cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow);
|
||||
$this->setCellValue($column, $cell->getCoordinate());
|
||||
$rowPos = $startRow;
|
||||
if ($boldTitle) $this->setFontStyle(false, $this->styleArray['font']['color']['argb']);
|
||||
foreach ($TRows as $row) {
|
||||
$rowPos++;
|
||||
$cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $rowPos);
|
||||
$this->setCellValue($row, $cell->getCoordinate());
|
||||
}
|
||||
$startColumn++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a 2xN Tab in Sheet
|
||||
*
|
||||
* @param string $startCell A1
|
||||
* @param array $TDatas array(Title=>val)
|
||||
* @param bool $boldTitle true if bold titles
|
||||
* @return int 1 if OK, -1 if KO
|
||||
*/
|
||||
public function setBlock2Columns($startCell, $TDatas = array(), $boldTitle = false)
|
||||
{
|
||||
try {
|
||||
if (! empty($TDatas)) {
|
||||
$startCell = $this->workbook->getActiveSheet()->getCell($startCell);
|
||||
$startColumn = Coordinate::columnIndexFromString($startCell->getColumn());
|
||||
$startRow = $startCell->getRow();
|
||||
foreach ($TDatas as $title => $val) {
|
||||
$cell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow);
|
||||
if ($boldTitle) $this->setFontStyle(true, $this->styleArray['font']['color']['argb']);
|
||||
$this->setCellValue($title, $cell->getCoordinate());
|
||||
if ($boldTitle) $this->setFontStyle(false, $this->styleArray['font']['color']['argb']);
|
||||
$cell2 = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn + 1, $startRow);
|
||||
$this->setCellValue($val, $cell2->getCoordinate());
|
||||
$startRow++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable auto sizing for column range
|
||||
*
|
||||
* @param string $firstColumn first column to autosize
|
||||
* @param string $lastColumn to last column to autosize
|
||||
* @return int 1
|
||||
*/
|
||||
public function enableAutosize($firstColumn, $lastColumn)
|
||||
{
|
||||
foreach (range($firstColumn, $lastColumn) as $columnID) {
|
||||
$this->workbook->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value cell and merging it by giving a starting cell and a length
|
||||
*
|
||||
* @param string $val Cell value
|
||||
* @param string $startCell Starting cell
|
||||
* @param int $length Length
|
||||
* @param int $offset Starting offset
|
||||
* @return string Coordinate or -1 if KO
|
||||
*/
|
||||
public function setMergeCellValueByLength($val, $startCell, $length, $offset = 0)
|
||||
{
|
||||
try {
|
||||
$startCell = $this->workbook->getActiveSheet()->getCell($startCell);
|
||||
$startColumn = Coordinate::columnIndexFromString($startCell->getColumn());
|
||||
if (! empty($offset)) $startColumn += $offset;
|
||||
|
||||
$startRow = $startCell->getRow();
|
||||
$startCell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn, $startRow);
|
||||
$startCoordinate = $startCell->getCoordinate();
|
||||
$this->setCellValue($val, $startCell->getCoordinate());
|
||||
|
||||
$endCell = $this->workbook->getActiveSheet()->getCellByColumnAndRow($startColumn + ($length - 1), $startRow);
|
||||
$endCoordinate = $endCell->getCoordinate();
|
||||
$this->workbook->getActiveSheet()->mergeCells($startCoordinate.':'.$endCoordinate);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->error = $e->getMessage();
|
||||
return -1;
|
||||
}
|
||||
return $endCoordinate;
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,37 +238,35 @@ class mailing_fraise extends MailingTargets
|
||||
$cibles = array();
|
||||
$now = dol_now();
|
||||
|
||||
$dateendsubscriptionafter = dol_mktime($_POST['subscriptionafterhour'], $_POST['subscriptionaftermin'], $_POST['subscriptionaftersec'], $_POST['subscriptionaftermonth'], $_POST['subscriptionafterday'], $_POST['subscriptionafteryear']);
|
||||
$dateendsubscriptionbefore = dol_mktime($_POST['subscriptionbeforehour'], $_POST['subscriptionbeforemin'], $_POST['subscriptionbeforesec'], $_POST['subscriptionbeforemonth'], $_POST['subscriptionbeforeday'], $_POST['subscriptionbeforeyear']);
|
||||
$dateendsubscriptionafter = dol_mktime(GETPOST('subscriptionafterhour', 'int'), GETPOST('subscriptionaftermin', 'int'), GETPOST('subscriptionaftersec', 'int'), GETPOST('subscriptionaftermonth', 'int'), GETPOST('subscriptionafterday', 'int'), GETPOST('subscriptionafteryear', 'int'));
|
||||
$dateendsubscriptionbefore = dol_mktime(GETPOST('subscriptionbeforehour', 'int'), GETPOST('subscriptionbeforemin', 'int'), GETPOST('subscriptionbeforesec', 'int'), GETPOST('subscriptionbeforemonth', 'int'), GETPOST('subscriptionbeforeday', 'int'), GETPOST('subscriptionbeforeyear', 'int'));
|
||||
|
||||
// La requete doit retourner: id, email, fk_contact, name, firstname
|
||||
$sql = "SELECT a.rowid as id, a.email as email, null as fk_contact, ";
|
||||
$sql .= " a.lastname, a.firstname,";
|
||||
$sql .= " a.datefin, a.civility as civility_id, a.login, a.societe"; // Other fields
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."adherent as a";
|
||||
if ($_POST['filter_category'])
|
||||
if (GETPOST('filter_category'))
|
||||
{
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie_member as cm ON cm.fk_member = a.rowid";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON c.rowid = cm.fk_categorie AND c.rowid = ".((int) GETPOST('filter_category', 'int'));
|
||||
}
|
||||
$sql .= " , ".MAIN_DB_PREFIX."adherent_type as ta";
|
||||
$sql .= " WHERE a.entity IN (".getEntity('member').") AND a.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND a.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$this->db->escape($mailing_id).")";
|
||||
// Filter on status
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '-1') {
|
||||
if (GETPOST("filter") == '-1') {
|
||||
$sql .= " AND a.statut=-1";
|
||||
}
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1a') $sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '1b') $sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
if (isset($_POST["filter"]) && $_POST["filter"] == '0') $sql .= " AND a.statut=0";
|
||||
if (GETPOST("filter", 'aZ09') == '1a') $sql .= " AND a.statut=1 AND (a.datefin >= '".$this->db->idate($now)."' OR ta.subscription = 0)";
|
||||
if (GETPOST("filter", 'aZ09') == '1b') $sql .= " AND a.statut=1 AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND ta.subscription = 1)";
|
||||
if (GETPOST("filter", 'aZ09') === '0') $sql .= " AND a.statut=0";
|
||||
// Filter on date
|
||||
if ($dateendsubscriptionafter > 0) $sql .= " AND datefin > '".$this->db->idate($dateendsubscriptionafter)."'";
|
||||
if ($dateendsubscriptionbefore > 0) $sql .= " AND datefin < '".$this->db->idate($dateendsubscriptionbefore)."'";
|
||||
$sql .= " AND a.fk_adherent_type = ta.rowid";
|
||||
// Filter on type
|
||||
if (GETPOSTISSET('filter_type')) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type'))."'";
|
||||
// Filter on category
|
||||
if (GETPOSTISSET('filter_category')) $sql .= " AND c.rowid='".$this->db->escape(GETPOST('filter_category'))."'";
|
||||
if (GETPOST('filter_type', 'int') > 0) $sql .= " AND ta.rowid='".$this->db->escape(GETPOST('filter_type', 'int'))."'";
|
||||
$sql .= " ORDER BY a.email";
|
||||
//print $sql;
|
||||
|
||||
|
||||
@ -265,16 +265,16 @@ class modCommande extends DolibarrModules
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.(empty($user) ? 0 : $user->id);
|
||||
// Imports
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
//Import Order Header
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r] = 'commande_' . $r;
|
||||
$this->import_code[$r] = 'commande_'.$r;
|
||||
$this->import_label[$r] = 'Sales Orders';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'commande', 'extra' => MAIN_DB_PREFIX . 'commande_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'commande', 'extra' => MAIN_DB_PREFIX.'commande_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_fields_array[$r] = [
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_client' => 'RefCustomer',
|
||||
@ -299,7 +299,7 @@ class modCommande extends DolibarrModules
|
||||
'c.model_pdf' => 'Model'
|
||||
];
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
@ -309,23 +309,23 @@ class modCommande extends DolibarrModules
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = [];
|
||||
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande' AND entity IN (0, " . $conf->entity . ")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commande'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'c.ref' => '(CPV\d{4}-\d{4}|CO\d{4}-\d{4}|PROV.{1,32}$)',
|
||||
'c.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
|
||||
'c.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
|
||||
];
|
||||
|
||||
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
|
||||
@ -359,7 +359,7 @@ class modCommande extends DolibarrModules
|
||||
$this->import_label[$r] = 'Order Details';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX . 'commandedet', 'extra' => MAIN_DB_PREFIX . 'commandedet_extrafields'];
|
||||
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX.'commandedet', 'extra' => MAIN_DB_PREFIX.'commandedet_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
'cd.fk_commande' => 'Document Ref*',
|
||||
'cd.fk_parent_line' => 'PrParentLine',
|
||||
@ -382,7 +382,7 @@ class modCommande extends DolibarrModules
|
||||
'cd.rang' => 'LinePosition'
|
||||
];
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
@ -391,22 +391,22 @@ class modCommande extends DolibarrModules
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commandedet' AND entity IN (0, " . $conf->entity . ")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commandedet' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commandedet'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'commandedet'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'cd.product_type' => '[0|1]$',
|
||||
'cd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product',
|
||||
'cd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
|
||||
'cd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product',
|
||||
'cd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'
|
||||
];
|
||||
$this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Sales Order Id', 'cd.fk_product' => 'Product Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
|
||||
@ -63,12 +63,12 @@ class modFournisseur extends DolibarrModules
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array(
|
||||
"/fournisseur/temp",
|
||||
"/fournisseur/commande",
|
||||
"/fournisseur/commande/temp",
|
||||
"/fournisseur/facture",
|
||||
"/fournisseur/facture/temp"
|
||||
);
|
||||
"/fournisseur/temp",
|
||||
"/fournisseur/commande",
|
||||
"/fournisseur/commande/temp",
|
||||
"/fournisseur/facture",
|
||||
"/fournisseur/facture/temp"
|
||||
);
|
||||
|
||||
// Dependencies
|
||||
$this->depends = array("modSociete");
|
||||
@ -299,7 +299,7 @@ class modFournisseur extends DolibarrModules
|
||||
'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'p.accountancy_code_buy'=>'ProductAccountancyBuyCode', 'project.rowid'=>'ProjectId',
|
||||
'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
@ -434,7 +434,7 @@ class modFournisseur extends DolibarrModules
|
||||
'f.fk_statut'=>'InvoiceStatus', 'f.note_public'=>"InvoiceNote", 'p.rowid'=>'PaymentId', 'pf.amount'=>'AmountPayment',
|
||||
'p.datep'=>'DatePayment', 'p.num_paiement'=>'PaymentNumber', 'p.fk_bank'=>'IdTransaction', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
@ -528,7 +528,7 @@ class modFournisseur extends DolibarrModules
|
||||
'fd.total_tva'=>"LineTotalVAT", 'fd.product_type'=>'TypeOfLineServiceOrProduct', 'fd.ref'=>'RefSupplier', 'fd.fk_product'=>'ProductId',
|
||||
'p.ref'=>'ProductRef', 'p.label'=>'ProductLabel', 'project.rowid'=>'ProjectId', 'project.ref'=>'ProjectRef', 'project.title'=>'ProjectLabel'
|
||||
);
|
||||
if (! empty($conf->multicurrency->enabled))
|
||||
if (!empty($conf->multicurrency->enabled))
|
||||
{
|
||||
$this->export_fields_array[$r]['f.multicurrency_code'] = 'Currency';
|
||||
$this->export_fields_array[$r]['f.multicurrency_tx'] = 'CurrencyRate';
|
||||
@ -654,15 +654,15 @@ class modFournisseur extends DolibarrModules
|
||||
|
||||
//Import Supplier Invoice
|
||||
//--------
|
||||
$r=0;
|
||||
$r = 0;
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class . '_' . $r;
|
||||
$this->import_label[$r] = "Supplier Invoice"; // Translation key
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = "Supplier Invoice"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['f' => MAIN_DB_PREFIX . 'facture_fourn', 'extra' => MAIN_DB_PREFIX . 'facture_fourn_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['f' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['f' => MAIN_DB_PREFIX.'facture_fourn', 'extra' => MAIN_DB_PREFIX.'facture_fourn_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['f' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_fields_array[$r] = [
|
||||
'f.ref' => 'InvoiceRef*',
|
||||
'f.ref_supplier' => 'RefSupplier',
|
||||
@ -697,19 +697,19 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = [];
|
||||
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, " . $conf->entity . ")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'facture_fourn'];
|
||||
$this->import_regex_array[$r] = ['f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn'];
|
||||
$this->import_regex_array[$r] = ['f.ref' => '(SI\d{4}-\d{4}|PROV.{1,32}$)', 'f.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
|
||||
$import_sample = [
|
||||
'f.ref' => '(PROV001)',
|
||||
'f.ref_supplier' => 'Supplier1',
|
||||
@ -751,10 +751,10 @@ class modFournisseur extends DolibarrModules
|
||||
//Import Supplier Invoice Lines
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = "Supplier Invoice Lines"; // Translation key
|
||||
$this->import_label[$r] = "Supplier Invoice Lines"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['fd' => MAIN_DB_PREFIX . 'facture_fourn_det', 'extra' => MAIN_DB_PREFIX . 'facture_fourn_det_extrafields'];
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['fd' => MAIN_DB_PREFIX.'facture_fourn_det', 'extra' => MAIN_DB_PREFIX.'facture_fourn_det_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
'fd.fk_facture_fourn' => 'InvoiceRef*',
|
||||
'fd.fk_parent_line' => 'FacParentLine',
|
||||
@ -784,19 +784,19 @@ class modFournisseur extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = [];
|
||||
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, " . $conf->entity . ")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'facture_fourn_det'];
|
||||
$this->import_regex_array[$r] = ['fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product', 'fd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'facture_fourn_det'];
|
||||
$this->import_regex_array[$r] = ['fd.product_type' => '[0|1]$', 'fd.fk_product' => 'rowid@'.MAIN_DB_PREFIX.'product', 'fd.multicurrency_code' => 'code@'.MAIN_DB_PREFIX.'multicurrency'];
|
||||
$import_sample = [
|
||||
'fd.fk_facture_fourn' => '(PROV001)',
|
||||
'fd.fk_parent_line' => '',
|
||||
@ -827,6 +827,158 @@ class modFournisseur extends DolibarrModules
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'fd.fk_facture_fourn' => ['rule' => 'fetchidfromref', 'file' => '/fourn/class/fournisseur.facture.class.php', 'class' => 'FactureFournisseur', 'method' => 'fetch'],
|
||||
];
|
||||
|
||||
//Import Purchase Orders
|
||||
$r++;
|
||||
$this->import_code[$r] = 'commande_fournisseur_' . $r;
|
||||
$this->import_label[$r] = 'Purchase Orders';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'commande_fournisseur', 'extra' => MAIN_DB_PREFIX . 'commande_fournisseur_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c' => 'fk_user_author']; // Fields to store import user id
|
||||
$this->import_fields_array[$r] = [
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_supplier' => 'RefSupplier',
|
||||
'c.fk_soc' => 'ThirdPartyName*',
|
||||
'c.fk_projet' => 'ProjectId',
|
||||
'c.date_creation' => 'DateCreation',
|
||||
'c.date_valid' => 'DateValid',
|
||||
'c.date_approve' => 'DateApprove',
|
||||
'c.date_commande' => 'DateOrder',
|
||||
'c.fk_user_modif' => 'ModifiedById',
|
||||
'c.fk_user_valid' => 'ValidatedById',
|
||||
'c.fk_user_approve' => 'ApprovedById',
|
||||
'c.source' => 'Source',
|
||||
'c.fk_statut' => 'Status*',
|
||||
'c.billed' => 'Billed(0/1)',
|
||||
'c.remise_percent' => 'GlobalDiscount',
|
||||
'c.tva' => 'TotalTVA',
|
||||
'c.total_ht' => 'TotalHT',
|
||||
'c.total_ttc' => 'TotalTTC',
|
||||
'c.note_private' => 'NotePrivate',
|
||||
'c.note_public' => 'Note',
|
||||
'c.date_livraison' => 'DeliveryDate',
|
||||
'c.fk_cond_reglement' => 'Payment Condition',
|
||||
'c.fk_mode_reglement' => 'Payment Mode',
|
||||
'c.model_pdf' => 'Model'
|
||||
];
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = [];
|
||||
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande_fournisseur' AND entity IN (0, " . $conf->entity . ")";
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande_fournisseur'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'c.ref' => '(PO\d{4}-\d{4}|PORDER.{1,32}$|PROV.{1,32}$)',
|
||||
'c.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
|
||||
];
|
||||
|
||||
$this->import_updatekeys_array[$r] = ['c.ref' => 'Ref'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'c.fk_soc' => [
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/societe/class/societe.class.php',
|
||||
'class' => 'Societe',
|
||||
'method' => 'fetch',
|
||||
'element' => 'ThirdParty'
|
||||
],
|
||||
'c.fk_mode_reglement' => [
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'file' => '/compta/paiement/class/cpaiement.class.php',
|
||||
'class' => 'Cpaiement',
|
||||
'method' => 'fetch',
|
||||
'element' => 'cpayment'
|
||||
],
|
||||
'c.source' => ['rule' => 'zeroifnull'],
|
||||
];
|
||||
|
||||
//Import PO Lines
|
||||
$r++;
|
||||
$this->import_code[$r] = 'commande_fournisseurdet_'.$r;
|
||||
$this->import_label[$r] = 'PO Lines';
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = [];
|
||||
$this->import_tables_array[$r] = ['cd' => MAIN_DB_PREFIX . 'commande_fournisseurdet', 'extra' => MAIN_DB_PREFIX . 'commande_fournisseurdet_extrafields'];
|
||||
$this->import_fields_array[$r] = [
|
||||
'cd.fk_commande' => 'Document Ref*',
|
||||
'cd.fk_parent_line' => 'PrParentLine',
|
||||
'cd.fk_product' => 'IdProduct',
|
||||
'cd.label' => 'Label',
|
||||
'cd.description' => 'LineDescription',
|
||||
'cd.tva_tx' => 'LineVATRate',
|
||||
'cd.qty' => 'LineQty',
|
||||
'cd.remise_percent' => 'Reduc. Percent',
|
||||
'cd.remise' => 'Reduc.',
|
||||
'cd.subprice' => 'Sub Price',
|
||||
'cd.total_ht' => 'LineTotalHT',
|
||||
'cd.total_tva' => 'LineTotalVAT',
|
||||
'cd.total_ttc' => 'LineTotalTTC',
|
||||
'cd.product_type' => 'TypeOfLineServiceOrProduct',
|
||||
'cd.date_start' => 'Start Date',
|
||||
'cd.date_end' => 'End Date',
|
||||
'cd.info_bits' => 'InfoBits',
|
||||
'cd.special_code' => 'Special Code',
|
||||
'cd.rang' => 'LinePosition',
|
||||
'cd.fk_unit' => 'Unit'
|
||||
];
|
||||
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC';
|
||||
}
|
||||
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'commande_fournisseurdet' AND entity IN (0, " . $conf->entity . ")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'commande_fournisseurdet'];
|
||||
$this->import_regex_array[$r] = [
|
||||
'cd.product_type' => '[0|1]$',
|
||||
'cd.fk_product' => 'rowid@' . MAIN_DB_PREFIX . 'product',
|
||||
'cd.multicurrency_code' => 'code@' . MAIN_DB_PREFIX . 'multicurrency'
|
||||
];
|
||||
$this->import_updatekeys_array[$r] = ['cd.fk_commande' => 'Purchase Order Id'];
|
||||
$this->import_convertvalue_array[$r] = [
|
||||
'cd.fk_commande' => [
|
||||
'rule' => 'fetchidfromref',
|
||||
'file' => '/fourn/class/fournisseur.commande.class.php',
|
||||
'class' => 'CommandeFournisseur',
|
||||
'method' => 'fetch',
|
||||
'element' => 'order_supplier'
|
||||
],
|
||||
'cd.info_bits' => ['rule' => 'zeroifnull'],
|
||||
'cd.special_code' => ['rule' => 'zeroifnull'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -835,7 +987,7 @@ class modFournisseur extends DolibarrModules
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
|
||||
@ -33,155 +33,155 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
*/
|
||||
class modMrp extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$this->db = $db;
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $langs, $conf;
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 660;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'mrp';
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "products";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '66';
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module label (no space allowed), used if translation string 'ModuleMrpName' not found (Mrp is name of module).
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
// Module description, used if translation string 'ModuleMrpDesc' not found (Mrp is name of module).
|
||||
$this->description = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'dolibarr';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 660;
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'mrp';
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "products";
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '66';
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module label (no space allowed), used if translation string 'ModuleMrpName' not found (Mrp is name of module).
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
// Module description, used if translation string 'ModuleMrpDesc' not found (Mrp is name of module).
|
||||
$this->description = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "Module to Manage Manufacturing Orders (MO)";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = 'dolibarr';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MRP is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto = 'mrp';
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'triggers' => 0,
|
||||
// Set this to 1 if module has its own login method file (core/login)
|
||||
'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'substitutions' => 0,
|
||||
// Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'menus' => 0,
|
||||
// Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'tpl' => 0,
|
||||
// Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'barcode' => 0,
|
||||
// Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'models' => 0,
|
||||
// Set this to 1 if module has its own theme directory (theme)
|
||||
'theme' => 0,
|
||||
// Set this to relative path of css file if module has its own css file
|
||||
'css' => array(
|
||||
// '/mrp/css/mrp.css.php',
|
||||
),
|
||||
// Set this to relative path of js file if module must load a js on all pages
|
||||
'js' => array(
|
||||
// '/mrp/js/mrp.js.php',
|
||||
),
|
||||
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
|
||||
'hooks' => array(
|
||||
// 'data' => array(
|
||||
// 'hookcontext1',
|
||||
// 'hookcontext2',
|
||||
// ),
|
||||
// 'entity' => '0',
|
||||
),
|
||||
// Set this to 1 if features of module are opened to external users
|
||||
'moduleforexternal' => 0,
|
||||
);
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mrp/temp","/mrp/subdir");
|
||||
$this->dirs = array("/mrp/temp");
|
||||
// Config pages. Put here list of php page, stored into mrp/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("mrp.php");
|
||||
// Dependencies
|
||||
// A condition to hide module
|
||||
$this->hidden = false;
|
||||
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->depends = array('modBom');
|
||||
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->langfiles = array("mrp");
|
||||
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(8, 0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'MrpWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MRP is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
$this->picto = 'mrp';
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'triggers' => 0,
|
||||
// Set this to 1 if module has its own login method file (core/login)
|
||||
'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'substitutions' => 0,
|
||||
// Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'menus' => 0,
|
||||
// Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'tpl' => 0,
|
||||
// Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'barcode' => 0,
|
||||
// Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'models' => 0,
|
||||
// Set this to 1 if module has its own theme directory (theme)
|
||||
'theme' => 0,
|
||||
// Set this to relative path of css file if module has its own css file
|
||||
'css' => array(
|
||||
// '/mrp/css/mrp.css.php',
|
||||
),
|
||||
// Set this to relative path of js file if module must load a js on all pages
|
||||
'js' => array(
|
||||
// '/mrp/js/mrp.js.php',
|
||||
),
|
||||
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
|
||||
'hooks' => array(
|
||||
// 'data' => array(
|
||||
// 'hookcontext1',
|
||||
// 'hookcontext2',
|
||||
// ),
|
||||
// 'entity' => '0',
|
||||
),
|
||||
// Set this to 1 if features of module are opened to external users
|
||||
'moduleforexternal' => 0,
|
||||
);
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mrp/temp","/mrp/subdir");
|
||||
$this->dirs = array("/mrp/temp");
|
||||
// Config pages. Put here list of php page, stored into mrp/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("mrp.php");
|
||||
// Dependencies
|
||||
// A condition to hide module
|
||||
$this->hidden = false;
|
||||
// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
|
||||
$this->depends = array('modBom');
|
||||
$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->langfiles = array("mrp");
|
||||
$this->phpmin = array(5, 5); // Minimum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(8, 0); // Minimum version of Dolibarr required by module
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...)
|
||||
//$this->automatic_activation = array('FR'=>'MrpWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(1 => array('MRP_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
|
||||
// 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of MO', 0),
|
||||
2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
|
||||
3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0)
|
||||
);
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(1 => array('MRP_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
|
||||
// 2 => array('MRP_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array(
|
||||
1=>array('MRP_MO_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of MO', 0),
|
||||
2=>array('MRP_MO_ADDON', 'chaine', 'mod_mo_standard', 'Name of numbering rules of MO', 0),
|
||||
3=>array('MRP_MO_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/mrps', '', 0)
|
||||
);
|
||||
|
||||
// Some keys to add into the overwriting translation tables
|
||||
/*$this->overwrite_translation = array(
|
||||
// Some keys to add into the overwriting translation tables
|
||||
/*$this->overwrite_translation = array(
|
||||
'en_US:ParentCompany'=>'Parent company or reseller',
|
||||
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
||||
)*/
|
||||
|
||||
if (!isset($conf->mrp) || !isset($conf->mrp->enabled)) {
|
||||
$conf->mrp = new stdClass();
|
||||
$conf->mrp->enabled = 0;
|
||||
}
|
||||
if (!isset($conf->mrp) || !isset($conf->mrp->enabled)) {
|
||||
$conf->mrp = new stdClass();
|
||||
$conf->mrp->enabled = 0;
|
||||
}
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// Example:
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mrp:$user->rights->mrp->read:/mrp/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mrp:$user->rights->othermodule->read:/mrp/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||
//
|
||||
// Where objecttype can be
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'user' to add a tab in user view
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs = array();
|
||||
// Example:
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@mrp:$user->rights->mrp->read:/mrp/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@mrp:$user->rights->othermodule->read:/mrp/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname
|
||||
//
|
||||
// Where objecttype can be
|
||||
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||
// 'contact' to add a tab in contact view
|
||||
// 'contract' to add a tab in contract view
|
||||
// 'group' to add a tab in group view
|
||||
// 'intervention' to add a tab in intervention view
|
||||
// 'invoice' to add a tab in customer invoice view
|
||||
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in fundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in customer order view
|
||||
// 'order_supplier' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'payment_supplier' to add a tab in supplier payment view
|
||||
// 'product' to add a tab in product view
|
||||
// 'propal' to add a tab in propal view
|
||||
// 'project' to add a tab in project view
|
||||
// 'stock' to add a tab in stock view
|
||||
// 'thirdparty' to add a tab in third party view
|
||||
// 'user' to add a tab in user view
|
||||
|
||||
// Dictionaries
|
||||
$this->dictionaries = array();
|
||||
/* Example:
|
||||
// Dictionaries
|
||||
$this->dictionaries = array();
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs'=>'mylangfile@mrp',
|
||||
// List of tables we want to see into dictonnary editor
|
||||
@ -205,68 +205,68 @@ class modMrp extends DolibarrModules
|
||||
);
|
||||
*/
|
||||
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in mrp/core/boxes that contains a class to show a widget.
|
||||
$this->boxes = array(
|
||||
0 => array('file' => 'box_mos.php', 'note' => '', 'enabledbydefaulton' => 'Home')
|
||||
);
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in mrp/core/boxes that contains a class to show a widget.
|
||||
$this->boxes = array(
|
||||
0 => array('file' => 'box_mos.php', 'note' => '', 'enabledbydefaulton' => 'Home')
|
||||
);
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
// 0 => array(
|
||||
// 'label' => 'MyJob label',
|
||||
// 'jobtype' => 'method',
|
||||
// 'class' => '/mrp/class/mo.class.php',
|
||||
// 'objectname' => 'Mo',
|
||||
// 'method' => 'doScheduledJob',
|
||||
// 'parameters' => '',
|
||||
// 'comment' => 'Comment',
|
||||
// 'frequency' => 2,
|
||||
// 'unitfrequency' => 3600,
|
||||
// 'status' => 0,
|
||||
// 'test' => '$conf->mrp->enabled',
|
||||
// 'priority' => 50,
|
||||
// ),
|
||||
);
|
||||
// Example: $this->cronjobs=array(
|
||||
// 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50)
|
||||
// );
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
$this->cronjobs = array(
|
||||
// 0 => array(
|
||||
// 'label' => 'MyJob label',
|
||||
// 'jobtype' => 'method',
|
||||
// 'class' => '/mrp/class/mo.class.php',
|
||||
// 'objectname' => 'Mo',
|
||||
// 'method' => 'doScheduledJob',
|
||||
// 'parameters' => '',
|
||||
// 'comment' => 'Comment',
|
||||
// 'frequency' => 2,
|
||||
// 'unitfrequency' => 3600,
|
||||
// 'status' => 0,
|
||||
// 'test' => '$conf->mrp->enabled',
|
||||
// 'priority' => 50,
|
||||
// ),
|
||||
);
|
||||
// Example: $this->cronjobs=array(
|
||||
// 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mrp->enabled', 'priority'=>50)
|
||||
// );
|
||||
|
||||
// Permissions provided by this module
|
||||
$this->rights = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
// Permissions provided by this module
|
||||
$this->rights = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Read Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Create/Update Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
|
||||
$this->rights[$r][1] = 'Delete Manufacturing Order'; // Permission label
|
||||
$this->rights[$r][4] = 'delete'; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->mrp->level1->level2)
|
||||
$r++;
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
|
||||
// Main menu entries to add
|
||||
$this->menu = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new menus
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
// Main menu entries to add
|
||||
$this->menu = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new menus
|
||||
/* BEGIN MODULEBUILDER TOPMENU */
|
||||
/* END MODULEBUILDER LEFTMENU MO */
|
||||
|
||||
// Exports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER EXPORT MO */
|
||||
/*
|
||||
// Exports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER EXPORT MO */
|
||||
/*
|
||||
$langs->load("mrp");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
@ -281,12 +281,12 @@ class modMrp extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MO */
|
||||
/* END MODULEBUILDER EXPORT MO */
|
||||
|
||||
// Imports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER IMPORT MO */
|
||||
/*
|
||||
// Imports profiles provided by this module
|
||||
$r = 1;
|
||||
/* BEGIN MODULEBUILDER IMPORT MO */
|
||||
/*
|
||||
$langs->load("mrp");
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='MoLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
@ -301,75 +301,75 @@ class modMrp extends DolibarrModules
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('mo').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER IMPORT MO */
|
||||
}
|
||||
/* END MODULEBUILDER IMPORT MO */
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
/**
|
||||
* Function called when module is enabled.
|
||||
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||
* It also creates data directories
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$result = $this->_load_tables('/mrp/sql/');
|
||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
$result = $this->_load_tables('/mrp/sql/');
|
||||
if ($result < 0) return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
|
||||
// Create extrafields during init
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
// Create extrafields during init
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result1=$extrafields->addExtraField('myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result2=$extrafields->addExtraField('myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result3=$extrafields->addExtraField('myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->mrp->enabled');
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
$sql = array();
|
||||
|
||||
// ODT template
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/mrps';
|
||||
$dest = $dirodt.'/template_mo.odt';
|
||||
// ODT template
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mrps/template_mo.odt';
|
||||
$dirodt = DOL_DATA_ROOT.'/doctemplates/mrps';
|
||||
$dest = $dirodt.'/template_mo.odt';
|
||||
|
||||
if (file_exists($src) && !file_exists($dest))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_mkdir($dirodt);
|
||||
$result = dol_copy($src, $dest, 0, 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (file_exists($src) && !file_exists($dest))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_mkdir($dirodt);
|
||||
$result = dol_copy($src, $dest, 0, 0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".$conf->entity,
|
||||
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".$conf->entity.")"
|
||||
);
|
||||
$sql = array(
|
||||
//"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'mo' AND entity = ".$conf->entity,
|
||||
//"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'mo', ".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
/**
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -262,11 +262,11 @@ class modPropale extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = 'Proposals'; // Translation key
|
||||
$this->import_label[$r] = 'Proposals'; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'propal', 'extra' => MAIN_DB_PREFIX . 'propal_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c'=>'fk_user_author']; // Fields to store import user id
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX.'propal', 'extra' => MAIN_DB_PREFIX.'propal_extrafields'];
|
||||
$this->import_tables_creator_array[$r] = ['c'=>'fk_user_author']; // Fields to store import user id
|
||||
$this->import_fields_array[$r] = [
|
||||
'c.ref' => 'Document Ref*',
|
||||
'c.ref_client' => 'RefCustomer',
|
||||
@ -282,7 +282,7 @@ class modPropale extends DolibarrModules
|
||||
'c.date_livraison' => 'DeliveryDate',
|
||||
'c.fk_user_valid' => 'ValidatedById'
|
||||
];
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
@ -291,18 +291,18 @@ class modPropale extends DolibarrModules
|
||||
}
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = [];
|
||||
$sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'propal' AND entity IN (0, " . $conf->entity . ")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propal' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'propal'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propal'];
|
||||
$this->import_regex_array[$r] = ['c.ref' => '[^ ]'];
|
||||
$import_sample = [
|
||||
'c.ref' => 'PROV0077',
|
||||
@ -339,12 +339,12 @@ class modPropale extends DolibarrModules
|
||||
//Import Proposal Lines
|
||||
$r++;
|
||||
$this->import_code[$r] = $this->rights_class.'line_'.$r;
|
||||
$this->import_label[$r] = "ProposalLine"; // Translation key
|
||||
$this->import_label[$r] = "ProposalLine"; // Translation key
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r] = [
|
||||
'cd' => MAIN_DB_PREFIX . 'propaldet',
|
||||
'extra' => MAIN_DB_PREFIX . 'propaldet_extrafields'
|
||||
'cd' => MAIN_DB_PREFIX.'propaldet',
|
||||
'extra' => MAIN_DB_PREFIX.'propaldet_extrafields'
|
||||
];
|
||||
$this->import_fields_array[$r] = [
|
||||
'cd.fk_propal' => 'Document Ref*',
|
||||
@ -366,7 +366,7 @@ class modPropale extends DolibarrModules
|
||||
'cd.date_end' => 'End Date',
|
||||
'cd.buy_price_ht' => 'LineBuyPriceHT'
|
||||
];
|
||||
if (! empty($conf->multicurrency->enabled)) {
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
$this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate';
|
||||
$this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT';
|
||||
@ -379,14 +379,14 @@ class modPropale extends DolibarrModules
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$fieldname = 'extra.' . $obj->name;
|
||||
$fieldname = 'extra.'.$obj->name;
|
||||
$fieldlabel = ucfirst($obj->label);
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : '');
|
||||
$this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : '');
|
||||
$import_extrafield_sample[$fieldname] = $fieldlabel;
|
||||
}
|
||||
}
|
||||
// End add extra fields
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'propaldet'];
|
||||
$this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'propaldet'];
|
||||
$this->import_regex_array[$r] = ['cd.product_type' => '[0|1]$'];
|
||||
$import_sample = [
|
||||
'cd.fk_propal' => 'PROV(0001)',
|
||||
|
||||
@ -66,7 +66,7 @@ class modSocialNetworks extends DolibarrModules
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = !empty($conf->global->MODULE_SOCIALNETWORKS_DISABLED); // A condition to hide module
|
||||
$this->depends = array('modSociete'); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||
|
||||
@ -30,54 +30,54 @@ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
class modWebServicesClient extends DolibarrModules
|
||||
{
|
||||
|
||||
/**
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->numero = 2660;
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->numero = 2660;
|
||||
|
||||
$this->family = "interface";
|
||||
$this->module_position = '25';
|
||||
// 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 = "Enable the web service client to call external supplier web services";
|
||||
$this->family = "interface";
|
||||
$this->module_position = '25';
|
||||
// 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 = "Enable the web service client to call external supplier web services";
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
$this->picto = 'technic';
|
||||
$this->version = 'experimental';
|
||||
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
// Name of image file used for this module.
|
||||
$this->picto = 'technic';
|
||||
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
// Data directories to create when module is enabled
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages
|
||||
//$this->config_page_url = array();
|
||||
// Config pages
|
||||
//$this->config_page_url = array();
|
||||
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
// Dependencies
|
||||
$this->hidden = false; // A condition to hide module
|
||||
$this->depends = array(); // List of module class names as string that must be enabled if this module is enabled
|
||||
$this->requiredby = array(); // List of module ids to disable if this one is disabled
|
||||
$this->conflictwith = array(); // List of module class names as string this module is in conflict with
|
||||
$this->phpmin = array(5, 4); // Minimum version of PHP required by module
|
||||
$this->langfiles = array("other");
|
||||
$this->langfiles = array("other");
|
||||
|
||||
// Constants
|
||||
$this->const = array();
|
||||
// Constants
|
||||
$this->const = array();
|
||||
|
||||
// New pages on tabs
|
||||
$this->tabs = array();
|
||||
// New pages on tabs
|
||||
$this->tabs = array();
|
||||
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
// Boxes
|
||||
$this->boxes = array();
|
||||
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'syncsupplierwebservices';
|
||||
$r = 0;
|
||||
}
|
||||
// Permissions
|
||||
$this->rights = array();
|
||||
$this->rights_class = 'syncsupplierwebservices';
|
||||
$r = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,478 +35,478 @@ use OAuth\OAuth2\Service\Google;
|
||||
*/
|
||||
class printing_printgcp extends PrintingDriver
|
||||
{
|
||||
public $name = 'printgcp';
|
||||
public $desc = 'PrintGCPDesc';
|
||||
public $name = 'printgcp';
|
||||
public $desc = 'PrintGCPDesc';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'printer';
|
||||
public $active = 'PRINTING_PRINTGCP';
|
||||
public $conf = array();
|
||||
public $google_id = '';
|
||||
public $google_secret = '';
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
*/
|
||||
public $picto = 'printer';
|
||||
public $active = 'PRINTING_PRINTGCP';
|
||||
public $conf = array();
|
||||
public $google_id = '';
|
||||
public $google_secret = '';
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error = '';
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
private $OAUTH_SERVICENAME_GOOGLE = 'Google';
|
||||
private $OAUTH_SERVICENAME_GOOGLE = 'Google';
|
||||
|
||||
const LOGIN_URL = 'https://accounts.google.com/o/oauth2/token';
|
||||
const PRINTERS_SEARCH_URL = 'https://www.google.com/cloudprint/search';
|
||||
const PRINTERS_GET_JOBS = 'https://www.google.com/cloudprint/jobs';
|
||||
const PRINT_URL = 'https://www.google.com/cloudprint/submit';
|
||||
const LOGIN_URL = 'https://accounts.google.com/o/oauth2/token';
|
||||
const PRINTERS_SEARCH_URL = 'https://www.google.com/cloudprint/search';
|
||||
const PRINTERS_GET_JOBS = 'https://www.google.com/cloudprint/jobs';
|
||||
const PRINT_URL = 'https://www.google.com/cloudprint/submit';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $dolibarr_main_url_root;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs, $dolibarr_main_url_root;
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
$this->db = $db;
|
||||
$this->db = $db;
|
||||
|
||||
if (!$conf->oauth->enabled) {
|
||||
$this->conf[] = array(
|
||||
'varname'=>'PRINTGCP_INFO',
|
||||
'info'=>$langs->transnoentitiesnoconv("WarningModuleNotActive", "OAuth"),
|
||||
'type'=>'info',
|
||||
);
|
||||
} else {
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? 'HasAccessToken' : 'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
if (!$conf->oauth->enabled) {
|
||||
$this->conf[] = array(
|
||||
'varname'=>'PRINTGCP_INFO',
|
||||
'info'=>$langs->transnoentitiesnoconv("WarningModuleNotActive", "OAuth"),
|
||||
'type'=>'info',
|
||||
);
|
||||
} else {
|
||||
$this->google_id = $conf->global->OAUTH_GOOGLE_ID;
|
||||
$this->google_secret = $conf->global->OAUTH_GOOGLE_SECRET;
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
//$storage->clearToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
$urlwithroot.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$access = ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? 'HasAccessToken' : 'NoAccessToken');
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
//var_dump($this->errors);exit;
|
||||
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array(
|
||||
'varname'=>'PRINTGCP_TOKEN_ACCESS',
|
||||
'info'=>$access,
|
||||
'type'=>'info',
|
||||
'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'),
|
||||
'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '')
|
||||
);
|
||||
if ($token_ok) {
|
||||
$expiredat = '';
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->google_id != '' && $this->google_secret != '') {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthConfigured', 'type'=>'info');
|
||||
$this->conf[] = array(
|
||||
'varname'=>'PRINTGCP_TOKEN_ACCESS',
|
||||
'info'=>$access,
|
||||
'type'=>'info',
|
||||
'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'),
|
||||
'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '')
|
||||
);
|
||||
if ($token_ok) {
|
||||
$expiredat = '';
|
||||
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
|
||||
$endoflife = $token->getEndOfLife();
|
||||
$endoflife = $token->getEndOfLife();
|
||||
|
||||
if ($endoflife == $token::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $token::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
if ($endoflife == $token::EOL_NEVER_EXPIRES)
|
||||
{
|
||||
$expiredat = $langs->trans("Never");
|
||||
} elseif ($endoflife == $token::EOL_UNKNOWN)
|
||||
{
|
||||
$expiredat = $langs->trans("Unknown");
|
||||
} else {
|
||||
$expiredat = dol_print_date($endoflife, "dayhour");
|
||||
}
|
||||
|
||||
$this->conf[] = array('varname'=>'TOKEN_REFRESH', 'info'=>((!empty($refreshtoken)) ? 'Yes' : 'No'), 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'TOKEN_EXPIRED', 'info'=>($expire ? 'Yes' : 'No'), 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'TOKEN_EXPIRE_AT', 'info'=>($expiredat), 'type'=>'info');
|
||||
}
|
||||
/*
|
||||
$this->conf[] = array('varname'=>'TOKEN_REFRESH', 'info'=>((!empty($refreshtoken)) ? 'Yes' : 'No'), 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'TOKEN_EXPIRED', 'info'=>($expire ? 'Yes' : 'No'), 'type'=>'info');
|
||||
$this->conf[] = array('varname'=>'TOKEN_EXPIRE_AT', 'info'=>($expiredat), 'type'=>'info');
|
||||
}
|
||||
/*
|
||||
if ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)) {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
$this->conf[] = array('varname'=>'DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete');
|
||||
} else {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink');
|
||||
}*/
|
||||
} else {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info');
|
||||
}
|
||||
}
|
||||
// do not display submit button
|
||||
$this->conf[] = array('enabled'=>0, 'type'=>'submit');
|
||||
}
|
||||
} else {
|
||||
$this->conf[] = array('varname'=>'PRINTGCP_INFO', 'info'=>'GoogleAuthNotConfigured', 'type'=>'info');
|
||||
}
|
||||
}
|
||||
// do not display submit button
|
||||
$this->conf[] = array('enabled'=>0, 'type'=>'submit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function listAvailablePrinters()
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
$langs->load('printing');
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function listAvailablePrinters()
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error = 0;
|
||||
$langs->load('printing');
|
||||
|
||||
$html = '<tr class="liste_titre">';
|
||||
$html .= '<td>'.$langs->trans('GCP_Name').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_displayName').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_Id').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_OwnerName').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_State').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_connectionStatus').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_Type').'</td>';
|
||||
$html .= '<td class="center">'.$langs->trans("Select").'</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
$list = $this->getlistAvailablePrinters();
|
||||
//$html.= '<td><pre>'.print_r($list,true).'</pre></td>';
|
||||
foreach ($list['available'] as $printer_det)
|
||||
{
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td>'.$printer_det['name'].'</td>';
|
||||
$html .= '<td>'.$printer_det['displayName'].'</td>';
|
||||
$html .= '<td>'.$printer_det['id'].'</td>'; // id to identify printer to use
|
||||
$html .= '<td>'.$printer_det['ownerName'].'</td>';
|
||||
$html .= '<td>'.$printer_det['status'].'</td>';
|
||||
$html .= '<td>'.$langs->trans('STATE_'.$printer_det['connectionStatus']).'</td>';
|
||||
$html .= '<td>'.$langs->trans('TYPE_'.$printer_det['type']).'</td>';
|
||||
// Defaut
|
||||
$html .= '<td class="center">';
|
||||
if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id'])
|
||||
{
|
||||
$html .= img_picto($langs->trans("Default"), 'on');
|
||||
} else $html .= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'&mode=test&varname=PRINTING_GCP_DEFAULT&driver=printgcp&value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
}
|
||||
$this->resprint = $html;
|
||||
return $error;
|
||||
}
|
||||
$html = '<tr class="liste_titre">';
|
||||
$html .= '<td>'.$langs->trans('GCP_Name').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_displayName').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_Id').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_OwnerName').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_State').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_connectionStatus').'</td>';
|
||||
$html .= '<td>'.$langs->trans('GCP_Type').'</td>';
|
||||
$html .= '<td class="center">'.$langs->trans("Select").'</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
$list = $this->getlistAvailablePrinters();
|
||||
//$html.= '<td><pre>'.print_r($list,true).'</pre></td>';
|
||||
foreach ($list['available'] as $printer_det)
|
||||
{
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td>'.$printer_det['name'].'</td>';
|
||||
$html .= '<td>'.$printer_det['displayName'].'</td>';
|
||||
$html .= '<td>'.$printer_det['id'].'</td>'; // id to identify printer to use
|
||||
$html .= '<td>'.$printer_det['ownerName'].'</td>';
|
||||
$html .= '<td>'.$printer_det['status'].'</td>';
|
||||
$html .= '<td>'.$langs->trans('STATE_'.$printer_det['connectionStatus']).'</td>';
|
||||
$html .= '<td>'.$langs->trans('TYPE_'.$printer_det['type']).'</td>';
|
||||
// Defaut
|
||||
$html .= '<td class="center">';
|
||||
if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id'])
|
||||
{
|
||||
$html .= img_picto($langs->trans("Default"), 'on');
|
||||
} else $html .= '<a href="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'&mode=test&varname=PRINTING_GCP_DEFAULT&driver=printgcp&value='.urlencode($printer_det['id']).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
$html .= '</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
}
|
||||
$this->resprint = $html;
|
||||
return $error;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
public function getlistAvailablePrinters()
|
||||
{
|
||||
$ret = array();
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
// Check if we have auth token
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
/**
|
||||
* Return list of available printers
|
||||
*
|
||||
* @return array list of printers
|
||||
*/
|
||||
public function getlistAvailablePrinters()
|
||||
{
|
||||
$ret = array();
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
// Check if we have auth token
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
// Send a request with api
|
||||
try {
|
||||
$response = $apiService->request(self::PRINTERS_SEARCH_URL);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
print '<pre>'.print_r($e->getMessage(), true).'</pre>';
|
||||
}
|
||||
//print '<tr><td><pre>'.print_r($response, true).'</pre></td></tr>';
|
||||
$responsedata = json_decode($response, true);
|
||||
$printers = $responsedata['printers'];
|
||||
// Check if we have printers?
|
||||
if (count($printers) == 0) {
|
||||
// We dont have printers so return blank array
|
||||
$ret['available'] = array();
|
||||
} else {
|
||||
// We have printers so returns printers as array
|
||||
$ret['available'] = $printers;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
// Send a request with api
|
||||
try {
|
||||
$response = $apiService->request(self::PRINTERS_SEARCH_URL);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
print '<pre>'.print_r($e->getMessage(), true).'</pre>';
|
||||
}
|
||||
//print '<tr><td><pre>'.print_r($response, true).'</pre></td></tr>';
|
||||
$responsedata = json_decode($response, true);
|
||||
$printers = $responsedata['printers'];
|
||||
// Check if we have printers?
|
||||
if (count($printers) == 0) {
|
||||
// We dont have printers so return blank array
|
||||
$ret['available'] = array();
|
||||
} else {
|
||||
// We have printers so returns printers as array
|
||||
$ret['available'] = $printers;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
* @param string $subdir subdir for file
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function printFile($file, $module, $subdir = '')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
/**
|
||||
* Print selected file
|
||||
*
|
||||
* @param string $file file
|
||||
* @param string $module module
|
||||
* @param string $subdir subdir for file
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function printFile($file, $module, $subdir = '')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
global $conf, $user;
|
||||
$error = 0;
|
||||
global $conf, $user;
|
||||
$error = 0;
|
||||
|
||||
$fileprint = $conf->{$module}->dir_output;
|
||||
if ($subdir != '') {
|
||||
$fileprint .= '/'.$subdir;
|
||||
}
|
||||
$fileprint .= '/'.$file;
|
||||
$mimetype = dol_mimetype($fileprint);
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$this->db->escape($module)."' AND driver='printgcp' AND userid=".$user->id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$printer_id = $obj->printer_id;
|
||||
} else {
|
||||
if (!empty($conf->global->PRINTING_GCP_DEFAULT))
|
||||
{
|
||||
$printer_id = $conf->global->PRINTING_GCP_DEFAULT;
|
||||
} else {
|
||||
$this->errors[] = 'NoDefaultPrinterDefined';
|
||||
$error++;
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
$fileprint = $conf->{$module}->dir_output;
|
||||
if ($subdir != '') {
|
||||
$fileprint .= '/'.$subdir;
|
||||
}
|
||||
$fileprint .= '/'.$file;
|
||||
$mimetype = dol_mimetype($fileprint);
|
||||
// select printer uri for module order, propal,...
|
||||
$sql = "SELECT rowid, printer_id, copy FROM ".MAIN_DB_PREFIX."printing WHERE module='".$this->db->escape($module)."' AND driver='printgcp' AND userid=".$user->id;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
if ($obj)
|
||||
{
|
||||
$printer_id = $obj->printer_id;
|
||||
} else {
|
||||
if (!empty($conf->global->PRINTING_GCP_DEFAULT))
|
||||
{
|
||||
$printer_id = $conf->global->PRINTING_GCP_DEFAULT;
|
||||
} else {
|
||||
$this->errors[] = 'NoDefaultPrinterDefined';
|
||||
$error++;
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
|
||||
$this->error = 'PRINTGCP: '.$ret['errormessage'];
|
||||
if ($ret['status'] != 1) {
|
||||
$error++;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
$ret = $this->sendPrintToPrinter($printer_id, $file, $fileprint, $mimetype);
|
||||
$this->error = 'PRINTGCP: '.$ret['errormessage'];
|
||||
if ($ret['status'] != 1) {
|
||||
$error++;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends document to the printer
|
||||
*
|
||||
* @param string $printerid Printer id returned by Google Cloud Print
|
||||
* @param string $printjobtitle Job Title
|
||||
* @param string $filepath File Path to be send to Google Cloud Print
|
||||
* @param string $contenttype File content type by example application/pdf, image/png
|
||||
* @return array status array
|
||||
*/
|
||||
public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype)
|
||||
{
|
||||
// Check if printer id
|
||||
if (empty($printerid)) {
|
||||
return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID');
|
||||
}
|
||||
// Open the file which needs to be print
|
||||
$handle = fopen($filepath, "rb");
|
||||
if (!$handle) {
|
||||
return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'Could not read the file.');
|
||||
}
|
||||
// Read file content
|
||||
$contents = fread($handle, filesize($filepath));
|
||||
fclose($handle);
|
||||
// Prepare post fields for sending print
|
||||
$post_fields = array(
|
||||
'printerid' => $printerid,
|
||||
'title' => $printjobtitle,
|
||||
'contentTransferEncoding' => 'base64',
|
||||
'content' => base64_encode($contents), // encode file content as base64
|
||||
'contentType' => $contenttype,
|
||||
);
|
||||
// Dolibarr Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php?service=google'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
/**
|
||||
* Sends document to the printer
|
||||
*
|
||||
* @param string $printerid Printer id returned by Google Cloud Print
|
||||
* @param string $printjobtitle Job Title
|
||||
* @param string $filepath File Path to be send to Google Cloud Print
|
||||
* @param string $contenttype File content type by example application/pdf, image/png
|
||||
* @return array status array
|
||||
*/
|
||||
public function sendPrintToPrinter($printerid, $printjobtitle, $filepath, $contenttype)
|
||||
{
|
||||
// Check if printer id
|
||||
if (empty($printerid)) {
|
||||
return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'No provided printer ID');
|
||||
}
|
||||
// Open the file which needs to be print
|
||||
$handle = fopen($filepath, "rb");
|
||||
if (!$handle) {
|
||||
return array('status' =>0, 'errorcode' =>'', 'errormessage'=>'Could not read the file.');
|
||||
}
|
||||
// Read file content
|
||||
$contents = fread($handle, filesize($filepath));
|
||||
fclose($handle);
|
||||
// Prepare post fields for sending print
|
||||
$post_fields = array(
|
||||
'printerid' => $printerid,
|
||||
'title' => $printjobtitle,
|
||||
'contentTransferEncoding' => 'base64',
|
||||
'content' => base64_encode($contents), // encode file content as base64
|
||||
'contentType' => $contenttype,
|
||||
);
|
||||
// Dolibarr Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php?service=google'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
|
||||
// Check if we have auth token and refresh it
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
if ($token_ok) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
// Check if we have auth token and refresh it
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
}
|
||||
if ($token_ok) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Send a request with api
|
||||
$response = json_decode($apiService->request(self::PRINT_URL, 'POST', $post_fields), true);
|
||||
//print '<tr><td><pre>'.print_r($response, true).'</pre></td></tr>';
|
||||
return array('status' => $response['success'], 'errorcode' => $response['errorCode'], 'errormessage' => $response['message']);
|
||||
}
|
||||
// Send a request with api
|
||||
$response = json_decode($apiService->request(self::PRINT_URL, 'POST', $post_fields), true);
|
||||
//print '<tr><td><pre>'.print_r($response, true).'</pre></td></tr>';
|
||||
return array('status' => $response['success'], 'errorcode' => $response['errorCode'], 'errormessage' => $response['message']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List jobs print
|
||||
*
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function listJobs()
|
||||
{
|
||||
global $conf, $langs;
|
||||
/**
|
||||
* List jobs print
|
||||
*
|
||||
* @return int 0 if OK, >0 if KO
|
||||
*/
|
||||
public function listJobs()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$error = 0;
|
||||
$html = '';
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
// Check if we have auth token
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
$error++;
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
$error = 0;
|
||||
$html = '';
|
||||
// Token storage
|
||||
$storage = new DoliStorage($this->db, $this->conf);
|
||||
// Setup the credentials for the requests
|
||||
$credentials = new Credentials(
|
||||
$this->google_id,
|
||||
$this->google_secret,
|
||||
DOL_MAIN_URL_ROOT.'/core/modules/oauth/google_oauthcallback.php'
|
||||
);
|
||||
$serviceFactory = new \OAuth\ServiceFactory();
|
||||
$apiService = $serviceFactory->createService($this->OAUTH_SERVICENAME_GOOGLE, $credentials, $storage, array());
|
||||
// Check if we have auth token
|
||||
$token_ok = true;
|
||||
try {
|
||||
$token = $storage->retrieveAccessToken($this->OAUTH_SERVICENAME_GOOGLE);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$token_ok = false;
|
||||
$error++;
|
||||
}
|
||||
$expire = false;
|
||||
// Is token expired or will token expire in the next 30 seconds
|
||||
if ($token_ok) {
|
||||
$expire = ($token->getEndOfLife() !== -9002 && $token->getEndOfLife() !== -9001 && time() > ($token->getEndOfLife() - 30));
|
||||
}
|
||||
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Getting Jobs
|
||||
// Send a request with api
|
||||
try {
|
||||
$response = $apiService->request(self::PRINTERS_GET_JOBS);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
$responsedata = json_decode($response, true);
|
||||
//$html .= '<pre>'.print_r($responsedata,true).'</pre>';
|
||||
$html .= '<div class="div-table-responsive">';
|
||||
$html .= '<table width="100%" class="noborder">';
|
||||
$html .= '<tr class="liste_titre">';
|
||||
$html .= '<td>'.$langs->trans("Id").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Date").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Owner").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Printer").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Filename").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Status").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Cancel").'</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
// Token expired so we refresh it
|
||||
if ($token_ok && $expire) {
|
||||
try {
|
||||
// il faut sauvegarder le refresh token car google ne le donne qu'une seule fois
|
||||
$refreshtoken = $token->getRefreshToken();
|
||||
$token = $apiService->refreshAccessToken($token);
|
||||
$token->setRefreshToken($refreshtoken);
|
||||
$storage->storeAccessToken($this->OAUTH_SERVICENAME_GOOGLE, $token);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// Getting Jobs
|
||||
// Send a request with api
|
||||
try {
|
||||
$response = $apiService->request(self::PRINTERS_GET_JOBS);
|
||||
} catch (Exception $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
$error++;
|
||||
}
|
||||
$responsedata = json_decode($response, true);
|
||||
//$html .= '<pre>'.print_r($responsedata,true).'</pre>';
|
||||
$html .= '<div class="div-table-responsive">';
|
||||
$html .= '<table width="100%" class="noborder">';
|
||||
$html .= '<tr class="liste_titre">';
|
||||
$html .= '<td>'.$langs->trans("Id").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Date").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Owner").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Printer").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Filename").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Status").'</td>';
|
||||
$html .= '<td>'.$langs->trans("Cancel").'</td>';
|
||||
$html .= '</tr>'."\n";
|
||||
|
||||
$jobs = $responsedata['jobs'];
|
||||
//$html .= '<pre>'.print_r($jobs['0'],true).'</pre>';
|
||||
if (is_array($jobs)) {
|
||||
foreach ($jobs as $value) {
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td>'.$value['id'].'</td>';
|
||||
$dates = dol_print_date((int) substr($value['createTime'], 0, 10), 'dayhour');
|
||||
$html .= '<td>'.$dates.'</td>';
|
||||
$html .= '<td>'.$value['ownerId'].'</td>';
|
||||
$html .= '<td>'.$value['printerName'].'</td>';
|
||||
$html .= '<td>'.$value['title'].'</td>';
|
||||
$html .= '<td>'.$value['status'].'</td>';
|
||||
$html .= '<td> </td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
$jobs = $responsedata['jobs'];
|
||||
//$html .= '<pre>'.print_r($jobs['0'],true).'</pre>';
|
||||
if (is_array($jobs)) {
|
||||
foreach ($jobs as $value) {
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td>'.$value['id'].'</td>';
|
||||
$dates = dol_print_date((int) substr($value['createTime'], 0, 10), 'dayhour');
|
||||
$html .= '<td>'.$dates.'</td>';
|
||||
$html .= '<td>'.$value['ownerId'].'</td>';
|
||||
$html .= '<td>'.$value['printerName'].'</td>';
|
||||
$html .= '<td>'.$value['title'].'</td>';
|
||||
$html .= '<td>'.$value['status'].'</td>';
|
||||
$html .= '<td> </td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
} else {
|
||||
$html .= '<tr class="oddeven">';
|
||||
$html .= '<td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
$html .= '</tr>';
|
||||
}
|
||||
$html .= '</table>';
|
||||
$html .= '</div>';
|
||||
|
||||
$this->resprint = $html;
|
||||
$this->resprint = $html;
|
||||
|
||||
return $error;
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,21 +38,21 @@ print "</tr>\n";
|
||||
|
||||
if ($action !== 'editcomment')
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Description
|
||||
print '<td colspan="3">';
|
||||
// Description
|
||||
print '<td colspan="3">';
|
||||
|
||||
$desc = GETPOST('comment_description');
|
||||
$desc = GETPOST('comment_description');
|
||||
|
||||
$doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
|
||||
print $doleditor->Create(1);
|
||||
$doleditor = new DolEditor('comment_description', $desc, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
|
||||
print $doleditor->Create(1);
|
||||
|
||||
print '</td>';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
print '<td class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table></form>';
|
||||
@ -96,47 +96,47 @@ if (!empty($object->comments))
|
||||
print '<div class="comment-cell comment-right">';
|
||||
print '<div class="comment-table width100p">';
|
||||
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
print '<form method="POST" action="'.$varpage.'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatecomment">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="idcomment" value="'.$idcomment.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
}
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
print '<form method="POST" action="'.$varpage.'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updatecomment">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="idcomment" value="'.$idcomment.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
}
|
||||
|
||||
print '<div class="comment-description comment-cell">';
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
$doleditor = new DolEditor('comment_description', $comment->description, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
|
||||
print $doleditor->Create(1);
|
||||
} else {
|
||||
print $comment->description;
|
||||
}
|
||||
print '<div class="comment-description comment-cell">';
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
$doleditor = new DolEditor('comment_description', $comment->description, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%');
|
||||
print $doleditor->Create(1);
|
||||
} else {
|
||||
print $comment->description;
|
||||
}
|
||||
print '</div>'; // End comment-description
|
||||
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
print '<input name="update" type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
print '<input name="cancel" type="submit" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
if ($action === 'editcomment' && $comment->id == $idcomment)
|
||||
{
|
||||
print '<input name="update" type="submit" class="button" value="'.$langs->trans("Update").'">';
|
||||
print '<input name="cancel" type="submit" class="button" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
if ($fk_user == $user->id || $user->admin == 1)
|
||||
{
|
||||
print '<a class="comment-edit comment-cell" href="'.$varpage.'?action=editcomment&token='.newToken().'&id='.$id.'&withproject=1&idcomment='.$comment->id.'#comment" title="'.$langs->trans('Edit').'">';
|
||||
print img_picto('', 'edit.png');
|
||||
print '</a>';
|
||||
}
|
||||
if (($first && $fk_user == $user->id) || $user->admin == 1) {
|
||||
print '<a class="comment-delete comment-cell" href="'.$varpage.'?action=deletecomment&token='.newToken().'&id='.$id.'&withproject=1&idcomment='.$comment->id.'" title="'.$langs->trans('Delete').'">';
|
||||
print img_picto('', 'delete.png');
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
print '</form>';
|
||||
} else {
|
||||
if ($fk_user == $user->id || $user->admin == 1)
|
||||
{
|
||||
print '<a class="comment-edit comment-cell" href="'.$varpage.'?action=editcomment&token='.newToken().'&id='.$id.'&withproject=1&idcomment='.$comment->id.'#comment" title="'.$langs->trans('Edit').'">';
|
||||
print img_picto('', 'edit.png');
|
||||
print '</a>';
|
||||
}
|
||||
if (($first && $fk_user == $user->id) || $user->admin == 1) {
|
||||
print '<a class="comment-delete comment-cell" href="'.$varpage.'?action=deletecomment&token='.newToken().'&id='.$id.'&withproject=1&idcomment='.$comment->id.'" title="'.$langs->trans('Delete').'">';
|
||||
print img_picto('', 'delete.png');
|
||||
print '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>'; // End comment-table
|
||||
print '</div>'; // End comment-table
|
||||
print '</div>'; // End comment-right
|
||||
print '</div>'; // End comment
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class EcmDirectory extends CommonObject
|
||||
/**
|
||||
* @var string Name of table without prefix where object is stored
|
||||
*/
|
||||
public $table_element='ecm_directories';
|
||||
public $table_element = 'ecm_directories';
|
||||
|
||||
/**
|
||||
* @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png
|
||||
|
||||
@ -44,8 +44,8 @@ $socid = GETPOST("socid", "int");
|
||||
// Security check
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
@ -62,14 +62,14 @@ if (!$sortfield) $sortfield = "label";
|
||||
$section = GETPOST("section", 'alpha');
|
||||
if (!$section)
|
||||
{
|
||||
dol_print_error('', 'Error, section parameter missing');
|
||||
exit;
|
||||
dol_print_error('', 'Error, section parameter missing');
|
||||
exit;
|
||||
}
|
||||
$urlfile = GETPOST("urlfile");
|
||||
if (!$urlfile)
|
||||
{
|
||||
dol_print_error('', "ErrorParamNotDefined");
|
||||
exit;
|
||||
dol_print_error('', "ErrorParamNotDefined");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load ecm object
|
||||
@ -77,8 +77,8 @@ $ecmdir = new EcmDirectory($db);
|
||||
$result = $ecmdir->fetch(GETPOST("section", 'alpha'));
|
||||
if (!$result > 0)
|
||||
{
|
||||
dol_print_error($db, $ecmdir->error);
|
||||
exit;
|
||||
dol_print_error($db, $ecmdir->error);
|
||||
exit;
|
||||
}
|
||||
$relativepath = $ecmdir->getRelativePath();
|
||||
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
|
||||
@ -114,67 +114,67 @@ if ($result < 0)
|
||||
|
||||
if ($cancel)
|
||||
{
|
||||
$action = '';
|
||||
if ($backtopage)
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
} else {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section).($module ? '&module='.urlencode($module) : ''));
|
||||
exit;
|
||||
}
|
||||
$action = '';
|
||||
if ($backtopage)
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
} else {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section).($module ? '&module='.urlencode($module) : ''));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Rename file
|
||||
if ($action == 'update')
|
||||
{
|
||||
$error = 0;
|
||||
$error = 0;
|
||||
|
||||
$oldlabel = GETPOST('urlfile', 'alpha');
|
||||
$newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
|
||||
$oldlabel = GETPOST('urlfile', 'alpha');
|
||||
$newlabel = dol_sanitizeFileName(GETPOST('label', 'alpha'));
|
||||
$shareenabled = GETPOST('shareenabled', 'alpha');
|
||||
|
||||
//$db->begin();
|
||||
//$db->begin();
|
||||
|
||||
$olddir = $ecmdir->getRelativePath(0); // Relative to ecm
|
||||
$olddirrelativetodocument = 'ecm/'.$olddir; // Relative to document
|
||||
$newdirrelativetodocument = 'ecm/'.$olddir;
|
||||
$olddir = $conf->ecm->dir_output.'/'.$olddir;
|
||||
$newdir = $olddir;
|
||||
$olddir = $ecmdir->getRelativePath(0); // Relative to ecm
|
||||
$olddirrelativetodocument = 'ecm/'.$olddir; // Relative to document
|
||||
$newdirrelativetodocument = 'ecm/'.$olddir;
|
||||
$olddir = $conf->ecm->dir_output.'/'.$olddir;
|
||||
$newdir = $olddir;
|
||||
|
||||
$oldfile = $olddir.$oldlabel;
|
||||
$newfile = $newdir.$newlabel;
|
||||
$newfileformove = $newfile;
|
||||
// If old file end with .noexe, new file must also end with .noexe
|
||||
if (preg_match('/\.noexe$/', $oldfile) && ! preg_match('/\.noexe$/', $newfileformove)) {
|
||||
$newfileformove .= '.noexe';
|
||||
}
|
||||
//var_dump($oldfile);var_dump($newfile);exit;
|
||||
$oldfile = $olddir.$oldlabel;
|
||||
$newfile = $newdir.$newlabel;
|
||||
$newfileformove = $newfile;
|
||||
// If old file end with .noexe, new file must also end with .noexe
|
||||
if (preg_match('/\.noexe$/', $oldfile) && ! preg_match('/\.noexe$/', $newfileformove)) {
|
||||
$newfileformove .= '.noexe';
|
||||
}
|
||||
//var_dump($oldfile);var_dump($newfile);exit;
|
||||
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
//print $oldfile.' - '.$newfile;
|
||||
if ($newlabel != $oldlabel)
|
||||
{
|
||||
$result = dol_move($oldfile, $newfileformove); // This include update of database
|
||||
if (!$result)
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans('ErrorFailToRenameFile', $oldfile, $newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
// Now we update index of file
|
||||
$db->begin();
|
||||
//print $oldfile.' - '.$newfile;
|
||||
if ($newlabel != $oldlabel)
|
||||
{
|
||||
$result = dol_move($oldfile, $newfileformove); // This include update of database
|
||||
if (!$result)
|
||||
{
|
||||
$langs->load('errors');
|
||||
setEventMessages($langs->trans('ErrorFailToRenameFile', $oldfile, $newfile), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
// Reload object after the move
|
||||
$result = $object->fetch(0, '', $newdirrelativetodocument.$newlabel);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
// Reload object after the move
|
||||
$result = $object->fetch(0, '', $newdirrelativetodocument.$newlabel);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error, $object->errors);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
if (!$error)
|
||||
{
|
||||
if ($shareenabled)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
@ -217,23 +217,23 @@ if ($action == 'update')
|
||||
setEventMessages($object->error, $object->errors, 'warnings');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
if (!$error)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
$urlfile = $newlabel;
|
||||
// If old file end with .noexe, new file must also end with .noexe
|
||||
if (preg_match('/\.noexe$/', $newfileformove)) {
|
||||
$urlfile .= '.noexe';
|
||||
}
|
||||
$urlfile = $newlabel;
|
||||
// If old file end with .noexe, new file must also end with .noexe
|
||||
if (preg_match('/\.noexe$/', $newfileformove)) {
|
||||
$urlfile .= '.noexe';
|
||||
}
|
||||
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section));
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -381,7 +381,7 @@ if (!empty($object->share))
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print $object->showOptionals($extrafields, ($action == 'edit'?'edit':'view'));
|
||||
print $object->showOptionals($extrafields, ($action == 'edit' ? 'edit' : 'view'));
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
@ -392,20 +392,20 @@ dol_fiche_end();
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
// Confirmation de la suppression d'une ligne categorie
|
||||
if ($action == 'delete_file')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.urlencode($section), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile', $urlfile), 'confirm_deletefile', '', 1, 1);
|
||||
}
|
||||
|
||||
if ($action != 'edit')
|
||||
@ -413,11 +413,11 @@ if ($action != 'edit')
|
||||
// Actions buttons
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
}
|
||||
/*
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.urlencode($section).'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>';
|
||||
}
|
||||
/*
|
||||
if ($user->rights->ecm->setup)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=delete_file&token='.newToken().'§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Delete').'</a>';
|
||||
|
||||
@ -405,7 +405,7 @@ class ExpenseReport extends CommonObject
|
||||
$this->id = 0;
|
||||
$this->ref = '';
|
||||
$this->status = 0;
|
||||
$this->fk_statut = 0; // deprecated
|
||||
$this->fk_statut = 0; // deprecated
|
||||
|
||||
// Clear fields
|
||||
$this->fk_user_author = $fk_user_author; // Note fk_user_author is not the 'author' but the guy the expense report is for.
|
||||
@ -1353,7 +1353,7 @@ class ExpenseReport extends CommonObject
|
||||
$sql .= ' WHERE rowid = '.$this->id;
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->fk_statut = 99; // deprecated
|
||||
$this->fk_statut = 99; // deprecated
|
||||
$this->status = 99;
|
||||
$this->fk_user_refuse = $fuser->id;
|
||||
$this->detail_refuse = $details;
|
||||
|
||||
@ -459,7 +459,7 @@ if ($step == 1 || !$datatoexport)
|
||||
print '</td><td class="right">';
|
||||
if ($objexport->array_export_perms[$key])
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&module_position='.$objexport->array_export_module[$key]->module_position.'&datatoexport='.$objexport->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"), 'filenew').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/exports/export.php?step=2&module_position='.$objexport->array_export_module[$key]->module_position.'&datatoexport='.$objexport->array_export_code[$key].'">'.img_picto($langs->trans("NewExport"), 'next', 'class="fa-15x"').'</a>';
|
||||
} else {
|
||||
print $langs->trans("NotEnoughPermissions");
|
||||
}
|
||||
|
||||
@ -202,16 +202,16 @@ if (empty($reshook))
|
||||
}
|
||||
} elseif ($action == 'add' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->duration = GETPOST('duration', 'int');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->fk_contrat = GETPOST('contratid', 'int');
|
||||
$object->author = $user->id;
|
||||
$object->description = GETPOST('description', 'restricthtml');
|
||||
$object->ref = $ref;
|
||||
$object->model_pdf = GETPOST('model', 'alpha');
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
$object->socid = $socid;
|
||||
$object->duration = GETPOST('duration', 'int');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->fk_contrat = GETPOST('contratid', 'int');
|
||||
$object->author = $user->id;
|
||||
$object->description = GETPOST('description', 'restricthtml');
|
||||
$object->ref = $ref;
|
||||
$object->model_pdf = GETPOST('model', 'alpha');
|
||||
$object->note_private = GETPOST('note_private', 'restricthtml');
|
||||
$object->note_public = GETPOST('note_public', 'restricthtml');
|
||||
|
||||
if ($object->socid > 0)
|
||||
{
|
||||
@ -251,7 +251,7 @@ if (empty($reshook))
|
||||
$extrafields = new ExtraFields($db);
|
||||
$array_options = $extrafields->getOptionalsFromPost($object->table_element);
|
||||
|
||||
$object->array_options = $array_options;
|
||||
$object->array_options = $array_options;
|
||||
|
||||
$id = $object->create($user);
|
||||
|
||||
@ -356,12 +356,12 @@ if (empty($reshook))
|
||||
|
||||
$result = $object->addline(
|
||||
$user,
|
||||
$id,
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration,
|
||||
$array_options
|
||||
);
|
||||
$id,
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration,
|
||||
$array_options
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -371,44 +371,44 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$mesg = $srcobject->error;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$mesg = $object->error;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
$action = 'create';
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
// Extrafields
|
||||
$array_options = $extrafields->getOptionalsFromPost($object->table_element);
|
||||
if (!$error)
|
||||
{
|
||||
// Extrafields
|
||||
$array_options = $extrafields->getOptionalsFromPost($object->table_element);
|
||||
|
||||
$object->array_options = $array_options;
|
||||
$object->array_options = $array_options;
|
||||
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$id = $result; // Force raffraichissement sur fiche venant d'etre cree
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result = $object->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
$id = $result; // Force raffraichissement sur fiche venant d'etre cree
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
|
||||
$action = 'create';
|
||||
}
|
||||
$action = 'create';
|
||||
}
|
||||
} elseif ($action == 'update' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
@ -482,14 +482,14 @@ if (empty($reshook))
|
||||
$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
|
||||
|
||||
$result = $object->addline(
|
||||
$result = $object->addline(
|
||||
$user,
|
||||
$id,
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration,
|
||||
$array_options
|
||||
);
|
||||
$id,
|
||||
$desc,
|
||||
$date_intervention,
|
||||
$duration,
|
||||
$array_options
|
||||
);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@ -545,14 +545,14 @@ if (empty($reshook))
|
||||
// Classify Done
|
||||
elseif ($action == 'classifydone' && $user->rights->ficheinter->creer)
|
||||
{
|
||||
$result = $object->setStatut(3);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
$result = $object->setStatut(3);
|
||||
if ($result > 0)
|
||||
{
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Reopen
|
||||
@ -591,9 +591,9 @@ if (empty($reshook))
|
||||
$date_inter = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int'));
|
||||
$duration = convertTime2Seconds(GETPOST('durationhour', 'int'), GETPOST('durationmin', 'int'));
|
||||
|
||||
$objectline->datei = $date_inter;
|
||||
$objectline->desc = $desc;
|
||||
$objectline->duration = $duration;
|
||||
$objectline->datei = $date_inter;
|
||||
$objectline->desc = $desc;
|
||||
$objectline->duration = $duration;
|
||||
|
||||
// Extrafields
|
||||
$extrafields->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -601,11 +601,11 @@ if (empty($reshook))
|
||||
$objectline->array_options = $array_options;
|
||||
|
||||
$result = $objectline->update($user);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@ -817,11 +817,11 @@ if ($action == 'create')
|
||||
$subelement = $regs[2];
|
||||
}
|
||||
|
||||
if ($element == 'project')
|
||||
{
|
||||
$projectid = GETPOST('originid', 'int');
|
||||
} else {
|
||||
// For compatibility
|
||||
if ($element == 'project')
|
||||
{
|
||||
$projectid = GETPOST('originid', 'int');
|
||||
} else {
|
||||
// For compatibility
|
||||
if ($element == 'order' || $element == 'commande') {
|
||||
$element = $subelement = 'commande';
|
||||
}
|
||||
@ -904,20 +904,20 @@ if ($action == 'create')
|
||||
|
||||
$langs->load("project");
|
||||
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
/* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty
|
||||
print '<tr><td>'.$langs->trans("Project").'</td><td>';
|
||||
/* Fix: If a project must be linked to any companies (suppliers or not), project must be not be set as limited to customer but must be not linked to any particular thirdparty
|
||||
if ($societe->fournisseur==1)
|
||||
$numprojet=select_projects(-1,$_POST["projectid"],'projectid');
|
||||
else
|
||||
$numprojet=select_projects($societe->id,$_POST["projectid"],'projectid');
|
||||
*/
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid');
|
||||
if ($numprojet == 0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid');
|
||||
if ($numprojet == 0)
|
||||
{
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$soc->id.'&action=create"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddProject").'"></span></a>';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Contract
|
||||
if ($conf->contrat->enabled)
|
||||
@ -932,53 +932,53 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Model
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td>';
|
||||
$liste = ModelePDFFicheinter::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
// Model
|
||||
print '<tr>';
|
||||
print '<td>'.$langs->trans("DefaultModel").'</td>';
|
||||
print '<td>';
|
||||
$liste = ModelePDFFicheinter::liste_modeles($db);
|
||||
print $form->selectarray('model', $liste, $conf->global->FICHEINTER_ADDON_PDF);
|
||||
print "</td></tr>";
|
||||
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
print '</td></tr>';
|
||||
// Public note
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_public" cols="80" rows="'.ROWS_3.'">'.$note_public.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
// Private note
|
||||
if (empty($user->socid))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePrivate').'</td>';
|
||||
print '<td>';
|
||||
$doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
//print '<textarea name="note_private" cols="80" rows="'.ROWS_3.'">'.$note_private.'</textarea>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
// Other attributes
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook))
|
||||
{
|
||||
print $object->showOptionals($extrafields, 'edit');
|
||||
}
|
||||
|
||||
// Show link to origin object
|
||||
if (!empty($origin) && !empty($originid) && is_object($objectsrc))
|
||||
{
|
||||
$newclassname = $classname;
|
||||
if ($newclassname == 'Propal') $newclassname = 'CommercialProposal';
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
// Show link to origin object
|
||||
if (!empty($origin) && !empty($originid) && is_object($objectsrc))
|
||||
{
|
||||
$newclassname = $classname;
|
||||
if ($newclassname == 'Propal') $newclassname = 'CommercialProposal';
|
||||
print '<tr><td>'.$langs->trans($newclassname).'</td><td colspan="2">'.$objectsrc->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Amount
|
||||
/* Hide amount because we only copy services so amount may differ than source
|
||||
// Amount
|
||||
/* Hide amount because we only copy services so amount may differ than source
|
||||
print '<tr><td>' . $langs->trans('AmountHT') . '</td><td>' . price($objectsrc->total_ht) . '</td></tr>';
|
||||
print '<tr><td>' . $langs->trans('AmountVAT') . '</td><td>' . price($objectsrc->total_tva) . "</td></tr>";
|
||||
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||
@ -1000,14 +1000,14 @@ if ($action == 'create')
|
||||
print '<tr><td>' . $langs->trans('MulticurrencyAmountTTC') . '</td><td>' . price($objectsrc->multicurrency_total_ttc) . "</td></tr>";
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
print '<input type="hidden" name="origin" value="'.$objectsrc->element.'">';
|
||||
print '<input type="hidden" name="originid" value="'.$objectsrc->id.'">';
|
||||
} elseif ($origin == 'project' && !empty($projectid)) {
|
||||
print '<input type="hidden" name="projectid" value="'.$projectid.'">';
|
||||
}
|
||||
@ -1016,8 +1016,8 @@ if ($action == 'create')
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
@ -1058,8 +1058,8 @@ if ($action == 'create')
|
||||
print '<div class="center">';
|
||||
print '<input type="hidden" name="action" value="create">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
@ -1172,46 +1172,46 @@ if ($action == 'create')
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->ficheinter->creer)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
if (!empty($conf->global->FICHINTER_USE_PLANNED_AND_DONE_DATES))
|
||||
{
|
||||
@ -1269,47 +1269,47 @@ if ($action == 'create')
|
||||
$formcontract->formSelectContract($_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid, $object->fk_contrat, 'contratid', 0, 1, 1);
|
||||
} else {
|
||||
if ($object->fk_contrat)
|
||||
{
|
||||
$contratstatic = new Contrat($db);
|
||||
$contratstatic->fetch($object->fk_contrat);
|
||||
//print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
|
||||
print $contratstatic->getNomUrl(0, '', 1);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
{
|
||||
$contratstatic = new Contrat($db);
|
||||
$contratstatic->fetch($object->fk_contrat);
|
||||
//print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
|
||||
print $contratstatic->getNomUrl(0, '', 1);
|
||||
} else {
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td>'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td>'.convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
@ -1464,25 +1464,25 @@ if ($action == 'create')
|
||||
|
||||
// Date d'intervention
|
||||
print '<td class="center nowrap">';
|
||||
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
|
||||
print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention");
|
||||
} else {
|
||||
print $form->selectDate($db->jdate($objp->date_intervention), 'di', 1, 1, 0, "date_intervention");
|
||||
}
|
||||
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
|
||||
print $form->selectDate($db->jdate($objp->date_intervention), 'di', 0, 0, 0, "date_intervention");
|
||||
} else {
|
||||
print $form->selectDate($db->jdate($objp->date_intervention), 'di', 1, 1, 0, "date_intervention");
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Duration
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
|
||||
$selectmode = 'select';
|
||||
if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION))
|
||||
$selectmode = 'text';
|
||||
$form->select_duration('duration', $objp->duree, 0, $selectmode);
|
||||
}
|
||||
print '</td>';
|
||||
// Duration
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
|
||||
$selectmode = 'select';
|
||||
if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION))
|
||||
$selectmode = 'text';
|
||||
$form->select_duration('duration', $objp->duree, 0, $selectmode);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center" colspan="5" valign="center">';
|
||||
print '<input type="submit" class="button buttongen marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<td class="center" colspan="5" valign="center">';
|
||||
print '<input type="submit" class="button buttongen marginbottomonly" name="save" value="'.$langs->trans("Save").'">';
|
||||
print '<input type="submit" class="button buttongen marginbottomonly" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
@ -1514,13 +1514,13 @@ if ($action == 'create')
|
||||
print '<td width="5" class="center linecolnum"></td>';
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('Description').'</td>';
|
||||
print '<td class="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'</td>';
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
print '<td>';
|
||||
print '<a name="add"></a>'; // ancre
|
||||
print $langs->trans('Description').'</td>';
|
||||
print '<td class="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td class="right">'.(empty($conf->global->FICHINTER_WITHOUT_DURATION) ? $langs->trans('Duration') : '').'</td>';
|
||||
print '<td colspan="3"> </td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
print '<tr class="oddeven nohover">'."\n";
|
||||
@ -1530,43 +1530,43 @@ if ($action == 'create')
|
||||
print '<td class="center linecolnum">'.($i + 1).'</td>';
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
// editeur wysiwyg
|
||||
if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%');
|
||||
$doleditor->Create();
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// editeur wysiwyg
|
||||
if (empty($conf->global->FICHINTER_EMPTY_LINE_DESC)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('np_desc', GETPOST('np_desc', 'restricthtml'), '', 100, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_DETAILS, ROWS_2, '90%');
|
||||
$doleditor->Create();
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Date intervention
|
||||
print '<td class="center nowrap">';
|
||||
// Date intervention
|
||||
print '<td class="center nowrap">';
|
||||
$now = dol_now();
|
||||
$timearray = dol_getdate($now);
|
||||
if (!GETPOST('diday', 'int')) {
|
||||
$timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
|
||||
} else {
|
||||
$timewithnohour = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int'));
|
||||
}
|
||||
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
|
||||
print $form->selectDate($timewithnohour, 'di', 0, 0, 0, "addinter");
|
||||
} else {
|
||||
print $form->selectDate($timewithnohour, 'di', 1, 1, 0, "addinter");
|
||||
}
|
||||
$timewithnohour = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']);
|
||||
} else {
|
||||
$timewithnohour = dol_mktime(GETPOST('dihour', 'int'), GETPOST('dimin', 'int'), 0, GETPOST('dimonth', 'int'), GETPOST('diday', 'int'), GETPOST('diyear', 'int'));
|
||||
}
|
||||
if (!empty($conf->global->FICHINTER_DATE_WITHOUT_HOUR)) {
|
||||
print $form->selectDate($timewithnohour, 'di', 0, 0, 0, "addinter");
|
||||
} else {
|
||||
print $form->selectDate($timewithnohour, 'di', 1, 1, 0, "addinter");
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Duration
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
|
||||
$selectmode = 'select';
|
||||
if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
|
||||
$selectmode = 'text';
|
||||
}
|
||||
$form->select_duration('duration', (!GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) ? 3600 : (60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int')), 0, $selectmode);
|
||||
}
|
||||
print '</td>';
|
||||
// Duration
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->FICHINTER_WITHOUT_DURATION)) {
|
||||
$selectmode = 'select';
|
||||
if (!empty($conf->global->INTERVENTION_ADDLINE_FREEDUREATION)) {
|
||||
$selectmode = 'text';
|
||||
}
|
||||
$form->select_duration('duration', (!GETPOST('durationhour', 'int') && !GETPOST('durationmin', 'int')) ? 3600 : (60 * 60 * GETPOST('durationhour', 'int') + 60 * GETPOST('durationmin', 'int')), 0, $selectmode);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td class="center" valign="middle" colspan="3"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
|
||||
print '<td class="center" valign="middle" colspan="3"><input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline"></td>';
|
||||
print '</tr>';
|
||||
|
||||
//Line extrafield
|
||||
@ -1601,22 +1601,22 @@ if ($action == 'create')
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
// modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($user->socid == 0)
|
||||
{
|
||||
if ($action != 'editdescription' && ($action != 'presend')) {
|
||||
// Validate
|
||||
if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate"';
|
||||
print '>'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
}
|
||||
if ($action != 'editdescription' && ($action != 'presend')) {
|
||||
// Validate
|
||||
if ($object->statut == Fichinter::STATUS_DRAFT && (count($object->lines) > 0 || !empty($conf->global->FICHINTER_DISABLE_DETAILS))) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->validate)) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=validate"';
|
||||
print '>'.$langs->trans("Validate").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($object->statut == Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate)))
|
||||
// Modify
|
||||
if ($object->statut == Fichinter::STATUS_VALIDATED && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->creer) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->ficheinter->ficheinter_advance->unvalidate)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=modify">';
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) print $langs->trans("Modify");
|
||||
@ -1684,7 +1684,7 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Done
|
||||
if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED)
|
||||
if (empty($conf->global->FICHINTER_CLASSIFY_BILLED) && $object->statut > Fichinter::STATUS_DRAFT && $object->statut < Fichinter::STATUS_CLOSED)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=classifydone">'.$langs->trans("InterventionClassifyDone").'</a></div>';
|
||||
}
|
||||
|
||||
@ -250,12 +250,11 @@ class FichinterRec extends Fichinter
|
||||
*/
|
||||
public function fetch($rowid = 0, $ref = '', $ref_ext = '')
|
||||
{
|
||||
$sql = 'SELECT f.titre, f.fk_soc';
|
||||
$sql = 'SELECT f.titre as title, f.fk_soc';
|
||||
$sql .= ', f.datec, f.duree, f.fk_projet, f.fk_contrat, f.description';
|
||||
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
$sql .= ', f.frequency, f.unit_frequency, f.date_when, f.date_last_gen, f.nb_gen_done, f.nb_gen_max, f.auto_validate';
|
||||
$sql .= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'fichinter_rec as f';
|
||||
if ($rowid > 0) $sql .= ' WHERE f.rowid='.$rowid;
|
||||
elseif ($ref) $sql .= " WHERE f.titre='".$this->db->escape($ref)."'";
|
||||
@ -268,8 +267,9 @@ class FichinterRec extends Fichinter
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $rowid;
|
||||
$this->titre = $obj->titre;
|
||||
$this->ref = $obj->titre;
|
||||
$this->titre = $obj->title;
|
||||
$this->title = $obj->title;
|
||||
$this->ref = $obj->title;
|
||||
$this->description = $obj->description;
|
||||
$this->datec = $obj->datec;
|
||||
$this->duration = $obj->duree;
|
||||
|
||||
@ -1554,7 +1554,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
if (!$qty) $qty = 1;
|
||||
if (empty($qty)) $qty = 0;
|
||||
if (!$info_bits) $info_bits = 0;
|
||||
if (empty($txtva)) $txtva = 0;
|
||||
if (empty($txlocaltax1)) $txlocaltax1 = 0;
|
||||
@ -2526,7 +2526,6 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$remise_percent = price2num($remise_percent);
|
||||
$qty = price2num($qty);
|
||||
if (!$qty) $qty = 1;
|
||||
$pu = price2num($pu);
|
||||
$pu_ht_devise = price2num($pu_ht_devise);
|
||||
$txtva = price2num($txtva);
|
||||
|
||||
@ -702,7 +702,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$this->note_private = $obj->note_private;
|
||||
$this->note_public = $obj->note_public;
|
||||
$this->model_pdf = $obj->model_pdf;
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
$this->modelpdf = $obj->model_pdf; // deprecated
|
||||
$this->import_key = $obj->import_key;
|
||||
|
||||
//Incoterms
|
||||
@ -827,7 +827,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
// Accountancy
|
||||
$line->code_ventilation = $obj->fk_code_ventilation;
|
||||
$line->fk_accounting_account = $obj->fk_code_ventilation;
|
||||
$line->fk_accounting_account = $obj->fk_code_ventilation;
|
||||
|
||||
// Multicurrency
|
||||
$line->fk_multicurrency = $obj->fk_multicurrency;
|
||||
@ -2286,7 +2286,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
if ($this->type == self::TYPE_CREDIT_NOTE) $picto .= 'a'; // Credit note
|
||||
if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice
|
||||
|
||||
$label = '<u>'.$langs->trans("SupplierInvoice").'</u>';
|
||||
$label = img_picto('', $this->picto).' <u>'.$langs->trans("SupplierInvoice").'</u>';
|
||||
if ($this->type == self::TYPE_REPLACEMENT) $label = '<u>'.$langs->transnoentitiesnoconv("InvoiceReplace").'</u>';
|
||||
elseif ($this->type == self::TYPE_CREDIT_NOTE) $label = '<u>'.$langs->transnoentitiesnoconv("CreditNote").'</u>';
|
||||
elseif ($this->type == self::TYPE_DEPOSIT) $label = '<u>'.$langs->transnoentitiesnoconv("Deposit").'</u>';
|
||||
@ -2301,7 +2301,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (!empty($this->total_ht))
|
||||
$label .= '<br><b>'.$langs->trans('AmountHT').':</b> '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (!empty($this->total_tva))
|
||||
$label .= '<br><b>'.$langs->trans('VAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
$label .= '<br><b>'.$langs->trans('AmountVAT').':</b> '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if (!empty($this->total_ttc))
|
||||
$label .= '<br><b>'.$langs->trans('AmountTTC').':</b> '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
|
||||
if ($moretitle) $label .= ' - '.$moretitle;
|
||||
|
||||
@ -406,7 +406,7 @@ if (empty($reshook))
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST('qty'))
|
||||
if (GETPOST('qty', 'int') == '')
|
||||
{
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
|
||||
$error++;
|
||||
@ -666,7 +666,7 @@ if (empty($reshook))
|
||||
$productsupplier = new ProductFournisseur($db);
|
||||
if (!empty($conf->global->SUPPLIER_ORDER_WITH_PREDEFINED_PRICES_ONLY))
|
||||
{
|
||||
if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, price2num($_POST['qty']), $line->fk_product, 'none', GETPOST('socid', 'int')) < 0)
|
||||
if ($line->fk_product > 0 && $productsupplier->get_buyprice(0, price2num(GETPOST('qty', 'int')), $line->fk_product, 'none', GETPOST('socid', 'int')) < 0)
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'warnings');
|
||||
}
|
||||
@ -719,7 +719,7 @@ if (empty($reshook))
|
||||
$lineid,
|
||||
$_POST['product_desc'],
|
||||
$ht,
|
||||
$_POST['qty'],
|
||||
GETPOST('qty', 'int'),
|
||||
$_POST['remise_percent'],
|
||||
$vat_rate,
|
||||
$localtax1_rate,
|
||||
|
||||
@ -364,30 +364,30 @@ if (empty($reshook))
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
$result = $objecttmp->addline(
|
||||
$result = $objecttmp->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
$lines[$i]->tva_tx,
|
||||
$lines[$i]->localtax1_tx,
|
||||
$lines[$i]->localtax2_tx,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->qty,
|
||||
$lines[$i]->fk_product,
|
||||
$lines[$i]->remise_percent,
|
||||
$date_start,
|
||||
$date_end,
|
||||
0,
|
||||
$lines[$i]->info_bits,
|
||||
'HT',
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
false,
|
||||
$lines[$i]->array_options,
|
||||
$lines[$i]->fk_unit,
|
||||
$objecttmp->origin_id,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->ref_supplier,
|
||||
$lines[$i]->special_code,
|
||||
$fk_parent_line
|
||||
'HT',
|
||||
$product_type,
|
||||
$lines[$i]->rang,
|
||||
false,
|
||||
$lines[$i]->array_options,
|
||||
$lines[$i]->fk_unit,
|
||||
$objecttmp->origin_id,
|
||||
$lines[$i]->pa_ht,
|
||||
$lines[$i]->ref_supplier,
|
||||
$lines[$i]->special_code,
|
||||
$fk_parent_line
|
||||
);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -686,7 +686,7 @@ if ($resql)
|
||||
$arrayofmassactions = array(
|
||||
'generate_doc'=>$langs->trans("ReGeneratePDF"),
|
||||
'builddoc'=>$langs->trans("PDFMerge"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
'presend'=>$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
|
||||
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||
@ -1293,14 +1293,14 @@ if ($resql)
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
print '</table>'."\n";
|
||||
print '</div>';
|
||||
|
||||
print '</form>'."\n";
|
||||
print '</form>'."\n";
|
||||
|
||||
$hidegeneratedfilelistifempty = 1;
|
||||
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|
||||
|
||||
@ -153,21 +153,21 @@ if (empty($reshook))
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $permissiontoadd)
|
||||
{
|
||||
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid.
|
||||
$objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone. We use native clone to keep this->db valid.
|
||||
|
||||
if (GETPOST('newsupplierref', 'alphanohtml')) $objectutil->ref_supplier = GETPOST('newsupplierref', 'alphanohtml');
|
||||
$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
|
||||
if (GETPOST('newsupplierref', 'alphanohtml')) $objectutil->ref_supplier = GETPOST('newsupplierref', 'alphanohtml');
|
||||
$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int'));
|
||||
|
||||
$result = $objectutil->createFromClone($user, $id);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
$result = $objectutil->createFromClone($user, $id);
|
||||
if ($result > 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result);
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
setEventMessages($objectutil->error, $objectutil->errors, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
} elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) {
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
@ -1041,7 +1041,7 @@ if (empty($reshook))
|
||||
$object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
|
||||
|
||||
if (GETPOST('price_ht') != '')
|
||||
{
|
||||
@ -1077,17 +1077,17 @@ if (empty($reshook))
|
||||
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
|
||||
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
|
||||
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $tva_tx))
|
||||
$info_bits |= 0x01;
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
if (preg_match('/\*/', $tva_tx))
|
||||
$info_bits |= 0x01;
|
||||
|
||||
// Define vat_rate
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
|
||||
// Define vat_rate
|
||||
$tva_tx = str_replace('*', '', $tva_tx);
|
||||
$localtax1_tx = get_localtax($tva_tx, 1, $mysoc, $object->thirdparty);
|
||||
$localtax2_tx = get_localtax($tva_tx, 2, $mysoc, $object->thirdparty);
|
||||
|
||||
$remise_percent = GETPOST('remise_percent');
|
||||
$remise_percent = GETPOST('remise_percent');
|
||||
$pu_ht_devise = GETPOST('multicurrency_subprice');
|
||||
|
||||
// Extrafields Lines
|
||||
@ -1100,12 +1100,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha'));
|
||||
if ($result >= 0)
|
||||
{
|
||||
unset($_POST['label']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['date_starthour']);
|
||||
$result = $object->updateline(GETPOST('lineid'), $label, $up, $tva_tx, $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('productid'), $price_base_type, $info_bits, $type, $remise_percent, 0, $date_start, $date_end, $array_options, $_POST['units'], $pu_ht_devise, GETPOST('fourn_ref', 'alpha'));
|
||||
if ($result >= 0)
|
||||
{
|
||||
unset($_POST['label']);
|
||||
unset($_POST['fourn_ref']);
|
||||
unset($_POST['date_starthour']);
|
||||
unset($_POST['date_startmin']);
|
||||
unset($_POST['date_startsec']);
|
||||
unset($_POST['date_startday']);
|
||||
@ -1250,7 +1250,7 @@ if (empty($reshook))
|
||||
|
||||
// if we use supplier description of the products
|
||||
if (!empty($productsupplier->desc_supplier) && !empty($conf->global->PRODUIT_FOURN_TEXTS)) {
|
||||
$desc = $productsupplier->desc_supplier;
|
||||
$desc = $productsupplier->desc_supplier;
|
||||
} else $desc = $productsupplier->description;
|
||||
|
||||
if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION));
|
||||
@ -1301,8 +1301,8 @@ if (empty($reshook))
|
||||
$array_options,
|
||||
$productsupplier->fk_unit,
|
||||
0,
|
||||
$pu_ht_devise,
|
||||
$ref_supplier,
|
||||
$pu_ht_devise,
|
||||
$ref_supplier,
|
||||
''
|
||||
);
|
||||
}
|
||||
@ -1430,34 +1430,34 @@ if (empty($reshook))
|
||||
|
||||
if (!$ventilExportCompta)
|
||||
{
|
||||
// On verifie si aucun paiement n'a ete effectue
|
||||
// On verifie si aucun paiement n'a ete effectue
|
||||
if ($resteapayer == price2num($object->total_ttc, 'MT', 1) && $object->statut == FactureFournisseur::STATUS_VALIDATED)
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
{
|
||||
$idwarehouse = GETPOST('idwarehouse');
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
} else {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
} else {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if (!$idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
// Check parameters
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
if (!$idwarehouse || $idwarehouse == -1)
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
$object->setDraft($user, $idwarehouse);
|
||||
$object->setDraft($user, $idwarehouse);
|
||||
|
||||
// Define output language
|
||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
|
||||
@ -1771,9 +1771,9 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : $objectsrc->ref_supplier).'" type="text"';
|
||||
if ($societe->id > 0) print ' autofocus';
|
||||
print '></td>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(isset($_POST['ref_supplier']) ? $_POST['ref_supplier'] : $objectsrc->ref_supplier).'" type="text"';
|
||||
if ($societe->id > 0) print ' autofocus';
|
||||
print '></td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Type').'</td><td>';
|
||||
@ -2059,7 +2059,7 @@ if ($action == 'create')
|
||||
$doleditor = new DolEditor('note_public', (GETPOSTISSET('note_public') ?GETPOST('note_public', 'restricthtml') : $note_public), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%');
|
||||
print $doleditor->Create(1);
|
||||
print '</td>';
|
||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
// print '<td><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Private note
|
||||
@ -2241,8 +2241,8 @@ if ($action == 'create')
|
||||
{
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplier"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier),
|
||||
array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now())
|
||||
array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplier"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier),
|
||||
array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now())
|
||||
);
|
||||
// Ask confirmation to clone
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneInvoice', $object->ref), 'confirm_clone', $formquestion, 'yes', 1, 250);
|
||||
@ -2279,59 +2279,59 @@ if ($action == 'create')
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse_array = $warehouse->list_array();
|
||||
if (count($warehouse_array) == 1) {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
|
||||
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
||||
} else {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
||||
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
||||
}
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
||||
);
|
||||
}
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse_array = $warehouse->list_array();
|
||||
if (count($warehouse_array) == 1) {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockDecrease", current($warehouse_array)) : $langs->trans("WarehouseForStockIncrease", current($warehouse_array));
|
||||
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
||||
} else {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
||||
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
||||
}
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ValidateBill'), $text, 'confirm_valid', $formquestion, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation edit (back to draft)
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$formquestion = array();
|
||||
// Confirmation edit (back to draft)
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$formquestion = array();
|
||||
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
} else {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse_array = $warehouse->list_array();
|
||||
if (count($warehouse_array) == 1) {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array));
|
||||
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
||||
} else {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease");
|
||||
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
||||
}
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
||||
);
|
||||
}
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnvalidateBill'), $langs->trans('ConfirmUnvalidateBill', $object->ref), 'confirm_edit', $formquestion, 1, 1);
|
||||
$qualified_for_stock_change = 0;
|
||||
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(2);
|
||||
} else {
|
||||
$qualified_for_stock_change = $object->hasProductsOrServices(1);
|
||||
}
|
||||
if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL) && $qualified_for_stock_change)
|
||||
{
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
$warehouse_array = $warehouse->list_array();
|
||||
if (count($warehouse_array) == 1) {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("WarehouseForStockIncrease", current($warehouse_array)) : $langs->trans("WarehouseForStockDecrease", current($warehouse_array));
|
||||
$value = '<input type="hidden" id="idwarehouse" name="idwarehouse" value="'.key($warehouse_array).'">';
|
||||
} else {
|
||||
$label = $object->type == FactureFournisseur::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockIncrease") : $langs->trans("SelectWarehouseForStockDecrease");
|
||||
$value = $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1);
|
||||
}
|
||||
$formquestion = array(
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $value)
|
||||
);
|
||||
}
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('UnvalidateBill'), $langs->trans('ConfirmUnvalidateBill', $object->ref), 'confirm_edit', $formquestion, 1, 1);
|
||||
}
|
||||
|
||||
// Confirmation set paid
|
||||
@ -2369,109 +2369,109 @@ if ($action == 'create')
|
||||
print $formconfirm;
|
||||
|
||||
|
||||
// Supplier invoice card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
// Supplier invoice card
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
|
||||
print $object->getLibType();
|
||||
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
|
||||
{
|
||||
$facreplaced = new FactureFournisseur($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$facusing = new FactureFournisseur($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
|
||||
}
|
||||
// Type
|
||||
print '<tr><td class="titlefield">'.$langs->trans('Type').'</td><td>';
|
||||
print $object->getLibType();
|
||||
if ($object->type == FactureFournisseur::TYPE_REPLACEMENT)
|
||||
{
|
||||
$facreplaced = new FactureFournisseur($db);
|
||||
$facreplaced->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("ReplaceInvoice", $facreplaced->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE)
|
||||
{
|
||||
$facusing = new FactureFournisseur($db);
|
||||
$facusing->fetch($object->fk_facture_source);
|
||||
print ' ('.$langs->transnoentities("CorrectInvoice", $facusing->getNomUrl(1)).')';
|
||||
}
|
||||
|
||||
$facidavoir = $object->getListIdAvoirFromInvoice();
|
||||
if (count($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i = 0;
|
||||
foreach ($facidavoir as $id)
|
||||
{
|
||||
if ($i == 0) print ' ';
|
||||
else print ',';
|
||||
$facavoir = new FactureFournisseur($db);
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if (isset($facidnext) && $facidnext > 0)
|
||||
{
|
||||
$facthatreplace = new FactureFournisseur($db);
|
||||
$facthatreplace->fetch($facidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, 0, $object->id);
|
||||
if ($result > 0) {
|
||||
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
$facidavoir = $object->getListIdAvoirFromInvoice();
|
||||
if (count($facidavoir) > 0)
|
||||
{
|
||||
print ' ('.$langs->transnoentities("InvoiceHasAvoir");
|
||||
$i = 0;
|
||||
foreach ($facidavoir as $id)
|
||||
{
|
||||
if ($i == 0) print ' ';
|
||||
else print ',';
|
||||
$facavoir = new FactureFournisseur($db);
|
||||
$facavoir->fetch($id);
|
||||
print $facavoir->getNomUrl(1);
|
||||
}
|
||||
print ')';
|
||||
}
|
||||
if (isset($facidnext) && $facidnext > 0)
|
||||
{
|
||||
$facthatreplace = new FactureFournisseur($db);
|
||||
$facthatreplace->fetch($facidnext);
|
||||
print ' ('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')';
|
||||
}
|
||||
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE || $object->type == FactureFournisseur::TYPE_DEPOSIT) {
|
||||
$discount = new DiscountAbsolute($db);
|
||||
$result = $discount->fetch(0, 0, $object->id);
|
||||
if ($result > 0) {
|
||||
print '. '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>';
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Relative and absolute discounts
|
||||
// Relative and absolute discounts
|
||||
print '<!-- Discounts --><tr><td>'.$langs->trans('Discounts');
|
||||
print '</td><td>';
|
||||
|
||||
@ -2482,18 +2482,18 @@ if ($action == 'create')
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
|
||||
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
|
||||
print '</tr>';
|
||||
// Label
|
||||
print '<tr>';
|
||||
print '<td>'.$form->editfieldkey("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
|
||||
print '<td>'.$form->editfieldval("Label", 'label', $object->label, $object, ($usercancreate)).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate && ($object->getSommePaiement() <= 0);
|
||||
$form_permission = ($object->statut < FactureFournisseur::STATUS_CLOSED) && $usercancreate && ($object->getSommePaiement() <= 0);
|
||||
|
||||
// Date
|
||||
print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
|
||||
print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker');
|
||||
print '</td>';
|
||||
// Date
|
||||
print '<tr><td>'.$form->editfieldkey("DateInvoice", 'datef', $object->datep, $object, $form_permission, 'datepicker').'</td><td colspan="3">';
|
||||
print $form->editfieldval("Date", 'datef', $object->datep, $object, $form_permission, 'datepicker');
|
||||
print '</td>';
|
||||
|
||||
// Default terms of the settlement
|
||||
$langs->load('bills');
|
||||
@ -3033,7 +3033,7 @@ if ($action == 'create')
|
||||
// modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
// Modify a validated invoice with no payments
|
||||
// Modify a validated invoice with no payments
|
||||
if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $action != 'confirm_edit' && $object->getSommePaiement() == 0 && $usercancreate)
|
||||
{
|
||||
// We check if lines of invoice are not already transfered into accountancy
|
||||
@ -3078,17 +3078,17 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
// Make payments
|
||||
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&action=create'.($object->fk_account > 0 ? '&accountid='.$object->fk_account : '').'">'.$langs->trans('DoPayment').'</a></div>'; // must use facid because id is for payment id not invoice
|
||||
}
|
||||
// Make payments
|
||||
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE && $action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="paiement.php?facid='.$object->id.'&action=create'.($object->fk_account > 0 ? '&accountid='.$object->fk_account : '').'">'.$langs->trans('DoPayment').'</a></div>'; // must use facid because id is for payment id not invoice
|
||||
}
|
||||
|
||||
// Classify paid
|
||||
if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
||||
print '>'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
// Classify paid
|
||||
if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid"';
|
||||
print '>'.$langs->trans('ClassifyPaid').'</a></div>';
|
||||
|
||||
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=paid">'.$langs->trans('ClassifyPaid').'</a>';
|
||||
}
|
||||
@ -3124,21 +3124,21 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
||||
{
|
||||
if (count($object->lines))
|
||||
{
|
||||
// Validate
|
||||
if ($action != 'confirm_edit' && $object->statut == FactureFournisseur::STATUS_DRAFT)
|
||||
{
|
||||
if (count($object->lines))
|
||||
{
|
||||
if ($usercanvalidate)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"';
|
||||
print '>'.$langs->trans('Validate').'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valid"';
|
||||
print '>'.$langs->trans('Validate').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'"';
|
||||
print '>'.$langs->trans('Validate').'</a></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create event
|
||||
/*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page.
|
||||
@ -3161,30 +3161,30 @@ if ($action == 'create')
|
||||
}
|
||||
}
|
||||
|
||||
// Delete
|
||||
// Delete
|
||||
$isErasable = $object->is_erasable();
|
||||
if ($action != 'confirm_edit' && ($user->rights->fournisseur->facture->supprimer || ($usercancreate && $isErasable == 1))) // isErasable = 1 means draft with temporary ref (draft can always be deleted with no need of permissions)
|
||||
{
|
||||
//var_dump($isErasable);
|
||||
if ($isErasable == -4) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -3) { // Should never happen with supplier invoice
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -2) { // Should never happen with supplier invoice
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -1) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable <= 0) // Any other cases
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
{
|
||||
//var_dump($isErasable);
|
||||
if ($isErasable == -4) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecausePayments").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -3) { // Should never happen with supplier invoice
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastSituationInvoice").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -2) { // Should never happen with supplier invoice
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotLastInvoice").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable == -1) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseDispatchedInBookkeeping").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} elseif ($isErasable <= 0) // Any other cases
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("DisabledBecauseNotErasable").'">'.$langs->trans('Delete').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
if ($action != 'confirm_edit')
|
||||
{
|
||||
if ($action != 'confirm_edit')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
/*
|
||||
|
||||
@ -94,56 +94,56 @@ if ($object->id > 0)
|
||||
|
||||
$totalpaye = $object->getSommePaiement();
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/fourn/facture/list.php?socid='.$object->thirdparty->id.'&search_company='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherBills").'</a>)';
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
|
||||
if ($user->rights->facture->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
$morehtmlref .= ' : ';
|
||||
if ($action == 'classify') {
|
||||
//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
} else {
|
||||
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
|
||||
}
|
||||
} else {
|
||||
if (!empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref .= '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'" title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref .= $proj->ref;
|
||||
$morehtmlref .= '</a>';
|
||||
} else {
|
||||
$morehtmlref .= '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
// Build file list
|
||||
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
|
||||
@ -271,7 +271,7 @@ if ($object->id > 0)
|
||||
if ($res) break;
|
||||
}
|
||||
} else {
|
||||
print $langs->trans('ErrorUnknown');
|
||||
print $langs->trans('ErrorUnknown');
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -67,7 +67,7 @@ if ($user->socid > 0)
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$mode = GETPOST("mode");
|
||||
$mode = GETPOST("mode", 'aZ09');
|
||||
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_label = GETPOST("search_label", "alpha");
|
||||
@ -92,6 +92,7 @@ $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat',
|
||||
$search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha');
|
||||
$search_status = GETPOST('search_status', 'int');
|
||||
$search_paymentmode = GETPOST('search_paymentmode', 'int');
|
||||
$search_paymentcond = GETPOST('search_paymentcond', 'int');
|
||||
$search_town = GETPOST('search_town', 'alpha');
|
||||
$search_zip = GETPOST('search_zip', 'alpha');
|
||||
$search_state = GETPOST("search_state");
|
||||
@ -165,7 +166,8 @@ $arrayfields = array(
|
||||
'state.nom'=>array('label'=>$langs->trans("StateShort"), 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0),
|
||||
'typent.code'=>array('label'=>$langs->trans("ThirdPartyType"), 'checked'=>$checkedtypetiers),
|
||||
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1),
|
||||
'f.fk_cond_reglement'=>array('label'=>$langs->trans("PaymentTerm"), 'checked'=>1, 'position'=>50),
|
||||
'f.fk_mode_reglement'=>array('label'=>$langs->trans("PaymentMode"), 'checked'=>1, 'position'=>52),
|
||||
'f.total_ht'=>array('label'=>$langs->trans("AmountHT"), 'checked'=>1, 'position'=>105),
|
||||
'f.total_vat'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>0, 'position'=>110),
|
||||
'f.total_localtax1'=>array('label'=>$langs->transcountry("AmountLT1", $mysoc->country_code), 'checked'=>0, 'enabled'=>$mysoc->localtax1_assuj == "1", 'position'=>95),
|
||||
@ -240,6 +242,7 @@ if (empty($reshook))
|
||||
$search_multicurrency_montant_ttc = '';
|
||||
$search_status = '';
|
||||
$search_paymentmode = '';
|
||||
$search_paymentcond = '';
|
||||
$search_town = '';
|
||||
$search_zip = "";
|
||||
$search_state = "";
|
||||
@ -367,7 +370,8 @@ if ($search_multicurrency_montant_vat != '') $sql .= natural_search('f.multicurr
|
||||
if ($search_multicurrency_montant_ttc != '') $sql .= natural_search('f.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
|
||||
if ($search_login) $sql .= natural_search('u.login', $search_login);
|
||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND f.fk_statut = ".$db->escape($search_status);
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmode."";
|
||||
if ($search_paymentmode > 0) $sql .= " AND f.fk_mode_reglement = ".((int) $search_paymentmode);
|
||||
if ($search_paymentcond > 0) $sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond);
|
||||
$sql .= dolSqlDateFilter("f.datef", $day, $month, $year);
|
||||
$sql .= dolSqlDateFilter("f.date_lim_reglement", $day_lim, $month_lim, $year_lim);
|
||||
if ($option == 'late') $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
|
||||
@ -385,7 +389,7 @@ if ($filter && $filter != -1)
|
||||
$sql .= ' AND '.$db->escape(trim($filt[0])).' = '.$db->escape(trim($filt[1]));
|
||||
}
|
||||
}
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='invoice_supplier' AND tc.source='internal' AND ec.element_id = f.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
@ -720,11 +724,18 @@ if ($resql)
|
||||
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
|
||||
print '</td>';
|
||||
}
|
||||
// Condition of payment
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
$form->select_conditions_paiements($search_paymentcond, 'search_paymentcond', -1, 1, 1, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 10);
|
||||
$form->select_types_paiements($search_paymentmode, 'search_paymentmode', '', 0, 1, 1, 20, 1, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['f.total_ht']['checked']))
|
||||
@ -873,6 +884,7 @@ if ($resql)
|
||||
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_cond_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER["PHP_SELF"], "f.fk_mode_reglement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['f.total_ht']['checked'])) print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], 'f.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($arrayfields['f.total_vat']['checked'])) print_liste_field_titre($arrayfields['f.total_vat']['label'], $_SERVER['PHP_SELF'], 'f.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
@ -1096,6 +1108,14 @@ if ($resql)
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Payment condition
|
||||
if (!empty($arrayfields['f.fk_cond_reglement']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', '', -1);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Payment mode
|
||||
if (!empty($arrayfields['f.fk_mode_reglement']['checked']))
|
||||
{
|
||||
|
||||
@ -787,255 +787,6 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
} else dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Show list
|
||||
*/
|
||||
if (empty($action) || $action == 'list')
|
||||
{
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; }
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) $sortfield = 'p.datep';
|
||||
|
||||
$sql = 'SELECT p.rowid as pid, p.ref, p.datep as dp, p.amount as pamount, p.num_paiement,';
|
||||
$sql .= ' s.rowid as socid, s.nom as name,';
|
||||
$sql .= ' c.code as paiement_type, c.libelle as paiement_libelle,';
|
||||
$sql .= ' ba.rowid as bid, ba.label,';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
|
||||
$sql .= ' SUM(pf.amount)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
|
||||
$sql .= dolSqlDateFilter('p.datep', $day, $month, $year);
|
||||
if ($search_ref) $sql .= natural_search('p.rowid', $search_ref);
|
||||
if ($search_account > 0) $sql .= " AND b.fk_account=".$search_account;
|
||||
if ($search_paymenttype != "") $sql .= " AND c.code='".$db->escape($search_paymenttype)."'";
|
||||
if ($search_payment_num != '') $sql .= natural_search('p.num_paiement', $search_payment_num);
|
||||
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
$sql .= " GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label";
|
||||
if (!$user->rights->societe->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
// Add where from extra fields
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($day) $param .= ($day ? "&day=".urlencode($day) : "");
|
||||
if ($month) $param .= ($month ? "&month=".urlencode($month) : "");
|
||||
if ($year) $param .= ($year ? "&year=".urlencode($year) : "");
|
||||
if ($search_ref) $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : "");
|
||||
if ($search_company) $param .= ($search_company ? "&search_company=".urlencode($search_company) : "");
|
||||
if ($search_amount != '') $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : "");
|
||||
if ($search_payment_num) $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : "");
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
$massactionbutton = $form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge")));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
|
||||
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'supplier_invoice', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if ($moreforfilter)
|
||||
{
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Lines for filters fields
|
||||
print '<tr class="liste_titre_filter">';
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="day" value="'.dol_escape_htmltag($day).'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="month" value="'.dol_escape_htmltag($month).'">';
|
||||
$formother->select_year($year ? $year : -1, 'year', 1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_paymenttype, 'search_paymenttype', '', 2, 1, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="4" name="search_payment_num" value="'.dol_escape_htmltag($search_payment_num).'">';
|
||||
print '</td>';
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_account, 'search_account', 0, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("RefPayment", $_SERVER["PHP_SELF"], 'p.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], 'dp', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Numero", $_SERVER["PHP_SELF"], "p.num_paiement", "", $param, "", $sortfield, $sortorder);
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
$paymentfournstatic = new PaiementFourn($db);
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$paymentfournstatic->id = $objp->pid;
|
||||
$paymentfournstatic->ref = $objp->ref;
|
||||
$paymentfournstatic->datepaye = $objp->dp;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Ref payment
|
||||
print '<td class="nowrap">';
|
||||
print $paymentfournstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Date
|
||||
$dateformatforpayment = 'day';
|
||||
if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour';
|
||||
print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->dp), $dateformatforpayment)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Thirdparty
|
||||
print '<td>';
|
||||
if ($objp->socid) print '<a href="'.DOL_URL_ROOT.'/societe/card.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'), 'company').' '.dol_trunc($objp->name, 32).'</a>';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Type
|
||||
$payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
|
||||
print '<td>'.$payment_type.' '.dol_trunc($objp->num_paiement, 32)."</td>\n";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Payment number
|
||||
print '<td>'.$objp->num_paiement.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Account
|
||||
if (!empty($conf->banque->enabled))
|
||||
{
|
||||
print '<td>';
|
||||
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.dol_trunc($objp->label, 24).'</a>';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount
|
||||
print '<td class="right">'.price($objp->pamount).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'amount';
|
||||
$totalarray['val']['amount'] += $objp->pamount;
|
||||
|
||||
// Ref invoice
|
||||
/*$invoicesupplierstatic->ref=$objp->ref_supplier;
|
||||
$invoicesupplierstatic->id=$objp->facid;
|
||||
print '<td class="nowrap">';
|
||||
print $invoicesupplierstatic->getNomUrl(1);
|
||||
print '</td>';*/
|
||||
|
||||
print '<td></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print "</table>";
|
||||
print "</div>";
|
||||
print "</form>\n";
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -74,7 +74,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisse
|
||||
if ($result > 0)
|
||||
{
|
||||
$db->commit();
|
||||
header('Location: '.DOL_URL_ROOT.'/fourn/facture/paiement.php');
|
||||
header('Location: '.DOL_URL_ROOT.'/fourn/paiement/list.php');
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
@ -166,7 +166,7 @@ if ($result > 0)
|
||||
print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide');
|
||||
}
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');
|
||||
@ -251,9 +251,10 @@ if ($result > 0)
|
||||
print '<br>';
|
||||
|
||||
/**
|
||||
* Liste des factures
|
||||
* List of vendor invoices
|
||||
*/
|
||||
$sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom as name, s.rowid as socid';
|
||||
$sql = 'SELECT f.rowid, f.rowid as facid, f.ref, f.ref_supplier, f.type, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.datef as date, f.fk_statut as status,';
|
||||
$sql .= ' pf.amount, s.nom as name, s.rowid as socid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid';
|
||||
$sql .= ' AND pf.fk_paiementfourn = '.$object->id;
|
||||
@ -285,6 +286,13 @@ if ($result > 0)
|
||||
|
||||
$facturestatic->id = $objp->facid;
|
||||
$facturestatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
|
||||
$facturestatic->date = $db->jdate($objp->date);
|
||||
$facturestatic->type = $objp->type;
|
||||
$facturestatic->total_ht = $objp->total_ht;
|
||||
$facturestatic->total_tva = $objp->total_tva;
|
||||
$facturestatic->total_ttc = $objp->total_ttc;
|
||||
$facturestatic->statut = $objp->status;
|
||||
$facturestatic->alreadypaid = -1; // unknown
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Ref
|
||||
@ -300,7 +308,7 @@ if ($result > 0)
|
||||
// Payed
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
// Status
|
||||
print '<td class="right">'.$facturestatic->LibStatut($objp->paye, $objp->fk_statut, 6, 1).'</td>';
|
||||
print '<td class="right">'.$facturestatic->LibStatut($objp->paye, $objp->status, 6, 1).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($objp->paye == 1)
|
||||
|
||||
429
htdocs/fourn/paiement/list.php
Normal file
429
htdocs/fourn/paiement/list.php
Normal file
@ -0,0 +1,429 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/fourn/paiment/list.php
|
||||
* \ingroup fournisseur,facture
|
||||
* \brief Payment list for supplier invoices
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
|
||||
// Security check
|
||||
if ($user->socid) $socid = $user->socid;
|
||||
|
||||
// doesn't work :-(
|
||||
// restrictedArea($user, 'fournisseur');
|
||||
|
||||
// doesn't work :-(
|
||||
// require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
// $object = new PaiementFourn($db);
|
||||
// restrictedArea($user, $object->element);
|
||||
|
||||
if (!$user->rights->fournisseur->facture->lire) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'bills', 'banks', 'compta'));
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'vendorpaymentlist';
|
||||
|
||||
$socid = GETPOST('socid', 'int');
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_day = GETPOST('search_day', 'int');
|
||||
$search_month = GETPOST('search_month', 'int');
|
||||
$search_year = GETPOST('search_year', 'int');
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$search_payment_type = GETPOST('search_payment_type');
|
||||
$search_cheque_num = GETPOST('search_cheque_num', 'alpha');
|
||||
$search_bank_account = GETPOST('search_bank_account', 'int');
|
||||
$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x'
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'alpha');
|
||||
$sortorder = GETPOST('sortorder', 'alpha');
|
||||
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int');
|
||||
|
||||
if (empty($page) || $page == -1) $page = 0; // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
|
||||
if (!$sortorder) $sortorder = "DESC";
|
||||
if (!$sortfield) $sortfield = "p.datep";
|
||||
|
||||
// TODO: add global search for this list
|
||||
|
||||
$arrayfields = array(
|
||||
'p.ref' =>array('label'=>"RefPayment", 'checked'=>1, 'position'=>10),
|
||||
'p.datep' =>array('label'=>"Date", 'checked'=>1, 'position'=>20),
|
||||
's.nom' =>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
|
||||
'c.libelle' =>array('label'=>"Type", 'checked'=>1, 'position'=>40),
|
||||
'p.num_paiement' =>array('label'=>"Numero", 'checked'=>1, 'position'=>50, 'tooltip'=>"ChequeOrTransferNumber"),
|
||||
'ba.label' =>array('label'=>"Account", 'checked'=>1, 'position'=>60, 'enable'=>(!empty($conf->banque->enabled))),
|
||||
'p.amount' =>array('label'=>"Amount", 'checked'=>1, 'position'=>70),
|
||||
);
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
$hookmanager->initHooks(array('paymentsupplierlist'));
|
||||
$object = new PaiementFourn($db);
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
if (empty($reshook)) {
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$search_ref = '';
|
||||
$search_day = '';
|
||||
$search_month = '';
|
||||
$search_year = '';
|
||||
$search_company = '';
|
||||
$search_payment_type = '';
|
||||
$search_cheque_num = '';
|
||||
$search_bank_account = '';
|
||||
$search_amount = '';
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans('ListPayment'));
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$companystatic = new Societe($db);
|
||||
$paymentfournstatic = new PaiementFourn($db);
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.datep, p.amount as pamount, p.num_paiement';
|
||||
$sql .= ', s.rowid as socid, s.nom as name, s.email';
|
||||
$sql .= ', c.code as paiement_type, c.libelle as paiement_libelle';
|
||||
$sql .= ', ba.rowid as bid, ba.label';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ', sc.fk_soc, sc.fk_user';
|
||||
$sql .= ', SUM(pf.amount)';
|
||||
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement AS c ON p.fk_paiement = c.id';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON s.rowid = f.fk_soc';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ', '.MAIN_DB_PREFIX.'societe_commerciaux as sc';
|
||||
|
||||
$sql .= ' WHERE f.entity = '.$conf->entity;
|
||||
if (!$user->rights->societe->client->voir) $sql .= ' AND s.rowid = sc.fk_soc AND sc.fk_user = '.$user->id;
|
||||
if ($socid > 0) $sql .= ' AND f.fk_soc = '.$socid;
|
||||
if ($search_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||
$sql .= dolSqlDateFilter('p.datep', $search_day, $search_month, $search_year);
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_payment_type != '') $sql .= " AND c.code='".$db->escape($search_payment_type)."'";
|
||||
if ($search_cheque_num != '') $sql .= natural_search('p.num_paiement', $search_cheque_num);
|
||||
if ($search_amount) $sql .= natural_search('p.amount', $search_amount, 1);
|
||||
if ($search_bank_account > 0) $sql .= ' AND b.fk_account='.$search_bank_account."'";
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
$sql .= ' GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ', sc.fk_soc, sc.fk_user';
|
||||
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
dol_print_error($db);
|
||||
llxFooter();
|
||||
$db->close();
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER['PHP_SELF']) $param .= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
|
||||
if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if ($saerch_day) $param .= '&search_day='.urlencode($search_day);
|
||||
if ($saerch_month) $param .= '&search_month='.urlencode($search_month);
|
||||
if ($search_year) $param .= '&search_year='.urlencode($search_year);
|
||||
if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
||||
if ($search_payment_type) $param .= '&search_company='.urlencode($search_payment_type);
|
||||
if ($search_cheque_num) $param .= '&search_cheque_num='.urlencode($search_cheque_num);
|
||||
if ($search_amount) $param .= '&search_amount='.urlencode($search_amount);
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="list">';
|
||||
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
||||
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
print_barre_liste($langs->trans('SupplierPayments'), $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'supplier_invoice', 0, '', '', $limit, 0, 0, 1);
|
||||
|
||||
$moreforfilter = '';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
if ($moreforfilter) {
|
||||
print '<div class="liste_titre liste_titre_bydiv centpercent">';
|
||||
print $moreforfilter;
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$varpage = empty($contextpage) ? $_SERVER['PHP_SELF'] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
||||
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : '').'">';
|
||||
|
||||
print '<tr class="liste_titre_filter">';
|
||||
|
||||
// Filter: Ref
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="4" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Date
|
||||
if (!empty($arrayfields['p.datep']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_day" value="'.dol_escape_htmltag($search_day).'">';
|
||||
print '<input class="flat width25 valignmiddle" type="text" maxlength="2" name="search_month" value="'.dol_escape_htmltag($search_month).'">';
|
||||
$formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Thirdparty
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="6" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Payment type
|
||||
if (!empty($arrayfields['c.libelle']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_types_paiements($search_payment_type, 'search_payment_type', '', 2, 1, 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Cheque number (fund transfer)
|
||||
if (!empty($arrayfields['p.num_paiement']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" size="4" name="search_cheque_num" value="'.dol_escape_htmltag($search_cheque_num).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Bank account
|
||||
if (!empty($arrayfields['ba.label']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
$form->select_comptes($search_bank_account, 'search_bank_account', 0, '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Amount
|
||||
if (!empty($arrayfields['p.amount']['checked'])) {
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="4" name="search_amount" value="'.dol_escape_htmltag($search_amount).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Buttons
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
print $form->showFilterAndCheckAddButtons(0);
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) print_liste_field_titre('#', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.datep']['checked'])) print_liste_field_titre($arrayfields['p.datep']['label'], $_SERVER["PHP_SELF"], 'p.datep', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], 's.nom', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['c.libelle']['checked'])) print_liste_field_titre($arrayfields['c.libelle']['label'], $_SERVER["PHP_SELF"], 'c.libelle', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.num_paiement']['checked'])) print_liste_field_titre($arrayfields['p.num_paiement']['label'], $_SERVER["PHP_SELF"], "p.num_paiement", '', $param, '', $sortfield, $sortorder, '', $arrayfields['p.num_paiement']['tooltip']);
|
||||
if (!empty($arrayfields['ba.label']['checked'])) print_liste_field_titre($arrayfields['ba.label']['label'], $_SERVER["PHP_SELF"], 'ba.label', '', $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.amount']['checked'])) print_liste_field_titre($arrayfields['p.amount']['label'], $_SERVER["PHP_SELF"], 'p.amount', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print_liste_field_titre($selectedfields, $_SERVER['PHP_SELF'], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
$checkedCount = 0;
|
||||
foreach ($arrayfields as $column) {
|
||||
if ($column['checked']) {
|
||||
$checkedCount++;
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
$totalarray = array();
|
||||
while ($i < min($num, $limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$paymentfournstatic->id = $objp->rowid;
|
||||
$paymentfournstatic->ref = $objp->ref;
|
||||
$paymentfournstatic->datepaye = $objp->datep;
|
||||
|
||||
$companystatic->id = $objp->socid;
|
||||
$companystatic->name = $objp->name;
|
||||
$companystatic->email = $objp->email;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// No
|
||||
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER_IN_LIST)) {
|
||||
print '<td>'.(($offset * $limit) + $i).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Ref
|
||||
if (!empty($arrayfields['p.ref']['checked'])) {
|
||||
print '<td class="nowrap">'.$paymentfournstatic->getNomUrl(1).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Date
|
||||
if (!empty($arrayfields['p.datep']['checked'])) {
|
||||
$dateformatforpayment = 'day';
|
||||
if (!empty($conf->global->INVOICE_USE_HOURS_FOR_PAYMENT)) $dateformatforpayment = 'dayhour';
|
||||
print '<td class="nowrap center">'.dol_print_date($db->jdate($objp->datep), $dateformatforpayment).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Thirdparty
|
||||
if (!empty($arrayfields['s.nom']['checked'])) {
|
||||
print '<td>';
|
||||
if ($objp->socid > 0) {
|
||||
print $companystatic->getNomUrl(1, '', 24);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Pyament type
|
||||
if (!empty($arrayfields['c.libelle']['checked'])) {
|
||||
$payment_type = $langs->trans("PaymentType".$objp->paiement_type) != ("PaymentType".$objp->paiement_type) ? $langs->trans("PaymentType".$objp->paiement_type) : $objp->paiement_libelle;
|
||||
print '<td>'.$payment_type.' '.dol_trunc($objp->num_paiement, 32).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Cheque number (fund transfer)
|
||||
if (!empty($arrayfields['p.num_paiement']['checked'])) {
|
||||
print '<td>'.$objp->num_paiement.'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account
|
||||
if (!empty($arrayfields['ba.label']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
if ($objp->bid) print '<a href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?account='.$objp->bid.'">'.img_object($langs->trans("ShowAccount"), 'account').' '.dol_trunc($objp->label, 24).'</a>';
|
||||
else print ' ';
|
||||
print '</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount
|
||||
if (!empty($arrayfields['p.amount']['checked'])) {
|
||||
print '<td class="right">'.price($objp->pamount).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
$totalarray['pos'][$checkedCount] = 'amount';
|
||||
$totalarray['val']['amount'] += $objp->pamount;
|
||||
}
|
||||
|
||||
// Buttons
|
||||
print '<td></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -48,7 +48,10 @@ $massaction = GETPOST('massaction', 'alpha');
|
||||
$contextpage = GETPOST('contextpage', 'aZ');
|
||||
$optioncss = GETPOST('optioncss', 'aZ');
|
||||
|
||||
$search_ref = GETPOST('search_ref', 'alpha');
|
||||
$search_ref = GETPOST('search_ref', 'alphanohtml');
|
||||
$search_employee = GETPOST('search_employee', 'int');
|
||||
$search_type = GETPOST('search_type', 'int');
|
||||
$search_description = GETPOST('search_description', 'alphanohtml');
|
||||
|
||||
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -82,6 +85,9 @@ if (empty($reshook))
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
|
||||
{
|
||||
$search_ref = '';
|
||||
$search_employee = '';
|
||||
$search_type = '';
|
||||
$search_description = '';
|
||||
$toselect = '';
|
||||
$search_array_options = array();
|
||||
}
|
||||
@ -135,7 +141,10 @@ $sql.= " WHERE cp.rowid > 0";
|
||||
$sql.= " AND cp.statut = 3"; // 3 = Approved
|
||||
$sql.= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
|
||||
|
||||
if ($search_ref != '') $sql.= natural_search('cp.ref', $search_ref, 0);
|
||||
if (!empty($search_ref)) $sql .= natural_search('cp.ref', $search_ref);
|
||||
if (!empty($search_employee)) $sql .= " AND cp.fk_user = '".$db->escape($search_employee)."'";
|
||||
if (!empty($search_type)) $sql .= ' AND cp.fk_type IN ('.$db->escape($search_type).')';
|
||||
if (!empty($search_description)) $sql.= natural_search('cp.description', $search_description);
|
||||
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
@ -149,9 +158,12 @@ if (empty($resql))
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param = '';
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.= '&limit='.urlencode($limit);
|
||||
if ($search_ref) $param = '&search_ref='.urlencode($search_ref);
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.= '&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
||||
if (!empty($search_ref)) $param .= '&search_ref='.urlencode($search_ref);
|
||||
if (!empty($search_employee)) $param .= '&search_employee='.urlencode($search_employee);
|
||||
if (!empty($search_type)) $param .= '&search_type='.urlencode($search_type);
|
||||
if (!empty($search_description)) $param .= '&search_description='.urlencode($search_description);
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
||||
@ -184,16 +196,50 @@ print '<div class="div-table-responsive">';
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($arrayfields['cp.ref']['checked'])) print '<td class="liste_titre"><input type="text" class="maxwidth100" name="search_ref" value="'.$search_ref.'"></td>';
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['ct.label']['checked'])) print '<td class="liste_titre"></td>';
|
||||
|
||||
// Filter: Ref
|
||||
if (!empty($arrayfields['cp.ref']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Employee
|
||||
if (!empty($arrayfields['cp.fk_user']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print $form->select_dolusers($search_employee, "search_employee", 1, null, 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth200');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Filter: Type
|
||||
if (!empty($arrayfields['ct.label']['checked'])) {
|
||||
$typeleaves = $holidaystatic->getTypes(1, -1);
|
||||
$arraytypeleaves = array();
|
||||
foreach ($typeleaves as $key => $val)
|
||||
{
|
||||
$labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']);
|
||||
$arraytypeleaves[$val['rowid']] = $labeltoshow;
|
||||
}
|
||||
|
||||
print '<td class="liste_titre">';
|
||||
print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', '', 1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['cp.date_debut']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cp.date_fin']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['used_days']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['date_start_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['date_end_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['used_days_month']['checked'])) print '<td class="liste_titre"></td>';
|
||||
if (!empty($arrayfields['cp.description']['checked'])) print '<td class="liste_titre"></td>';
|
||||
|
||||
// Filter: Description
|
||||
if (!empty($arrayfields['cp.description']['checked'])) {
|
||||
print '<td class="liste_titre">';
|
||||
print '<input type="text" class="maxwidth100" name="search_description" value="'.$search_description.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto = $form->showFilterButtons();
|
||||
|
||||
@ -96,42 +96,42 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is useless due to the global search combo
|
||||
{
|
||||
if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
{
|
||||
$langs->load("holiday");
|
||||
$listofsearchfields['search_holiday'] = array('text'=>'TitreRequestCP');
|
||||
}
|
||||
if (!empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
{
|
||||
$langs->load("trips");
|
||||
$listofsearchfields['search_deplacement'] = array('text'=>'ExpenseReport');
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$langs->load("trips");
|
||||
$listofsearchfields['search_expensereport'] = array('text'=>'ExpenseReport');
|
||||
}
|
||||
if (count($listofsearchfields))
|
||||
{
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value)
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
{
|
||||
$langs->load("holiday");
|
||||
$listofsearchfields['search_holiday'] = array('text'=>'TitreRequestCP');
|
||||
}
|
||||
if (!empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
|
||||
{
|
||||
$langs->load("trips");
|
||||
$listofsearchfields['search_deplacement'] = array('text'=>'ExpenseReport');
|
||||
}
|
||||
if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
{
|
||||
$langs->load("trips");
|
||||
$listofsearchfields['search_expensereport'] = array('text'=>'ExpenseReport');
|
||||
}
|
||||
if (count($listofsearchfields))
|
||||
{
|
||||
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
$i = 0;
|
||||
foreach ($listofsearchfields as $key => $value)
|
||||
{
|
||||
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
|
||||
print '<tr '.$bc[false].'>';
|
||||
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label></td><td><input type="text" class="flat inputsearch" name="'.$key.'" id="'.$key.'" size="18"></td>';
|
||||
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -141,26 +141,26 @@ if (!empty($conf->holiday->enabled))
|
||||
{
|
||||
$user_id = $user->id;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">';
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder nohover centpercent">';
|
||||
print '<tr class="liste_titre"><th colspan="3">'.$langs->trans("Holidays").'</th></tr>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td colspan="3">';
|
||||
|
||||
$out = '';
|
||||
$typeleaves = $holiday->getTypes(1, 1);
|
||||
foreach ($typeleaves as $key => $val)
|
||||
{
|
||||
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
|
||||
print $out;
|
||||
$out = '';
|
||||
$typeleaves = $holiday->getTypes(1, 1);
|
||||
foreach ($typeleaves as $key => $val)
|
||||
{
|
||||
$nb_type = $holiday->getCPforUser($user->id, $val['rowid']);
|
||||
$nb_holiday += $nb_type;
|
||||
$out .= ' - '.$val['label'].': <strong>'.($nb_type ?price2num($nb_type) : 0).'</strong><br>';
|
||||
}
|
||||
print $langs->trans('SoldeCPUser', round($nb_holiday, 5)).'<br>';
|
||||
print $out;
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table></div><br>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table></div><br>';
|
||||
} elseif (!is_numeric($conf->global->HOLIDAY_HIDE_BALANCE))
|
||||
{
|
||||
print $langs->trans($conf->global->HOLIDAY_HIDE_BALANCE).'<br>';
|
||||
@ -175,80 +175,80 @@ print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||
// Latest leave requests
|
||||
if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
|
||||
{
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
|
||||
$sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND x.entity = ".$conf->entity;
|
||||
if (empty($user->rights->holiday->read_all)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')';
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
|
||||
$sql .= $db->order("x.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.photo, u.statut as user_status,";
|
||||
$sql .= " x.rowid, x.rowid as ref, x.fk_type, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.tms as dm, x.statut as status";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= " WHERE u.rowid = x.fk_user";
|
||||
$sql .= " AND x.entity = ".$conf->entity;
|
||||
if (empty($user->rights->holiday->read_all)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')';
|
||||
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
|
||||
$sql .= $db->order("x.tms", "DESC");
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var = false;
|
||||
$num = $db->num_rows($result);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var = false;
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
$holidaystatic = new Holiday($db);
|
||||
$userstatic = new User($db);
|
||||
$holidaystatic = new Holiday($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
|
||||
$typeleaves = $holidaystatic->getTypes(1, -1);
|
||||
$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon"));
|
||||
$typeleaves = $holidaystatic->getTypes(1, -1);
|
||||
|
||||
$i = 0;
|
||||
$i = 0;
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).'</th>';
|
||||
print '<th>'.$langs->trans("from").'</th>';
|
||||
print '<th>'.$langs->trans("to").'</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).'</th>';
|
||||
print '<th>'.$langs->trans("from").'</th>';
|
||||
print '<th>'.$langs->trans("to").'</th>';
|
||||
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$holidaystatic->id = $obj->rowid;
|
||||
$holidaystatic->ref = $obj->ref;
|
||||
$holidaystatic->statut = $obj->status;
|
||||
$holidaystatic->id = $obj->rowid;
|
||||
$holidaystatic->ref = $obj->ref;
|
||||
$holidaystatic->statut = $obj->status;
|
||||
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->user_status;
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->photo = $obj->photo;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->statut = $obj->user_status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1, 'leave').'</td>';
|
||||
print '<td>'.$typeleaves[$obj->fk_type]['label'].'</td>';
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowraponall">'.$holidaystatic->getNomUrl(1).'</td>';
|
||||
print '<td class="tdoverflowmax150">'.$userstatic->getNomUrl(-1, 'leave').'</td>';
|
||||
print '<td>'.$typeleaves[$obj->fk_type]['label'].'</td>';
|
||||
|
||||
$starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning';
|
||||
$endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon';
|
||||
$starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning';
|
||||
$endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon';
|
||||
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_start), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_end), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3).'</td>';
|
||||
print '</tr>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_start), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$starthalfday]).'</span>';
|
||||
print '<td>'.dol_print_date($db->jdate($obj->date_end), 'day').' <span class="opacitymedium">'.$langs->trans($listhalfday[$endhalfday]).'</span>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->dm), 'day').'</td>';
|
||||
print '<td class="right nowrap" width="16">'.$holidaystatic->LibStatut($obj->status, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
} else dol_print_error($db);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
} else dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@ if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
|
||||
$userstatic->id = $obj->uid;
|
||||
$userstatic->lastname = $obj->lastname;
|
||||
$userstatic->firstname = $obj->firstname;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->email = $obj->email;
|
||||
$userstatic->login = $obj->login;
|
||||
$userstatic->statut = $obj->user_status;
|
||||
$userstatic->photo = $obj->photo;
|
||||
|
||||
@ -361,7 +361,7 @@ if ($step == 1 || !$datatoimport)
|
||||
print '</td><td style="text-align: right">';
|
||||
if ($objimport->array_import_perms[$key])
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=2&datatoimport='.$objimport->array_import_code[$key].$param.'">'.img_picto($langs->trans("NewImport"), 'filenew').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=2&datatoimport='.$objimport->array_import_code[$key].$param.'">'.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').'</a>';
|
||||
} else {
|
||||
print $langs->trans("NotEnoughPermissions");
|
||||
}
|
||||
@ -424,7 +424,7 @@ if ($step == 2 && $datatoimport)
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ChooseFormatOfFileToImport", img_picto('', 'filenew')).'</span><br><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("ChooseFormatOfFileToImport", img_picto('', 'next', '')).'</span><br><br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
@ -445,7 +445,7 @@ if ($step == 2 && $datatoimport)
|
||||
print '<td style="text-align:center"><a href="'.DOL_URL_ROOT.'/imports/emptyexample.php?format='.$key.$param.'" target="_blank">'.$langs->trans("DownloadEmptyExample").'</a></td>';
|
||||
// Action button
|
||||
print '<td style="text-align:right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=3&format='.$key.$param.'">'.img_picto($langs->trans("SelectFormat"), 'filenew').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/imports/import.php?step=3&format='.$key.$param.'">'.img_picto($langs->trans("SelectFormat"), 'next', 'class="fa-15x"').'</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -549,7 +549,7 @@ if ($step == 3 && $datatoimport)
|
||||
print '<input type="hidden" value="'.dol_escape_htmltag($enclosure).'" name="enclosure">';
|
||||
print '<input type="hidden" value="'.$datatoimport.'" name="datatoimport">';
|
||||
|
||||
print '<span class="opacitymedium">'.$langs->trans("ChooseFileToImport", img_picto('', 'filenew')).'</span><br><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("ChooseFileToImport", img_picto('', 'next')).'</span><br><br>';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
|
||||
@ -643,7 +643,7 @@ if ($step == 3 && $datatoimport)
|
||||
print '">'.img_delete().'</a></td>';
|
||||
// Action button
|
||||
print '<td style="text-align:right">';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?step=4'.$param.'&filetoimport='.urlencode($relativepath).'">'.img_picto($langs->trans("NewImport"), 'filenew').'</a>';
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?step=4'.$param.'&filetoimport='.urlencode($relativepath).'">'.img_picto($langs->trans("NewImport"), 'next', 'class="fa-15x"').'</a>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ ALTER TABLE llx_categorie_warehouse ADD CONSTRAINT fk_categorie_warehouse_fk_war
|
||||
create table llx_holiday_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
@ -135,7 +135,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
|
||||
create table llx_entrepot_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
@ -165,7 +165,7 @@ ALTER TABLE llx_events ADD COLUMN prefix_session varchar(255) NULL;
|
||||
create table llx_payment_salary_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL, -- salary payment id
|
||||
import_key varchar(14) -- import key
|
||||
)ENGINE=innodb;
|
||||
@ -183,8 +183,8 @@ ALTER TABLE llx_oauth_token ADD COLUMN fk_soc integer DEFAULT NULL after token;
|
||||
|
||||
ALTER TABLE llx_adherent_type ADD COLUMN duration varchar(6) DEFAULT NULL after morphy;
|
||||
|
||||
ALTER TABLE llx_mailing ADD COLUMN tms timestamp;
|
||||
ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp;
|
||||
ALTER TABLE llx_mailing ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
ALTER TABLE llx_mailing_cibles ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
ALTER TABLE llx_projet ADD COLUMN usage_opportunity integer DEFAULT 0;
|
||||
ALTER TABLE llx_projet ADD COLUMN usage_task integer DEFAULT 1;
|
||||
@ -458,7 +458,7 @@ create table llx_c_shipment_package_type
|
||||
|
||||
CREATE TABLE llx_product_fournisseur_price_extrafields (
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
@ -478,7 +478,7 @@ CREATE TABLE llx_mrp_mo(
|
||||
note_private text,
|
||||
date_creation datetime NOT NULL,
|
||||
date_valid datetime NULL,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
fk_user_valid integer,
|
||||
@ -514,7 +514,7 @@ ALTER TABLE llx_mrp_mo ADD INDEX idx_mrp_mo_fk_project (fk_project);
|
||||
create table llx_mrp_mo_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL,
|
||||
import_key varchar(14) -- import key
|
||||
) ENGINE=innodb;
|
||||
@ -551,7 +551,7 @@ CREATE TABLE llx_mrp_production(
|
||||
fk_mrp_production integer, -- if role = 'consumed', id of line with role 'toconsume', if role = 'produced' id of line with role 'toproduce'
|
||||
fk_stock_movement integer, -- id of stock movement when movements are validated
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14)
|
||||
@ -576,7 +576,7 @@ ALTER TABLE llx_facture_rec MODIFY COLUMN fk_cond_reglement integer NOT NULL DEF
|
||||
create table llx_commande_fournisseur_dispatch_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL, -- object id
|
||||
import_key varchar(14) -- import key
|
||||
)ENGINE=innodb;
|
||||
@ -587,7 +587,7 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande
|
||||
create table llx_facturedet_rec_extrafields
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
tms timestamp,
|
||||
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
fk_object integer NOT NULL, -- object id
|
||||
import_key varchar(14) -- import key
|
||||
)ENGINE=innodb;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user