Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop_menu Conflicts: htdocs/commande/class/commande.class.php
This commit is contained in:
commit
d9ea61e47c
15
.github/CONTRIBUTING.md
vendored
15
.github/CONTRIBUTING.md
vendored
@ -113,13 +113,14 @@ Also, some code changes need a prior approbation:
|
||||
|
||||
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
|
||||
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow
|
||||
every developer discuss about the PR.
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later.
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR.
|
||||
By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio in Open Source world, don't expect the core team
|
||||
to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow every developer discuss about the PR.
|
||||
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later. Don't expect anything on your PR if you have such errors, you MUST first fix the Continuous Integration error to have it taken into consideration.
|
||||
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR and why the PR is kept open. By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
In most cases, it give you information of things you have to do to have the PR taken into consideration (for example a change is requested, a conflict is expected to be solved, some questions were asked). If you have a yellow, red flag of purple flag, don't expect to have your PR validated. You must first provide the answer the flag ask you. The majority of PR are waiting a developer action.
|
||||
|
||||
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio of answered PR in Open Source world, don't expect the core team to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
|
||||
|
||||
### Resources
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
# .scrutinizer.yml
|
||||
#build:
|
||||
# - php-scrutinizer-run
|
||||
build:
|
||||
- php-scrutinizer-run
|
||||
nodes:
|
||||
analysis:
|
||||
tests:
|
||||
override:
|
||||
- php-scrutinizer-run
|
||||
|
||||
imports:
|
||||
- javascript
|
||||
|
||||
@ -414,7 +414,7 @@ NEW: add option PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT
|
||||
NEW: Add option to display thirdparty adress in combolist
|
||||
NEW: Add option to swap sender/recipient address on PDF
|
||||
NEW: Add option to display thirdparty adress in combolist
|
||||
NEW: Add project on pament of salaries
|
||||
NEW: Add project on payment of salaries
|
||||
NEW: Add SHIPPING_PDF_HIDE_WEIGHT_AND_VOLUME and
|
||||
NEW: Add somes hooks in bank planned entries
|
||||
NEW: Add supplier ref in item reception page
|
||||
|
||||
@ -8,7 +8,7 @@ define('DOL_DOCUMENT_ROOT', __DIR__ . '/../../htdocs');
|
||||
define('DOL_DATA_ROOT', __DIR__ . '/../../documents');
|
||||
define('DOL_URL_ROOT', '/');
|
||||
|
||||
// Load the main.inc.php file to have finctions llx_Header and llx_Footer defined
|
||||
// Load the main.inc.php file to have functions llx_Header and llx_Footer defined
|
||||
if (! defined("NOLOGIN")) define("NOLOGIN", '1');
|
||||
global $conf, $langs, $user, $db;
|
||||
include_once __DIR__ . '/../../htdocs/main.inc.php';
|
||||
|
||||
1
htdocs/.gitignore
vendored
1
htdocs/.gitignore
vendored
@ -28,3 +28,4 @@
|
||||
/nomenclature*
|
||||
/of/
|
||||
/workstation/
|
||||
/oblyon*
|
||||
|
||||
@ -641,8 +641,8 @@ if ($action == 'create')
|
||||
print '<td>' . $accountingaccount->getNomUrl(0, 1, 1, '', 0) . '</td>';
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
print '<td>' . $line->label_operation. '</td>';
|
||||
print '<td class="right">' . price($line->debit) . '</td>';
|
||||
print '<td class="right">' . price($line->credit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($line->debit) . '</td>';
|
||||
print '<td class="nowrap right">' . price($line->credit) . '</td>';
|
||||
|
||||
print '<td class="center">';
|
||||
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=update&id=' . $line->id . '&piece_num=' . $line->piece_num . '&mode='.$mode.'">';
|
||||
@ -675,7 +675,7 @@ if ($action == 'create')
|
||||
print $formaccounting->select_account('', 'accountingaccount_number', 1, array (), 1, 1, '');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
// TODO For the moment we keep a fre input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
|
||||
// use setup of keypress to select thirdparty and this hang browser on large database.
|
||||
if (! empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX))
|
||||
{
|
||||
|
||||
@ -789,7 +789,7 @@ if ($num > 0)
|
||||
// Amount debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
@ -798,7 +798,7 @@ if ($num > 0)
|
||||
// Amount credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
@ -879,8 +879,8 @@ if ($num > 0)
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="right">'.price($totalarray['totalcredit']).'</td>';
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* Copyright (C) 2016-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2016-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
|
||||
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -50,6 +50,7 @@ class AccountancyExport
|
||||
public static $EXPORT_TYPE_SAGE50_SWISS = 45;
|
||||
public static $EXPORT_TYPE_QUADRATUS = 60;
|
||||
public static $EXPORT_TYPE_OPENCONCERTO = 100;
|
||||
public static $EXPORT_TYPE_LDCOMPTA = 110;
|
||||
public static $EXPORT_TYPE_FEC = 1000;
|
||||
|
||||
|
||||
@ -105,6 +106,7 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => $langs->trans('Modelcsv_openconcerto'),
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => $langs->trans('Modelcsv_Sage50_Swiss'),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'),
|
||||
self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'),
|
||||
);
|
||||
|
||||
@ -133,6 +135,7 @@ class AccountancyExport
|
||||
self::$EXPORT_TYPE_AGIRIS => 'agiris',
|
||||
self::$EXPORT_TYPE_OPENCONCERTO => 'openconcerto',
|
||||
self::$EXPORT_TYPE_SAGE50_SWISS => 'sage50ch',
|
||||
self::$EXPORT_TYPE_LDCOMPTA => 'ldcompta',
|
||||
self::$EXPORT_TYPE_FEC => 'fec',
|
||||
);
|
||||
|
||||
@ -191,6 +194,10 @@ class AccountancyExport
|
||||
'label' => $langs->trans('Modelcsv_Sage50_Swiss'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_LDCOMPTA => array(
|
||||
'label' => $langs->trans('Modelcsv_LDCompta'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'csv',
|
||||
),
|
||||
self::$EXPORT_TYPE_FEC => array(
|
||||
'label' => $langs->trans('Modelcsv_FEC'),
|
||||
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
|
||||
@ -257,12 +264,15 @@ class AccountancyExport
|
||||
case self::$EXPORT_TYPE_OPENCONCERTO :
|
||||
$this->exportOpenConcerto($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_FEC :
|
||||
$this->exportFEC($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_SAGE50_SWISS :
|
||||
$this->exportSAGE50SWISS($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_LDCOMPTA :
|
||||
$this->exportLDCompta($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_FEC :
|
||||
$this->exportFEC($TData);
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
break;
|
||||
@ -909,6 +919,100 @@ class AccountancyExport
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Export format : LD Compta version 9 & higher
|
||||
* http://www.ldsysteme.fr/fileadmin/telechargement/np/ldcompta/Documentation/IntCptW10.pdf
|
||||
*
|
||||
* @param array $objectLines data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function exportLDCompta($objectLines)
|
||||
{
|
||||
|
||||
$separator = ';';
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
|
||||
// TYPE
|
||||
$type_enregistrement = 'E'; // For write movement
|
||||
print $type_enregistrement . $separator;
|
||||
// JNAL
|
||||
print substr($line->code_journal, 0, 2) . $separator;
|
||||
// NECR
|
||||
print $line->id . $separator;
|
||||
// NPIE
|
||||
print $line->piece_num . $separator;
|
||||
// DATP
|
||||
print $date_document . $separator;
|
||||
// LIBE
|
||||
print $line->label_operation . $separator;
|
||||
// DATH
|
||||
print $line->date_lim_reglement . $separator;
|
||||
// CNPI
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AF';
|
||||
} else {
|
||||
$nature_piece = 'FF';
|
||||
}
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
if ($line->montant < 0) {
|
||||
$nature_piece = 'AC';
|
||||
} else {
|
||||
$nature_piece = 'FC';
|
||||
}
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $nature_piece . $separator;
|
||||
// RACI
|
||||
/*
|
||||
if (! empty($line->subledger_account)) {
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
$racine_subledger_account = '40';
|
||||
} elseif ($line->doc_type == 'customer_invoice') {
|
||||
$racine_subledger_account = '41';
|
||||
} else {
|
||||
$nature_piece = '';
|
||||
}
|
||||
print $racine_subledger_account . $separator;
|
||||
} else {
|
||||
print $separator;
|
||||
}
|
||||
*/
|
||||
// MONT
|
||||
print price(abs($line->montant)) . $separator;
|
||||
// CODC
|
||||
print $line->sens . $separator;
|
||||
// CPTG
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
// DATE
|
||||
print $date_creation . $separator;
|
||||
// CLET
|
||||
print $line->lettering_code . $separator;
|
||||
// DATL
|
||||
print $line->date_lettering . $separator;
|
||||
// CPTA
|
||||
if (! empty($line->subledger_account)) {
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
}
|
||||
// CNAT
|
||||
if ($line->doc_type == 'supplier_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'F';
|
||||
} elseif ($line->doc_type == 'customer_invoice' && ! empty($line->subledger_account)) {
|
||||
print 'C';
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* trunc
|
||||
*
|
||||
|
||||
@ -321,8 +321,8 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ", piece_num";
|
||||
$sql .= ', entity';
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
||||
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
||||
$sql .= "'".$this->db->idate($this->doc_date)."'";
|
||||
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||
$sql .= "," . $this->fk_doc;
|
||||
@ -338,7 +338,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= "," . $this->montant;
|
||||
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
||||
$sql .= ",'" . $this->db->idate($now). "'";
|
||||
$sql .= ",'".$this->db->idate($now)."'";
|
||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
||||
$sql .= "," . $this->db->escape($this->piece_num);
|
||||
@ -469,14 +469,15 @@ class BookKeeping extends CommonObject
|
||||
*/
|
||||
public function createStd(User $user, $notrigger = false, $mode = '')
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "compta"));
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->doc_type)) {
|
||||
$this->doc_type = trim($this->doc_type);
|
||||
}
|
||||
@ -540,10 +541,10 @@ class BookKeeping extends CommonObject
|
||||
$now = dol_now();
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
$this->journal_label = $langs->trans($this->journal_label);
|
||||
|
||||
// Insert request
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.'(';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . $mode.' (';
|
||||
$sql .= 'doc_date,';
|
||||
$sql .= 'date_lim_reglement,';
|
||||
$sql .= 'doc_type,';
|
||||
@ -567,7 +568,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= 'piece_num,';
|
||||
$sql .= 'entity';
|
||||
$sql .= ') VALUES (';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'".$this->db->idate($this->doc_date)."'") . ',';
|
||||
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||
@ -584,7 +585,7 @@ class BookKeeping extends CommonObject
|
||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||
$sql .= ' ' . $user->id . ',';
|
||||
$sql .= ' ' . "'" . $this->db->idate($now) . "',";
|
||||
$sql .= ' ' . "'".$this->db->idate($now)."',";
|
||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||
@ -1161,7 +1162,7 @@ class BookKeeping extends CommonObject
|
||||
|
||||
// Update request
|
||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . $mode.' SET';
|
||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ',';
|
||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'".$this->db->idate($this->doc_date)."'" : 'null') . ',';
|
||||
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
|
||||
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
|
||||
$sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ',';
|
||||
@ -1689,28 +1690,30 @@ class BookKeeping extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($direction==0)
|
||||
if ($direction==0)
|
||||
{
|
||||
$next_piecenum=$this->getNextNumMvt();
|
||||
$now = dol_now();
|
||||
|
||||
if ($next_piecenum < 0) {
|
||||
$error++;
|
||||
}
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'(doc_date, doc_type,';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . ' (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= 'SELECT doc_date, doc_type,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.'';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, ' . $next_piecenum . ", '".$this->db->idate($now)."'";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
@ -1718,29 +1721,29 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
} elseif ($direction==1) {
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'_tmp(doc_date, doc_type,';
|
||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '_tmp (doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||
$sql .= 'SELECT doc_date, doc_type,';
|
||||
$sql .= ' SELECT doc_date, doc_type,';
|
||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = '.$piece_num;
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
}
|
||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error ++;
|
||||
|
||||
@ -374,9 +374,9 @@ if ($result) {
|
||||
|
||||
// Ref Product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print $objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
print '<td class="tdoverflowonsmartphone">';
|
||||
|
||||
@ -319,8 +319,8 @@ if ($result) {
|
||||
$arrayofselected=is_array($toselect)?$toselect:array();
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
if ($search_lineid) $param.='&search_lineid='.urlencode($search_lineid);
|
||||
if ($search_day) $param.='&search_day='.urlencode($search_day);
|
||||
if ($search_month) $param.='&search_month='.urlencode($search_month);
|
||||
@ -330,8 +330,8 @@ if ($result) {
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_amount) $param.='&search_amount='.urlencode($search_amount);
|
||||
if ($search_vat) $param.='&search_vat='.urlencode($search_vat);
|
||||
if ($search_country) $param .= "&search_country=" . urlencode($search_country);
|
||||
if ($search_tvaintra) $param .= "&search_tvaintra=" . urlencode($search_tvaintra);
|
||||
if ($search_country) $param.= "&search_country=".urlencode($search_country);
|
||||
if ($search_tvaintra) $param.= "&search_tvaintra=".urlencode($search_tvaintra);
|
||||
|
||||
$arrayofmassactions = array(
|
||||
'ventil'=>$langs->trans("Ventilate")
|
||||
@ -403,7 +403,7 @@ if ($result) {
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -45,7 +45,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/don/class/paymentdonation.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
@ -384,9 +384,9 @@ if ($result) {
|
||||
|
||||
// Ref product
|
||||
print '<td>';
|
||||
if ($product_static->id)
|
||||
print $product_static->getNomUrl(1);
|
||||
if ($objp->product_label) print '<br>'.$objp->product_label;
|
||||
if ($product_static->id > 0) print $product_static->getNomUrl(1);
|
||||
if ($product_static->id > 0 && $objp->product_label) print '<br>';
|
||||
if ($objp->product_label) print $objp->product_label;
|
||||
print '</td>';
|
||||
|
||||
// Description
|
||||
|
||||
@ -405,7 +405,7 @@ if ($result) {
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductDescription", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "l.total_ht", "", $param, '', $sortfield, $sortorder, 'right maxwidth50 ');
|
||||
print_liste_field_titre("VATRate", $_SERVER["PHP_SELF"], "l.tva_tx", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Country", $_SERVER["PHP_SELF"], "co.label", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
@ -1187,7 +1187,7 @@ else
|
||||
}
|
||||
// Morphy
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy")?GETPOST("morphy", 'alpha'):$object->morphy));
|
||||
print "</td></tr>";
|
||||
|
||||
@ -342,7 +342,7 @@ if ($action == 'create')
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
|
||||
print "</td></tr>";
|
||||
@ -775,7 +775,7 @@ if ($rowid > 0)
|
||||
// Morphy
|
||||
$morphys[""] = $langs->trans("MorPhy");
|
||||
$morphys["phy"] = $langs->trans("Physical");
|
||||
$morphys["mor"] = $langs->trans("Morale");
|
||||
$morphys["mor"] = $langs->trans("Moral");
|
||||
print '<tr><td><span>'.$langs->trans("MemberNature").'</span></td><td>';
|
||||
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
|
||||
print "</td></tr>";
|
||||
|
||||
@ -40,7 +40,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
||||
$search_event = GETPOST('search_event', 'alpha');
|
||||
|
||||
// Get list of triggers available
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype";
|
||||
$sql = "SELECT a.rowid, a.code, a.label, a.elementtype, a.rang as position";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a";
|
||||
$sql.= " ORDER BY a.rang ASC";
|
||||
$resql=$db->query($sql);
|
||||
@ -55,6 +55,7 @@ if ($resql)
|
||||
$triggers[$i]['code'] = $obj->code;
|
||||
$triggers[$i]['element'] = $obj->elementtype;
|
||||
$triggers[$i]['label'] = ($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
|
||||
$triggers[$i]['position'] = $obj->position;
|
||||
|
||||
$i++;
|
||||
}
|
||||
@ -65,6 +66,8 @@ else
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
//$triggers = dol_sort_array($triggers, 'code', 'asc', 0, 0, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
|
||||
228
htdocs/admin/facture_situation.php
Normal file
228
htdocs/admin/facture_situation.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/admin/facture.php
|
||||
* \ingroup facture
|
||||
* \brief Page to setup invoice module
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'errors', 'other', 'bills'));
|
||||
|
||||
if (! $user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type='invoice';
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader(
|
||||
"", $langs->trans("BillsSetup"),
|
||||
'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura'
|
||||
);
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup');
|
||||
|
||||
$head = invoice_admin_prepare_head();
|
||||
dol_fiche_head($head, 'situation', $langs->trans("InvoiceSituation"), -1, 'invoice');
|
||||
|
||||
/*
|
||||
* Numbering module
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("InvoiceSituation"), '', '');
|
||||
$var=0;
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
_updateBtn();
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
|
||||
_printOnOff('INVOICE_USE_SITUATION', $langs->trans('UseSituationInvoices'));
|
||||
_printOnOff('INVOICE_USE_SITUATION_CREDIT_NOTE', $langs->trans('UseSituationInvoicesCreditNote'));
|
||||
_printOnOff('INVOICE_USE_SITUATION_RETAINED_WARRANTY', $langs->trans('Retainedwarranty'));
|
||||
|
||||
$metas = array(
|
||||
'type' => 'number',
|
||||
'step' => '0.01',
|
||||
'min' => 0,
|
||||
'max' => 100
|
||||
);
|
||||
_printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas);
|
||||
|
||||
|
||||
|
||||
|
||||
// Conditions paiements
|
||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
||||
print '<tr class="impair">';
|
||||
print '<td>'.$langs->trans('PaymentConditionsShortRetainedWarranty').'</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print '<input type="hidden" name="param'.$inputCount.'" value="INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID">';
|
||||
$form->select_conditions_paiements($conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID, 'value'.$inputCount, -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
_updateBtn();
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
/**
|
||||
* Print an update button
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _updateBtn()
|
||||
{
|
||||
global $langs;
|
||||
print '<div style="text-align: right;" >';
|
||||
print '<input type="submit" class="butAction" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a On/Off button
|
||||
*
|
||||
* @param string $confkey the conf key
|
||||
* @param bool $title Title of conf
|
||||
* @param string $desc Description
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _printOnOff($confkey, $title = false, $desc = '')
|
||||
{
|
||||
global $var, $bc, $langs;
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.($title?$title:$langs->trans($confkey));
|
||||
if (!empty($desc)) {
|
||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print ajax_constantonoff($confkey);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print a form part
|
||||
*
|
||||
* @param string $confkey the conf key
|
||||
* @param bool $title Title of conf
|
||||
* @param string $desc Description of
|
||||
* @param array $metas html meta
|
||||
* @param string $type type of input textarea or input
|
||||
* @param bool $help help description
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function _printInputFormPart($confkey, $title = false, $desc = '', $metas = array(), $type = 'input', $help = false)
|
||||
{
|
||||
global $var, $bc, $langs, $conf, $db, $inputCount;
|
||||
$var=!$var;
|
||||
$inputCount = empty($inputCount)?1:($inputCount+1);
|
||||
$form=new Form($db);
|
||||
|
||||
$defaultMetas = array(
|
||||
'name' => 'value'.$inputCount
|
||||
);
|
||||
|
||||
if ($type!='textarea') {
|
||||
$defaultMetas['type'] = 'text';
|
||||
$defaultMetas['value'] = $conf->global->{$confkey};
|
||||
}
|
||||
|
||||
|
||||
$metas = array_merge($defaultMetas, $metas);
|
||||
$metascompil = '';
|
||||
foreach ($metas as $key => $values) {
|
||||
$metascompil .= ' '.$key.'="'.$values.'" ';
|
||||
}
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
|
||||
if (!empty($help)) {
|
||||
print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, ''));
|
||||
} else {
|
||||
print $title?$title:$langs->trans($confkey);
|
||||
}
|
||||
|
||||
if (!empty($desc)) {
|
||||
print '<br><small>'.$langs->trans($desc).'</small>';
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
print '<td class="center" width="20"> </td>';
|
||||
print '<td class="right" width="300">';
|
||||
print '<input type="hidden" name="param'.$inputCount.'" value="'.$confkey.'">';
|
||||
|
||||
print '<input type="hidden" name="action" value="setModuleOptions">';
|
||||
if ($type=='textarea') {
|
||||
print '<textarea '.$metascompil.' >'.dol_htmlentities($conf->global->{$confkey}).'</textarea>';
|
||||
} else {
|
||||
print '<input '.$metascompil.' />';
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -526,11 +526,17 @@ else
|
||||
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
|
||||
// Disable
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS).'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_DISABLE_ALL_MAILS").'</td><td>'.yn($conf->global->MAIN_DISABLE_ALL_MAILS);
|
||||
if (! empty($conf->global->MAIN_DISABLE_ALL_MAILS)) print img_warning($langs->trans("Disabled"));
|
||||
print '</td></tr>';
|
||||
|
||||
// Force e-mail recipient
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_FORCE_SENDTO").'</td><td>'.$conf->global->MAIN_MAIL_FORCE_SENDTO;
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO) && ! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
if (! empty($conf->global->MAIN_MAIL_FORCE_SENDTO))
|
||||
{
|
||||
if (! isValidEmail($conf->global->MAIN_MAIL_FORCE_SENDTO)) print img_warning($langs->trans("ErrorBadEMail"));
|
||||
else print img_warning($langs->trans("RecipientEmailsWillBeReplacedWithThisValue"));
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
//Add user to select destinaries list
|
||||
|
||||
@ -87,7 +87,8 @@ if ($action == 'update')
|
||||
$result=$menu->fetch(GETPOST('menuId', 'int'));
|
||||
if ($result > 0)
|
||||
{
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
|
||||
$menu->title=GETPOST('titre', 'alpha');
|
||||
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
|
||||
$menu->url=GETPOST('url', 'alpha');
|
||||
$menu->langs=GETPOST('langs', 'alpha');
|
||||
@ -205,7 +206,8 @@ if ($action == 'add')
|
||||
$menu = new Menubase($db);
|
||||
$menu->menu_handler=preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
|
||||
$menu->type=GETPOST('type', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha');
|
||||
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
|
||||
$menu->title=GETPOST('titre', 'alpha');
|
||||
$menu->url=GETPOST('url', 'alpha');
|
||||
$menu->langs=GETPOST('langs', 'alpha');
|
||||
$menu->position=GETPOST('position', 'int');
|
||||
@ -494,7 +496,7 @@ elseif ($action == 'edit')
|
||||
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre ? $menu->titre : $menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
|
||||
|
||||
// Url
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
|
||||
|
||||
@ -244,13 +244,13 @@ print "<br>\n";
|
||||
// Confirmation for remove menu entry
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$sql = "SELECT m.titre";
|
||||
$sql = "SELECT m.titre as title";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
|
||||
$sql.= " WHERE m.rowid = ".GETPOST('menuId', 'int');
|
||||
$result = $db->query($sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
|
||||
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->title), "confirm_delete");
|
||||
}
|
||||
|
||||
$newcardbutton='';
|
||||
|
||||
@ -900,7 +900,8 @@ if ($mode == 'marketplace')
|
||||
|
||||
?>
|
||||
<form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
|
||||
<input type="hidden" name="mode" value="marketplace" />
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken'] ?>">
|
||||
<input type="hidden" name="mode" value="marketplace">
|
||||
<div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
|
||||
<input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
|
||||
</div>
|
||||
@ -1026,15 +1027,35 @@ if ($mode == 'deploy')
|
||||
|
||||
print $langs->trans("YouCanSubmitFile");
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
if ($maxphp > 0) $maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxmin > 0)
|
||||
{
|
||||
@ -1062,7 +1083,7 @@ if ($mode == 'deploy')
|
||||
{
|
||||
$langs->load('other');
|
||||
print ' ';
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -70,6 +70,18 @@ else
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module log
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
|
||||
$test=empty($conf->syslog->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else
|
||||
{
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
// Module debugbar
|
||||
print '<br>';
|
||||
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
|
||||
@ -77,7 +89,7 @@ $test=empty($conf->debugbar->enabled);
|
||||
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
|
||||
else
|
||||
{
|
||||
print img_picto('', 'warning').' '.$langs->trans("DebugBarModuleActivated");
|
||||
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar"));
|
||||
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
|
||||
}
|
||||
print '<br>';
|
||||
@ -110,20 +122,20 @@ $test=function_exists('xcache_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("XCacheInstalled");
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache");
|
||||
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
|
||||
}
|
||||
$test=function_exists('eaccelerator_info');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("EAcceleratorInstalled");
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "Eaccelerator");
|
||||
}
|
||||
$test=function_exists('opcache_get_status');
|
||||
if (! $foundcache && $test)
|
||||
{
|
||||
$foundcache++;
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("ZendOPCacheInstalled"); // Should be by default starting with PHP 5.5
|
||||
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "ZendOPCache"); // Should be by default starting with PHP 5.5
|
||||
//$tmp=opcache_get_status();
|
||||
//var_dump($tmp);
|
||||
}
|
||||
|
||||
@ -48,14 +48,31 @@ if (isset($title))
|
||||
}
|
||||
|
||||
|
||||
// Check PHP setup is OK
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print info_admin($langs->trans("WarningParamUploadMaxFileSizeHigherThanPostMaxSize", @ini_get('upload_max_filesize'), @ini_get('post_max_size')), 0, 0, 0, 'warning');
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
$var=false;
|
||||
|
||||
// Recupere la version de PHP
|
||||
// Get PHP version
|
||||
$phpversion=version_php();
|
||||
print '<tr class="oddeven"><td width="220px">'.$langs->trans("Version")."</td><td>".$phpversion."</td></tr>\n";
|
||||
|
||||
|
||||
@ -56,11 +56,12 @@ $pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield="dateevent";
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
|
||||
$search_code = GETPOST("search_code");
|
||||
$search_ip = GETPOST("search_ip");
|
||||
$search_user = GETPOST("search_user");
|
||||
$search_desc = GETPOST("search_desc");
|
||||
$search_ua = GETPOST("search_ua");
|
||||
$search_code = GETPOST("search_code", "alpha");
|
||||
$search_ip = GETPOST("search_ip", "alpha");
|
||||
$search_user = GETPOST("search_user", "alpha");
|
||||
$search_desc = GETPOST("search_desc", "alpha");
|
||||
$search_ua = GETPOST("search_ua", "none");
|
||||
$search_prefix_session = GETPOST("search_prefix_session", "none");
|
||||
|
||||
if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear"));
|
||||
else $date_start=-1;
|
||||
@ -91,6 +92,8 @@ $date_endday = $tmp['mday'];
|
||||
$date_endmonth = $tmp['mon'];
|
||||
$date_endyear = $tmp['year'];
|
||||
|
||||
$arrayfields=array();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -108,6 +111,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
$search_user='';
|
||||
$search_desc='';
|
||||
$search_ua='';
|
||||
$search_prefix_session='';
|
||||
}
|
||||
|
||||
// Purge audit events
|
||||
@ -136,6 +140,7 @@ if ($action == 'confirm_purge' && $confirm == 'yes' && $user->admin)
|
||||
$securityevent->type='SECURITY_EVENTS_PURGE';
|
||||
$securityevent->dateevent=$now;
|
||||
$securityevent->description=$text;
|
||||
|
||||
$result=$securityevent->create($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
@ -163,7 +168,7 @@ $userstatic=new User($db);
|
||||
$usefilter=0;
|
||||
|
||||
$sql = "SELECT e.rowid, e.type, e.ip, e.user_agent, e.dateevent,";
|
||||
$sql.= " e.fk_user, e.description,";
|
||||
$sql.= " e.fk_user, e.description, e.prefix_session,";
|
||||
$sql.= " u.login";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as e";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = e.fk_user";
|
||||
@ -175,6 +180,7 @@ if ($search_ip) { $usefilter++; $sql.=natural_search("e.ip", $search_ip, 0); }
|
||||
if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, 0); }
|
||||
if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); }
|
||||
if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); }
|
||||
if ($search_prefix_session) { $usefilter++; $sql.=natural_search("e.prefix_session", $search_prefix_session, 0); }
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
// Count total nb of records
|
||||
@ -207,6 +213,7 @@ if ($result)
|
||||
if ($search_user) $param.='&search_user='.urlencode($search_user);
|
||||
if ($search_desc) $param.='&search_desc='.urlencode($search_desc);
|
||||
if ($search_ua) $param.='&search_ua='.urlencode($search_ua);
|
||||
if ($search_prefix_sessiona) $param.='&search_prefix_session='.urlencode($search_prefix_session);
|
||||
if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth);
|
||||
if ($date_startday) $param.= "&date_startday=".urlencode($date_startday);
|
||||
if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear);
|
||||
@ -239,22 +246,36 @@ if ($result)
|
||||
print '<td class="liste_titre" width="15%">'.$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0).'</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_code" value="'.$search_code.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_code" value="'.$search_code.'">';
|
||||
print '</td>';
|
||||
|
||||
// IP
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_ip" value="'.$search_ip.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_ip" value="'.$search_ip.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" size="10" name="search_user" value="'.$search_user.'">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_user" value="'.$search_user.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td class="liste_titre left">';
|
||||
//print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
|
||||
//print '<input class="flat maxwidth100" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_ua" value="'.$search_ua.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre left">';
|
||||
print '<input class="flat maxwidth100" type="text" name="search_prefix_session" value="'.$search_prefix_session.'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
@ -264,11 +285,19 @@ if ($result)
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, 'align="left"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "e.dateevent", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Code", $_SERVER["PHP_SELF"], "e.type", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("IP", $_SERVER["PHP_SELF"], "e.ip", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("User", $_SERVER["PHP_SELF"], "u.login", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "e.description", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
print_liste_field_titre("UserAgent", $_SERVER["PHP_SELF"], "e.user_agent", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
print_liste_field_titre("PrefixSession", $_SERVER["PHP_SELF"], "e.prefix_session", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -312,9 +341,26 @@ if ($result)
|
||||
print $text;
|
||||
print '</td>';
|
||||
|
||||
if (! empty($arrayfields['e.user_agent']['checked']))
|
||||
{
|
||||
// User agent
|
||||
print '<td>';
|
||||
print $obj->user_agent;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['e.prefix_session']['checked']))
|
||||
{
|
||||
// User agent
|
||||
print '<td>';
|
||||
print $obj->prefix_session;
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// More informations
|
||||
print '<td class="right">';
|
||||
$htmltext='<b>'.$langs->trans("UserAgent").'</b>: '.($obj->user_agent?$obj->user_agent:$langs->trans("Unknown"));
|
||||
$htmltext.='<br><b>'.$langs->trans("PrefixSession").'</b>: '.($obj->prefix_session?$obj->prefix_session:$langs->trans("Unknown"));
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -143,7 +143,6 @@ class DolibarrApi
|
||||
unset($object->picto);
|
||||
|
||||
unset($object->fieldsforcombobox);
|
||||
unset($object->comments);
|
||||
|
||||
unset($object->skip_update_total);
|
||||
unset($object->context);
|
||||
|
||||
@ -88,18 +88,21 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
||||
// index.php/xxx called by any REST client to run API
|
||||
|
||||
|
||||
$reg=array();
|
||||
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
||||
|
||||
|
||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
||||
$refreshcache=false;
|
||||
// When in production mode, a file api/temp/routes.php is created with the API available of current call.
|
||||
// But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
|
||||
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
|
||||
// So we force refresh to each call.
|
||||
$refreshcache=(empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
$refreshcache=true;
|
||||
}
|
||||
|
||||
|
||||
$api = new DolibarrApi($db, '', $refreshcache);
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
|
||||
@ -115,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
||||
|
||||
|
||||
|
||||
// Call Explorer file for all APIs definitions
|
||||
// Call Explorer file for all APIs definitions (this part is slow)
|
||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||
{
|
||||
// Scan all API files to load them
|
||||
@ -254,5 +257,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
||||
//var_dump($api->r->apiVersionMap);
|
||||
//exit;
|
||||
|
||||
// Call API (we suppose we found it)
|
||||
// Call API (we suppose we found it).
|
||||
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
|
||||
$api->r->handle();
|
||||
|
||||
@ -515,6 +515,7 @@ class BOM extends CommonObject
|
||||
public function valid($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
@ -582,13 +583,18 @@ class BOM extends CommonObject
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
|
||||
// in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'bom/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'bom/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->bom->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->bom->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ $action=GETPOST('action', 'alpha');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'actioncommlist'; // To manage different context of search
|
||||
$resourceid=GETPOST("search_resourceid", "int")?GETPOST("search_resourceid", "int"):GETPOST("resourceid", "int");
|
||||
$pid=GETPOST("search_projectid", 'int', 3)?GETPOST("search_projectid", 'int', 3):GETPOST("projectid", 'int', 3);
|
||||
$status=GETPOST("search_status", 'alpha')?GETPOST("search_status", 'alpha'):GETPOST("status", 'alpha');
|
||||
$status=(GETPOST("search_status", 'alpha') != '')?GETPOST("search_status", 'alpha'):GETPOST("status", 'alpha');
|
||||
$type=GETPOST('search_type', 'alphanohtml')?GETPOST('search_type', 'alphanohtml'):GETPOST('type', 'alphanohtml');
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
$year=GETPOST("year", 'int');
|
||||
|
||||
@ -694,7 +694,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
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">'.$num.'</span></a></td>';
|
||||
@ -779,7 +779,7 @@ if ($object->id > 0)
|
||||
$db->free($resql2);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastCustomerOrders", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/commande/list.php?socid='.$object->id.'">'.$langs->trans("AllOrders").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -855,7 +855,7 @@ if ($object->id > 0)
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num > 0) {
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
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">'.$num.'</span></a></td>';
|
||||
@ -919,7 +919,7 @@ if ($object->id > 0)
|
||||
if ($num >0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts", ($num<=$MAXLIST?"":$MAXLIST)).'</td>';
|
||||
@ -989,7 +989,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
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">'.$num.'</span></td>';
|
||||
@ -1062,7 +1062,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LatestCustomerTemplateInvoices", ($num<=$MAXLIST?"":$MAXLIST)).'</td><td class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->id.'">'.$langs->trans("AllCustomerTemplateInvoices").' <span class="badge">'.$num.'</span></a></td>';
|
||||
@ -1167,7 +1167,7 @@ if ($object->id > 0)
|
||||
if ($num > 0)
|
||||
{
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<table class="noborder centpercent lastrecordtable">';
|
||||
|
||||
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">'.$num.'</span></a></td>';
|
||||
|
||||
@ -1748,10 +1748,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
public function valid($user, $notrigger = 0)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
|
||||
// Protection
|
||||
@ -1817,14 +1817,18 @@ class Propal extends CommonObject
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of propal directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'propale/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->propal->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->propal->multidir_output[$this->entity].'/'.$newref;
|
||||
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
if (@rename($dirsource, $dirdest))
|
||||
|
||||
@ -43,7 +43,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
// Load translation files required by the page
|
||||
$langs->load("propal");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc');
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
|
||||
@ -2118,7 +2118,7 @@ if ($action == 'create' && $usercancreate)
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
print '<table class="border tableforfield centpercent">';
|
||||
|
||||
if ($soc->outstanding_limit)
|
||||
{
|
||||
@ -2456,7 +2456,7 @@ if ($action == 'create' && $usercancreate)
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>'; // Close fichecenter
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
|
||||
@ -321,6 +321,7 @@ class Commande extends CommonOrder
|
||||
public function valid($user, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$error=0;
|
||||
@ -423,13 +424,18 @@ class Commande extends CommonOrder
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// On renomme repertoire ($this->ref = ancienne ref, $num = nouvelle ref)
|
||||
// in order not to lose the attachments
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'commande/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'commande/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->commande->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->commande->multidir_output[$this->entity].'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
// Load translation files required by the page
|
||||
$langs->load("orders");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc');
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
|
||||
@ -26,13 +26,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
|
||||
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries"));
|
||||
$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta"));
|
||||
|
||||
$date_start =GETPOST('date_start', 'alpha');
|
||||
$date_startDay= GETPOST('date_startday', 'int');
|
||||
@ -503,9 +503,9 @@ if (!empty($date_start) && !empty($date_stop))
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">'.price($totalET).'</td>';
|
||||
print '<td align="right">'.price($totalIT).'</td>';
|
||||
print '<td align="right">'.price($totalVAT).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalET, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalIT, 'MT')).'</td>';
|
||||
print '<td align="right">'.price(price2num($totalVAT, 'MT')).'</td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
|
||||
@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php';
|
||||
@ -1116,7 +1116,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['b.rowid']['checked']))
|
||||
{
|
||||
print '<td class="nowrap left">';
|
||||
print "<a href=\"ligne.php?rowid=".$objp->rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||
print "<a href=\"line.php?rowid=".$objp->rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."</a> ";
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
@ -1126,7 +1126,7 @@ if ($resql)
|
||||
{
|
||||
print "<td>";
|
||||
|
||||
//print "<a href=\"ligne.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">";
|
||||
//print "<a href=\"line.php?rowid=".$objp->rowid."&account=".$objp->fk_account."\">";
|
||||
$reg=array();
|
||||
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction
|
||||
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
|
||||
@ -1459,7 +1459,7 @@ if ($resql)
|
||||
// Transaction reconciliated or edit link
|
||||
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
@ -1467,13 +1467,13 @@ if ($resql)
|
||||
{
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.'&account='.$objp->bankid.'&page='.$page.'">';
|
||||
print img_view();
|
||||
print '</a>';
|
||||
}
|
||||
|
||||
@ -2277,7 +2277,7 @@ class AccountLine extends CommonObject
|
||||
|
||||
$result='';
|
||||
$label=$langs->trans("ShowTransaction").': '.$this->rowid;
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$this->rowid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
$result .= $linkstart;
|
||||
|
||||
@ -45,7 +45,7 @@ $object->info($id);
|
||||
|
||||
$h=0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$h++;
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/ligne.php
|
||||
* \file htdocs/compta/bank/line.php
|
||||
* \ingroup bank
|
||||
* \brief Page to edit a bank transaction record
|
||||
*/
|
||||
@ -223,7 +223,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
else $sql.=", rappro = ".$rappro;
|
||||
$sql.= " WHERE rowid = ".$rowid;
|
||||
|
||||
dol_syslog("ligne.php", LOG_DEBUG);
|
||||
dol_syslog("line.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
@ -256,7 +256,7 @@ foreach ($cats as $cat) {
|
||||
|
||||
$tabs = array(
|
||||
array(
|
||||
DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$rowid,
|
||||
DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$rowid,
|
||||
$langs->trans('Card')
|
||||
),
|
||||
array(
|
||||
@ -416,7 +416,7 @@ if ($result)
|
||||
print '</a>';
|
||||
}
|
||||
elseif ($links[$key]['type']=='banktransfert') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$links[$key]['url_id'].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$links[$key]['url_id'].'">';
|
||||
print img_object($langs->trans('ShowTransaction'), 'payment').' ';
|
||||
print $langs->trans("TransactionOnTheOtherAccount");
|
||||
print '</a>';
|
||||
@ -616,7 +616,7 @@ else
|
||||
print '<td class="nowrap">'.$type_label.' '.($objp->num_chq?$objp->num_chq:'').$link.'</td>';
|
||||
|
||||
// Description
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
print '<td valign="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
|
||||
$reg=array();
|
||||
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
|
||||
if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
|
||||
@ -662,7 +662,7 @@ else
|
||||
}
|
||||
elseif ($links[$key]['type']=='payment_salary')
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/salaries/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/salaries/card.php?id='.$links[$key]['url_id'].'">';
|
||||
print ' '.img_object($langs->trans('ShowPayment'), 'payment').' ';
|
||||
print $langs->trans("Payment");
|
||||
print '</a>';
|
||||
@ -778,7 +778,7 @@ else
|
||||
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate)
|
||||
{
|
||||
print '<td class="center"><a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
|
||||
print '<td class="center"><a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
|
||||
print img_edit();
|
||||
print "</a></td>";
|
||||
}
|
||||
|
||||
@ -120,9 +120,9 @@ if ($action == 'add')
|
||||
if (! $error) $bank_line_id_to = $accountto->addline($dateo, $typeto, $label, price2num($amountto), '', '', $user);
|
||||
if (! ($bank_line_id_to > 0)) $error++;
|
||||
|
||||
if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (! $error) $result=$accountfrom->add_url_line($bank_line_id_from, $bank_line_id_to, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (! ($result > 0)) $error++;
|
||||
if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/ligne.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (! $error) $result=$accountto->add_url_line($bank_line_id_to, $bank_line_id_from, DOL_URL_ROOT.'/compta/bank/line.php?rowid=', '(banktransfert)', 'banktransfert');
|
||||
if (! ($result > 0)) $error++;
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -247,7 +247,7 @@ if ($action=="create" || $action=="start")
|
||||
}
|
||||
|
||||
// Get the bank account dedicated to this point of sale module/terminal
|
||||
$vartouse=CASHDESK_ID_BANKACCOUNT_CASH.$terminaltouse;
|
||||
$vartouse='CASHDESK_ID_BANKACCOUNT_CASH'.$terminaltouse;
|
||||
$bankid = $conf->global->$vartouse; // This value is ok for 'Terminal 0' for module 'CashDesk' and 'TakePos' (they manage only 1 terminal)
|
||||
// Hook to get the good bank id according to posmodule and posnumber.
|
||||
// @TODO add hook here
|
||||
|
||||
@ -31,7 +31,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
@ -190,7 +190,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print $socialcontrib->getNomUrl(1, '20');
|
||||
print '</td>';
|
||||
// Type
|
||||
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||
// Expected to pay
|
||||
print '<td class="right">'.price($obj->total).'</td>';
|
||||
// Ref payment
|
||||
|
||||
@ -309,6 +309,38 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->retained_warranty_fk_cond_reglement = 0; // To clean property
|
||||
$result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int'));
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
|
||||
$old_rw_date_lim_reglement = $object->retained_warranty_date_limit;
|
||||
$new_rw_date_lim_reglement = $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
|
||||
if ($new_rw_date_lim_reglement > $old_rw_date_lim_reglement) $object->retained_warranty_date_limit = $new_rw_date_lim_reglement;
|
||||
if ($object->retained_warranty_date_limit < $object->date) $object->retained_warranty_date_limit = $object->date;
|
||||
$result = $object->update($user);
|
||||
if ($result < 0) dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float'));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
|
||||
// Multicurrency Code
|
||||
elseif ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
@ -1205,6 +1237,16 @@ if (empty($reshook))
|
||||
$object->situation_counter = 1;
|
||||
$object->situation_final = 0;
|
||||
$object->situation_cycle_ref = $object->newCycle();
|
||||
|
||||
|
||||
$object->retained_warranty = GETPOST('retained_warranty', 'int');
|
||||
$object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||
|
||||
$retained_warranty_date_limit = GETPOST('retained_warranty_date_limit');
|
||||
if(!empty($retained_warranty_date_limit) && $db->jdate($retained_warranty_date_limit)){
|
||||
$object->retained_warranty_date_limit = $db->jdate($retained_warranty_date_limit);
|
||||
}
|
||||
$object->retained_warranty_date_limit = !empty($object->retained_warranty_date_limit) ? $object->retained_warranty_date_limit : $object->calculate_date_lim_reglement($object->retained_warranty_fk_cond_reglement);
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
@ -2769,7 +2811,7 @@ if ($action == 'create')
|
||||
$note_public = $invoice_predefined->note_public;
|
||||
$note_private = $invoice_predefined->note_private;
|
||||
|
||||
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
|
||||
$sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
|
||||
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
|
||||
|
||||
@ -2793,7 +2835,7 @@ if ($action == 'create')
|
||||
print ' selected';
|
||||
$exampletemplateinvoice->fetch(GETPOST('fac_rec'));
|
||||
}
|
||||
print '>' . $objp->titre . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
|
||||
print '>' . $objp->title . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
|
||||
$i ++;
|
||||
}
|
||||
print '</select>';
|
||||
@ -3143,6 +3185,44 @@ if ($action == 'create')
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
if (! empty($conf->global->INVOICE_USE_SITUATION))
|
||||
{
|
||||
if($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY){
|
||||
|
||||
$rwStyle = 'display:none;';
|
||||
if(GETPOST('type', 'int') == Facture::TYPE_SITUATION){
|
||||
$rwStyle = '';
|
||||
}
|
||||
|
||||
|
||||
$retained_warranty = GETPOST('retained_warranty', 'int');
|
||||
$retained_warranty = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT;
|
||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('RetainedWarranty') . '</td><td colspan="2">';
|
||||
print '<input id="new-situation-invoice-retained-warranty" name="retained_warranty" type="number" value="'.$retained_warranty.'" step="0.01" min="0" max="100" />%';
|
||||
|
||||
// Retained warranty payment term
|
||||
print '<tr class="retained-warranty-line" style="'.$rwStyle.'" ><td class="nowrap">' . $langs->trans('PaymentConditionsShortRetainedWarranty') . '</td><td colspan="2">';
|
||||
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<script type="text/javascript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
$("[name=\'type\'").change(function() {
|
||||
if($( this ).prop("checked") && $( this ).val() == '.Facture::TYPE_SITUATION.')
|
||||
{
|
||||
$(".retained-warranty-line").show();
|
||||
}
|
||||
else{
|
||||
$(".retained-warranty-line").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
}
|
||||
|
||||
// Payment mode
|
||||
print '<tr><td>' . $langs->trans('PaymentMode') . '</td><td colspan="2">';
|
||||
$form->select_types_paiements(isset($_POST['mode_reglement_id']) ? $_POST['mode_reglement_id'] : $mode_reglement_id, 'mode_reglement_id', 'CRDT');
|
||||
@ -4016,6 +4096,126 @@ elseif ($id > 0 || ! empty($ref))
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$displayWarranty = false;
|
||||
if( ( $object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty) || !empty($conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)) ) )
|
||||
{
|
||||
// Check if this situation invoice is 100% for real
|
||||
if(!empty($object->situation_final) && !empty($object->lines)){
|
||||
$displayWarranty = true;
|
||||
foreach($object->lines as $i => $line){
|
||||
if($line->product_type < 2 && $line->situation_percent < 100){
|
||||
$displayWarranty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Retained Warranty
|
||||
print '<tr class="retained-warranty-lines" ><td>';
|
||||
print '<table id="retained-warranty-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarranty' && $user->rights->facture->creer){
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarranty&facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarranty'), 1) . '</a></td>';
|
||||
}
|
||||
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editretainedwarranty')
|
||||
{
|
||||
print '<form id="retained-warranty-form" method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarranty">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input name="retained_warranty" type="number" step="0.01" min="0" max="100" value="'.$object->retained_warranty.'" >';
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print price($object->retained_warranty).'%';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Retained warranty payment term
|
||||
print '<tr class="retained-warranty-lines" ><td>';
|
||||
print '<table id="retained-warranty-cond-reglement-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShortRetainedWarranty');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer){
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantypaymentterms&facid=' . $object->id . '">' . img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1) . '</a></td>';
|
||||
}
|
||||
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
|
||||
if($object->date > $defaultDate){
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantypaymentterms')
|
||||
{
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantyconditions">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int');
|
||||
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $object->retained_warranty_fk_cond_reglement;
|
||||
$retained_warranty_fk_cond_reglement = !empty($retained_warranty_fk_cond_reglement)? $retained_warranty_fk_cond_reglement : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID;
|
||||
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->retained_warranty_fk_cond_reglement, 'none');
|
||||
if(!$displayWarranty){
|
||||
print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" ');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
||||
|
||||
if($displayWarranty)
|
||||
{
|
||||
// Retained Warranty payment date limit
|
||||
print '<tr class="retained-warranty-lines" ><td>';
|
||||
print '<table id="retained-warranty-date-limit-table" class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RetainedWarrantyDateLimit');
|
||||
print '</td>';
|
||||
if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer){
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editretainedwarrantydatelimit&facid=' . $object->id . '">' . img_edit($langs->trans('setretainedwarrantyDateLimit'), 1) . '</a></td>';
|
||||
}
|
||||
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
$defaultDate = !empty($object->retained_warranty_date_limit)?$object->retained_warranty_date_limit:strtotime('-1 years', $object->date_lim_reglement);
|
||||
if($object->date > $defaultDate){
|
||||
$defaultDate = $object->date;
|
||||
}
|
||||
|
||||
if ($action == 'editretainedwarrantydatelimit')
|
||||
{
|
||||
//date('Y-m-d',$object->date_lim_reglement)
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setretainedwarrantydatelimit">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input name="retained_warranty_date_limit" type="date" step="1" min="'.dol_print_date($object->date, '%Y-%m-%d').'" value="'.dol_print_date($defaultDate, '%Y-%m-%d').'" >';
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print dol_print_date($object->retained_warranty_date_limit, 'day');
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Other attributes
|
||||
$cols = 2;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
@ -4460,6 +4660,31 @@ elseif ($id > 0 || ! empty($ref))
|
||||
print ' :</td>';
|
||||
print '<td class="right'.($resteapayeraffiche?' amountremaintopay':(' '.$cssforamountpaymentcomplete)).'">' . price($resteapayeraffiche) . '</td>';
|
||||
print '<td class="nowrap"> </td></tr>';
|
||||
|
||||
// Retained warranty : usualy use on construction industry
|
||||
if(!empty($object->situation_final) && !empty($object->retained_warranty) && $displayWarranty){
|
||||
|
||||
// Billed - retained warranty
|
||||
if($object->type == Facture::TYPE_SITUATION)
|
||||
{
|
||||
$retainedWarranty = $total_global_ttc * $object->retained_warranty / 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Because one day retained warranty could be used on standard invoices
|
||||
$retainedWarranty = $object->total_ttc * $object->retained_warranty / 100;
|
||||
}
|
||||
|
||||
$billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty ;
|
||||
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">' . $langs->trans("ToPayOn", dol_print_date($object->date_lim_reglement, 'day')) . ' :</td><td align="right">' . price($billedWithRetainedWarranty) . '</td><td> </td></tr>';
|
||||
|
||||
// retained warranty
|
||||
print '<tr><td colspan="' . $nbcols . '" align="right">';
|
||||
print $langs->trans("RetainedWarranty") . ' ('.$object->retained_warranty.'%)';
|
||||
print !empty($object->retained_warranty_date_limit)?' '.$langs->trans("ToPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')):'';
|
||||
print ' :</td><td align="right">' . price($retainedWarranty) . '</td><td> </td></tr>';
|
||||
}
|
||||
}
|
||||
else // Credit note
|
||||
{
|
||||
|
||||
@ -123,7 +123,8 @@ class FactureRec extends CommonInvoice
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$this->titre=trim($this->titre);
|
||||
$this->titre=trim($this->titre); // deprecated
|
||||
$this->title=trim($this->title);
|
||||
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
|
||||
if (empty($this->suspended)) $this->suspended=0;
|
||||
|
||||
@ -180,7 +181,7 @@ class FactureRec extends CommonInvoice
|
||||
$sql.= ", multicurrency_tx";
|
||||
$sql.= ", suspended";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$this->db->escape($this->titre)."'";
|
||||
$sql.= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
|
||||
$sql.= ", ".$facsrc->socid;
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->db->idate($now)."'";
|
||||
@ -376,7 +377,7 @@ class FactureRec extends CommonInvoice
|
||||
*/
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
$sql.= ', f.date_lim_reglement as dlr';
|
||||
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
|
||||
@ -410,8 +411,9 @@ class FactureRec extends CommonInvoice
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
$this->titre = $obj->titre;
|
||||
$this->ref = $obj->titre;
|
||||
$this->titre = $obj->title; // deprecated
|
||||
$this->title = $obj->title;
|
||||
$this->ref = $obj->title;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->suspended = $obj->suspended;
|
||||
$this->type = $obj->type;
|
||||
|
||||
@ -206,6 +206,21 @@ class Facture extends CommonInvoice
|
||||
|
||||
public $oldcopy;
|
||||
|
||||
/**
|
||||
* @var double percentage of retainage
|
||||
*/
|
||||
public $retained_warranty;
|
||||
|
||||
/**
|
||||
* @var int timestamp of date limit of retainage
|
||||
*/
|
||||
public $retained_warranty_date_limit;
|
||||
|
||||
/**
|
||||
* @var int Code in llx_c_paiement
|
||||
*/
|
||||
public $retained_warranty_fk_cond_reglement;
|
||||
|
||||
/**
|
||||
* Standard invoice
|
||||
*/
|
||||
@ -471,6 +486,9 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", fk_multicurrency";
|
||||
$sql.= ", multicurrency_code";
|
||||
$sql.= ", multicurrency_tx";
|
||||
$sql.= ", retained_warranty";
|
||||
$sql.= ", retained_warranty_date_limit";
|
||||
$sql.= ", retained_warranty_fk_cond_reglement";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
@ -505,6 +523,10 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".(int) $this->fk_multicurrency;
|
||||
$sql.= ", '".$this->db->escape($this->multicurrency_code)."'";
|
||||
$sql.= ", ".(double) $this->multicurrency_tx;
|
||||
$sql.= ", ".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty));
|
||||
$sql.= ", ".(!empty($this->retained_warranty_date_limit)?"'".$this->db->idate($this->retained_warranty_date_limit)."'":'NULL');
|
||||
$sql.= ", ".(int) $this->retained_warranty_fk_cond_reglement;
|
||||
|
||||
$sql.=")";
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
@ -1335,6 +1357,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
||||
$sql.= ', f.module_source, f.pos_source';
|
||||
$sql.= ", i.libelle as label_incoterms";
|
||||
$sql.= ", f.retained_warranty as retained_warranty, f.retained_warranty_date_limit as retained_warranty_date_limit, f.retained_warranty_fk_cond_reglement as retained_warranty_fk_cond_reglement";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||
@ -1404,6 +1427,10 @@ class Facture extends CommonInvoice
|
||||
$this->situation_cycle_ref = $obj->situation_cycle_ref;
|
||||
$this->situation_counter = $obj->situation_counter;
|
||||
$this->situation_final = $obj->situation_final;
|
||||
$this->retained_warranty = $obj->retained_warranty;
|
||||
$this->retained_warranty_date_limit = $this->db->jdate($obj->retained_warranty_date_limit);
|
||||
$this->retained_warranty_fk_cond_reglement = $obj->retained_warranty_fk_cond_reglement;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
//Incoterms
|
||||
@ -1651,6 +1678,8 @@ class Facture extends CommonInvoice
|
||||
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
|
||||
if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf);
|
||||
if (isset($this->import_key)) $this->import_key=trim($this->import_key);
|
||||
if (isset($this->retained_warranty)) $this->retained_warranty = floatval($this->retained_warranty);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
@ -1691,7 +1720,10 @@ class Facture extends CommonInvoice
|
||||
$sql.= " import_key=".(isset($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null").",";
|
||||
$sql.= " situation_cycle_ref=".(empty($this->situation_cycle_ref)?"null":$this->db->escape($this->situation_cycle_ref)).",";
|
||||
$sql.= " situation_counter=".(empty($this->situation_counter)?"null":$this->db->escape($this->situation_counter)).",";
|
||||
$sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final));
|
||||
$sql.= " situation_final=".(empty($this->situation_final)?"0":$this->db->escape($this->situation_final)).",";
|
||||
$sql.= " retained_warranty=".(empty($this->retained_warranty)?"0":$this->db->escape($this->retained_warranty)).",";
|
||||
$sql.= " retained_warranty_date_limit=".(strval($this->retained_warranty_date_limit)!='' ? "'".$this->db->idate($this->retained_warranty_date_limit)."'" : 'null').",";
|
||||
$sql.= " retained_warranty_fk_cond_reglement=".(isset($this->retained_warranty_fk_cond_reglement)?intval($this->retained_warranty_fk_cond_reglement):"null");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
@ -2432,13 +2464,18 @@ class Facture extends CommonInvoice
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of object directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'facture/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'facture/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->facture->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->facture->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
@ -4374,6 +4411,137 @@ class Facture extends CommonInvoice
|
||||
|
||||
return $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return number or -1 if not available
|
||||
*/
|
||||
public function getRetainedWarrantyAmount()
|
||||
{
|
||||
if(empty($this->retained_warranty) ){
|
||||
return -1;
|
||||
}
|
||||
|
||||
$retainedWarrantyAmount = 0;
|
||||
|
||||
// Billed - retained warranty
|
||||
if($this->type == Facture::TYPE_SITUATION)
|
||||
{
|
||||
$displayWarranty = true;
|
||||
// Check if this situation invoice is 100% for real
|
||||
if(!empty($this->lines)){
|
||||
foreach($this->lines as $i => $line){
|
||||
if($line->product_type < 2 && $line->situation_percent < 100){
|
||||
$displayWarranty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($displayWarranty && !empty($this->situation_final))
|
||||
{
|
||||
$this->fetchPreviousNextSituationInvoice();
|
||||
$TPreviousIncoice = $this->tab_previous_situation_invoice;
|
||||
|
||||
$total2BillWT = 0;
|
||||
foreach ($TPreviousIncoice as &$fac){
|
||||
$total2BillWT += $fac->total_ttc;
|
||||
}
|
||||
$total2BillWT += $this->total_ttc;
|
||||
|
||||
$retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100;
|
||||
}
|
||||
else{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Because one day retained warranty could be used on standard invoices
|
||||
$retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100;
|
||||
}
|
||||
|
||||
return $retainedWarrantyAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the retained warranty
|
||||
*
|
||||
* @param float $value value of retained warranty
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function setRetainedWarranty($value)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarranty('.$value.')');
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$fieldname = 'retained_warranty';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.floatval($value);
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->retained_warranty = floatval($value);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the retained_warranty_date_limit
|
||||
*
|
||||
* @param int $timestamp date limit of retained warranty in timestamp format
|
||||
* @param string $dateYmd date limit of retained warranty in Y m d format
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function setRetainedWarrantyDateLimit($timestamp, $dateYmd = false)
|
||||
{
|
||||
if(!$timestamp && $dateYmd){
|
||||
$timestamp = $this->db->jdate($dateYmd);
|
||||
}
|
||||
|
||||
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit('.$timestamp.')');
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
$fieldname = 'retained_warranty_date_limit';
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.(strval($timestamp)!='' ? '\'' .$this->db->idate($timestamp).'\'' : 'null' );
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->retained_warranty_date_limit = $timestamp;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -187,7 +187,8 @@ if (empty($reshook))
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->titre = GETPOST('titre', 'alpha'); // deprecated
|
||||
$object->title = GETPOST('titre', 'alpha');
|
||||
$object->note_private = GETPOST('note_private', 'none');
|
||||
$object->note_public = GETPOST('note_public', 'none');
|
||||
$object->modelpdf = GETPOST('modelpdf', 'alpha');
|
||||
@ -295,8 +296,9 @@ if (empty($reshook))
|
||||
$result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY');
|
||||
if ($result > 0)
|
||||
{
|
||||
$object->titre = GETPOST('ref', 'alpha');
|
||||
$object->ref = $object->titre;
|
||||
$object->titre = GETPOST('ref', 'alpha'); // deprecated
|
||||
$object->title = GETPOST('ref', 'alpha');
|
||||
$object->ref = $object->title;
|
||||
}
|
||||
else dol_print_error($db, $object->error, $object->errors);
|
||||
}
|
||||
@ -774,7 +776,7 @@ if (empty($reshook))
|
||||
$array_options = $extrafieldsline->getOptionalsFromPost($object->table_element_line);
|
||||
|
||||
$objectline = new FactureLigneRec($db);
|
||||
if ($objectline->fetch(GETPOST('lineid')))
|
||||
if ($objectline->fetch(GETPOST('lineid', 'int')))
|
||||
{
|
||||
$objectline->array_options=$array_options;
|
||||
$result=$objectline->insertExtraFields();
|
||||
@ -784,6 +786,8 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
$position = ($objectline->rang >= 0 ? $objectline->rang : 0);
|
||||
|
||||
// Unset extrafield
|
||||
if (is_array($extralabelsline))
|
||||
{
|
||||
@ -795,8 +799,8 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Define special_code for special lines
|
||||
$special_code=GETPOST('special_code');
|
||||
if (! GETPOST('qty')) $special_code=3;
|
||||
$special_code=GETPOST('special_code', 'int');
|
||||
if (! GETPOST('qty', 'alpha')) $special_code=3;
|
||||
|
||||
/*$line = new FactureLigne($db);
|
||||
$line->fetch(GETPOST('lineid'));
|
||||
@ -832,11 +836,11 @@ if (empty($reshook))
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
$type = GETPOST('type', 'int');
|
||||
$label = (GETPOST('product_label') ? GETPOST('product_label') : '');
|
||||
|
||||
// Check parameters
|
||||
if (GETPOST('type') < 0) {
|
||||
if (GETPOST('type', 'int') < 0) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
|
||||
$error ++;
|
||||
}
|
||||
@ -868,7 +872,7 @@ if (empty($reshook))
|
||||
0,
|
||||
0,
|
||||
$type,
|
||||
0,
|
||||
$position,
|
||||
$special_code,
|
||||
$label,
|
||||
GETPOST('units'),
|
||||
|
||||
@ -213,7 +213,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
|
||||
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
|
||||
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
|
||||
$sql.= " f.datec, f.tms,";
|
||||
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
|
||||
@ -514,7 +514,7 @@ if ($resql)
|
||||
$invoicerectmp->unit_frequency=$objp->unit_frequency;
|
||||
$invoicerectmp->nb_gen_max=$objp->nb_gen_max;
|
||||
$invoicerectmp->nb_gen_done=$objp->nb_gen_done;
|
||||
$invoicerectmp->ref=$objp->titre;
|
||||
$invoicerectmp->ref=$objp->title;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
|
||||
@ -182,6 +182,12 @@ $arrayfields=array(
|
||||
'f.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'f.fk_statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
);
|
||||
|
||||
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
||||
{
|
||||
$arrayfields['f.retained_warranty'] = array('label'=>$langs->trans("RetainedWarranty"), 'checked'=>0);
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -373,6 +379,10 @@ $sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
|
||||
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
|
||||
$sql.= ' f.paye as paye, f.fk_statut,';
|
||||
$sql.= ' f.datec as date_creation, f.tms as date_update,';
|
||||
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
||||
{
|
||||
$sql.= ' f.retained_warranty, f.retained_warranty_date_limit, f.situation_final,f.situation_cycle_ref,f.situation_counter,';
|
||||
}
|
||||
$sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,';
|
||||
$sql.= " typent.code as typent_code,";
|
||||
$sql.= " state.code_departement as state_code, state.nom as state_name,";
|
||||
@ -834,6 +844,13 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="4" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).'">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if(! empty($arrayfields['f.retained_warranty']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre right">';
|
||||
@ -899,6 +916,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['f.total_localtax1']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax1']['label'], $_SERVER['PHP_SELF'], 'f.localtax1', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.total_localtax2']['checked'])) print_liste_field_titre($arrayfields['f.total_localtax2']['label'], $_SERVER['PHP_SELF'], 'f.localtax2', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.total_ttc']['checked'])) print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], 'f.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['f.retained_warranty']['checked'])) print_liste_field_titre($arrayfields['f.retained_warranty']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['dynamount_payed']['checked'])) print_liste_field_titre($arrayfields['dynamount_payed']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['rtp']['checked'])) print_liste_field_titre($arrayfields['rtp']['label'], $_SERVER['PHP_SELF'], '', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
// Extra fields
|
||||
@ -939,7 +957,15 @@ if ($resql)
|
||||
$facturestatic->date_lim_reglement=$db->jdate($obj->datelimite);
|
||||
$facturestatic->note_public=$obj->note_public;
|
||||
$facturestatic->note_private=$obj->note_private;
|
||||
|
||||
if($conf->global->INVOICE_USE_SITUATION && $conf->global->INVOICE_USE_SITUATION_RETAINED_WARRANTY)
|
||||
{
|
||||
$facturestatic->retained_warranty=$obj->retained_warranty;
|
||||
$facturestatic->retained_warranty_date_limit=$obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final=$obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_final=$obj->retained_warranty_date_limit;
|
||||
$facturestatic->situation_cycle_ref=$obj->situation_cycle_ref;
|
||||
$facturestatic->situation_counter=$obj->situation_counter;
|
||||
}
|
||||
$thirdpartystatic->id=$obj->socid;
|
||||
$thirdpartystatic->name=$obj->name;
|
||||
$thirdpartystatic->client=$obj->client;
|
||||
@ -1181,6 +1207,11 @@ if ($resql)
|
||||
$totalarray['totalttc'] += $obj->total_ttc;
|
||||
}
|
||||
|
||||
if(! empty($arrayfields['f.retained_warranty']['checked']))
|
||||
{
|
||||
print '<td align="right">'.(! empty($obj->retained_warranty)?price($obj->retained_warranty).'%':' ').'</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['dynamount_payed']['checked']))
|
||||
{
|
||||
print '<td class="right nowrap">'.(! empty($totalpay)?price($totalpay, 0, $langs):' ').'</td>'; // TODO Use a denormalized field
|
||||
|
||||
@ -38,7 +38,7 @@ $linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc');
|
||||
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
|
||||
|
||||
$total=0; $ilink=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
|
||||
@ -412,8 +412,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<td class="left">';
|
||||
print $thirdpartystatic->getNomUrl(1, 'customer', 44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="nowrap right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
@ -512,7 +512,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
print $thirdpartystatic->getNomUrl(1, 'supplier', 44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->tms), 'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
@ -593,7 +593,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$label.'</td>';
|
||||
print '<td class="right">'.price($objp->amount).'</td>';
|
||||
print '<td class="nowrap right">'.price($objp->amount).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($objp->dm), 'day').'</td>';
|
||||
print '<td>'.$donationstatic->LibStatut($objp->fk_statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
@ -664,8 +664,8 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->date_ech), 'day').'</td>';
|
||||
print '<td class="right">'.price($obj->amount).'</td>';
|
||||
print '<td class="right">'.price($obj->sumpaid).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->amount).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->sumpaid).'</td>';
|
||||
print '<td align="center">'.$chargestatic->getLibStatut(3).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ttc+=$obj->amount;
|
||||
@ -673,7 +673,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
}
|
||||
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="right">'.price($tot_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($tot_ttc).'</td>';
|
||||
print '<td class="right"></td>';
|
||||
print '<td class="right"> </td>';
|
||||
print '</tr>';
|
||||
@ -786,8 +786,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
print $societestatic->getNomUrl(1, 'customer', 44);
|
||||
print '</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc-$obj->tot_fttc).'</td>';
|
||||
print '<td>'.$commandestatic->LibStatut($obj->fk_statut, $obj->facture, 3).'</td>';
|
||||
print '</tr>';
|
||||
$tot_ht += $obj->total_ht;
|
||||
@ -799,8 +799,8 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
|
||||
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($tot_ht).'</td>';
|
||||
print '<td class="right">'.price($tot_ttc).'</td>';
|
||||
print '<td class="right">'.price($tot_tobill).'</td>';
|
||||
print '<td class="nowrap right">'.price($tot_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($tot_tobill).'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
print '</table></div><br>';
|
||||
@ -911,8 +911,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.price($obj->am).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3, $obj->am).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -926,8 +926,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToTake").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td> </td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($total).'</td>';
|
||||
print '<td class="right">'.price($total_ttc).'</td>';
|
||||
print '<td class="right">'.price($totalam).'</td>';
|
||||
print '<td class="nowrap right">'.price($total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($totalam).'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
@ -1023,8 +1023,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
print '<td>'.$societestatic->getNomUrl(1, 'supplier', 44).'</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->date_lim_reglement), 'day').'</td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td class="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="right">'.price($obj->am).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($obj->am).'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye, $obj->fk_statut, 3).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
@ -1036,8 +1036,8 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' <font style="font-weight: normal">('.$langs->trans("RemainderToPay").': '.price($total_ttc-$totalam).')</font> </td>';
|
||||
print '<td> </td>';
|
||||
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td class="right">'.price($total).'</td>';
|
||||
print '<td class="right">'.price($total_ttc).'</td>';
|
||||
print '<td class="right">'.price($totalam).'</td>';
|
||||
print '<td class="nowrap right">'.price($total_ttc).'</td>';
|
||||
print '<td class="nowrap right">'.price($totalam).'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end
|
||||
$date_start=dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end=dol_get_last_day($pastmonthyear, $pastmonth, false);
|
||||
}
|
||||
|
||||
$nom=$langs->trans("SellsJournal");
|
||||
$name=$langs->trans("SellsJournal");
|
||||
$periodlink='';
|
||||
$exportlink='';
|
||||
$builddate=dol_now();
|
||||
|
||||
@ -63,78 +63,86 @@ $object = new BonPrelevement($db, "");
|
||||
// Load object
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||
|
||||
$hookmanager->initHooks(array('directdebitprevcard','globalcard'));
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ( $action == 'confirm_delete' )
|
||||
$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))
|
||||
{
|
||||
$res=$object->delete($user);
|
||||
if ($res > 0)
|
||||
if ( $action == 'confirm_delete' )
|
||||
{
|
||||
$res=$object->delete($user);
|
||||
if ($res > 0)
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Seems to no be used and replaced with $action == 'infocredit'
|
||||
if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
|
||||
{
|
||||
$res=$object->set_credite();
|
||||
if ($res >= 0)
|
||||
{
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
/*
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||
{
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||
{
|
||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
}
|
||||
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Fichier invalide",LOG_WARNING);
|
||||
$mesg='BadFile';
|
||||
}*/
|
||||
|
||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
|
||||
|
||||
if ($error)
|
||||
{
|
||||
header("Location: card.php?id=".$id."&error=$error");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set direct debit order to credited, create payment and close invoices
|
||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
{
|
||||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
// Seems to no be used and replaced with $action == 'infocredit
|
||||
if ( $action == 'confirm_credite' && GETPOST('confirm', 'alpha') == 'yes')
|
||||
{
|
||||
$res=$object->set_credite();
|
||||
if ($res >= 0)
|
||||
{
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$error = $object->set_infocredit($user, $dt);
|
||||
|
||||
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
/*
|
||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||
{
|
||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||
|
||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||
{
|
||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||
}
|
||||
|
||||
header("Location: card.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("Fichier invalide",LOG_WARNING);
|
||||
$mesg='BadFile';
|
||||
}*/
|
||||
|
||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode', 'alpha'));
|
||||
|
||||
if ($error)
|
||||
{
|
||||
header("Location: card.php?id=".$id."&error=$error");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
// Set direct debit order to credited, create payment and close invoices
|
||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||
{
|
||||
$dt = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
$error = $object->set_infocredit($user, $dt);
|
||||
|
||||
if ($error)
|
||||
{
|
||||
header("Location: card.php?id=".$id."&error=$error");
|
||||
exit;
|
||||
}
|
||||
if ($error)
|
||||
{
|
||||
header("Location: card.php?id=".$id."&error=$error");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +370,7 @@ if ($id > 0 || $ref)
|
||||
print "<td>";
|
||||
print $ligne->LibStatut($obj->statut, 2);
|
||||
print " ";
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
|
||||
print sprintf("%06s", $obj->rowid);
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
@ -1133,32 +1133,56 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Get object and lines from database
|
||||
* Get object and lines from database
|
||||
*
|
||||
* @param User $user Object user that delete
|
||||
* @return int >0 if OK, <0 if KO
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function delete($user = null)
|
||||
public function delete($user = null, $notrigger = 0)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id.")";
|
||||
$resql1=$this->db->query($sql);
|
||||
if (! $resql1) dol_print_error($this->db);
|
||||
$error = 0;
|
||||
$resql1 = $resql2 = $resql3 = $resql4 = 0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id;
|
||||
$resql2=$this->db->query($sql);
|
||||
if (! $resql2) dol_print_error($this->db);
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BON_PRELEVEMENT_DELETE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".$this->id;
|
||||
$resql3=$this->db->query($sql);
|
||||
if (! $resql3) dol_print_error($this->db);
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id.")";
|
||||
$resql1=$this->db->query($sql);
|
||||
if (! $resql1) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".$this->id;
|
||||
$resql4=$this->db->query($sql);
|
||||
if (! $resql4) dol_print_error($this->db);
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id;
|
||||
$resql2=$this->db->query($sql);
|
||||
if (! $resql2) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
if ($resql1 && $resql2 && $resql3)
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".$this->id;
|
||||
$resql3=$this->db->query($sql);
|
||||
if (! $resql3) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".$this->id;
|
||||
$resql4=$this->db->query($sql);
|
||||
if (! $resql4) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
if ($resql1 && $resql2 && $resql3 && $resql4 && ! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
@ -1393,7 +1417,7 @@ class BonPrelevement extends CommonObject
|
||||
|
||||
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
|
||||
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
|
||||
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum";
|
||||
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
|
||||
$sql.= " FROM";
|
||||
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
|
||||
@ -1419,7 +1443,8 @@ class BonPrelevement extends CommonObject
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum, $obj->rum);
|
||||
$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
|
||||
$fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum);
|
||||
$this->total = $this->total + $obj->somme;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -203,7 +203,7 @@ if ($resql)
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
|
||||
print img_picto('', 'statut'.$obj->statut).' ';
|
||||
print substr('000000'.$obj->rowid, -6);
|
||||
print '</a></td>';
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/prelevement/ligne.php
|
||||
* \file htdocs/compta/prelevement/line.php
|
||||
* \ingroup prelevement
|
||||
* \brief card of withdraw line
|
||||
*/
|
||||
@ -86,7 +86,7 @@ if ($action == 'confirm_rejet')
|
||||
|
||||
$rej->create($user, $id, GETPOST('motif', 'alpha'), $daterej, $lipre->bon_rowid, GETPOST('facturer', 'int'));
|
||||
|
||||
header("Location: ligne.php?id=".$id);
|
||||
header("Location: line.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -97,7 +97,7 @@ if ($action == 'confirm_rejet')
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ligne.php?id=".$id);
|
||||
header("Location: line.php?id=".$id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@ -112,7 +112,7 @@ $invoicestatic=new Facture($db);
|
||||
llxHeader('', $langs->trans("StandingOrder"));
|
||||
|
||||
$h = 0;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$id;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$hselected = $h;
|
||||
$h++;
|
||||
@ -179,7 +179,7 @@ if ($id)
|
||||
|
||||
$rej = new RejetPrelevement($db, $user);
|
||||
|
||||
print '<form name="confirm_rejet" method="post" action="ligne.php?id='.$id.'">';
|
||||
print '<form name="confirm_rejet" method="post" action="line.php?id='.$id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="confirm_rejet">';
|
||||
print '<table class="border" width="100%">';
|
||||
@ -231,7 +231,7 @@ if ($id)
|
||||
{
|
||||
if ($user->rights->prelevement->bons->credit)
|
||||
{
|
||||
print "<a class=\"butAction\" href=\"ligne.php?action=rejet&id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
|
||||
print "<a class=\"butAction\" href=\"line.php?action=rejet&id=$lipre->id\">".$langs->trans("StandingOrderReject")."</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -172,7 +172,7 @@ if ($result)
|
||||
print $ligne->LibStatut($obj->statut_ligne, 2);
|
||||
print " ";
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid_ligne.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid_ligne.'">';
|
||||
print substr('000000'.$obj->rowid_ligne, -6);
|
||||
print '</a></td>';
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ if ($result)
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $ligne->LibStatut($obj->statut, 2).' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/ligne.php?id='.$obj->rowid.'">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/prelevement/line.php?id='.$obj->rowid.'">';
|
||||
|
||||
print substr('000000'.$obj->rowid, -6)."</a></td>";
|
||||
|
||||
|
||||
@ -773,7 +773,7 @@ else
|
||||
|
||||
print '<tr class="oddeven"><td> </td>';
|
||||
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/compta/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
print "<td>".$langs->trans("Salary")." <a href=\"".DOL_URL_ROOT."/salaries/list.php?filtre=s.fk_user=".$obj->fk_user."\">".$obj->firstname." ".$obj->lastname."</a></td>\n";
|
||||
|
||||
if ($modecompta == 'CREANCES-DETTES') print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
print '<td class="right">'.price(-$obj->amount).'</td>';
|
||||
|
||||
@ -655,7 +655,7 @@ if ($id > 0)
|
||||
else
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td class="opacitymedium">'.$langs->trans("None").'</td>';
|
||||
print '<tr class="oddeven"><td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
|
||||
print '<td></td><td></td><td></td><td></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -187,7 +187,7 @@ if ($resql)
|
||||
|
||||
if ($year)
|
||||
{
|
||||
$center=($year?"<a href='index.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='index.php?year=".($year+1)."'>".img_next()."</a>":"");
|
||||
$center=($year?"<a href='list.php?year=".($year-1)."'>".img_previous()."</a> ".$langs->trans("Year")." $year <a href='list.php?year=".($year+1)."'>".img_next()."</a>":"");
|
||||
print_barre_liste($langs->trans("SocialContributions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy.png', 0, $newcardbutton, '', $limit);
|
||||
}
|
||||
else
|
||||
@ -281,7 +281,7 @@ if ($resql)
|
||||
print '<td align="center">';
|
||||
if ($obj->periode)
|
||||
{
|
||||
print '<a href="index.php?year='.strftime("%Y", $db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').'</a>';
|
||||
print '<a href="list.php?year='.strftime("%Y",$db->jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode),'day').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@ require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
@ -90,7 +90,7 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
||||
|
||||
if ($mode != 'sconly')
|
||||
{
|
||||
$center=($year?'<a href="index.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="index.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
|
||||
$center=($year?'<a href="list.php?year='.($year-1).$param.'">'.img_previous($langs->trans("Previous"), 'class="valignbottom"')."</a> ".$langs->trans("Year").' '.$year.' <a href="list.php?year='.($year+1).$param.'">'.img_next($langs->trans("Next"), 'class="valignbottom"')."</a>":"");
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1);
|
||||
}
|
||||
else
|
||||
@ -181,7 +181,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
|
||||
print $socialcontrib->getNomUrl(1, '20');
|
||||
print '</td>';
|
||||
// Type
|
||||
print '<td><a href="../sociales/index.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||
print '<td><a href="../sociales/list.php?filtre=cs.fk_type:'.$obj->type.'">'.$obj->lib.'</a></td>';
|
||||
// Date
|
||||
$date=$obj->periode;
|
||||
if (empty($date)) $date=$obj->date_ech;
|
||||
|
||||
@ -179,7 +179,7 @@ if (empty($reshook))
|
||||
$object->socid = GETPOST("socid", 'int');
|
||||
$object->lastname = GETPOST("lastname", 'alpha');
|
||||
$object->firstname = GETPOST("firstname", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->civility_id = GETPOST("civility_id", 'alpha');
|
||||
$object->poste = GETPOST("poste", 'alpha');
|
||||
$object->address = GETPOST("address", 'alpha');
|
||||
$object->zip = GETPOST("zipcode", 'alpha');
|
||||
@ -573,7 +573,7 @@ else
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(GETPOST("civility_id", 'alpha')?GETPOST("civility_id", 'alpha'):$object->civility_id);
|
||||
print $formcompany->select_civility(GETPOST("civility", 'alpha')?GETPOST("civility", 'alpha'):$object->civility_code);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
@ -872,7 +872,7 @@ else
|
||||
|
||||
// Civility
|
||||
print '<tr><td><label for="civility_id">'.$langs->trans("UserTitle").'</label></td><td colspan="3">';
|
||||
print $formcompany->select_civility(isset($_POST["civility_id"])?GETPOST("civility_id"):$object->civility_id);
|
||||
print $formcompany->select_civility(isset($_POST["civility"])?GETPOST("civility"):$object->civility_code);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td><label for="title">'.$langs->trans("PostOrFunction").'</label></td>';
|
||||
|
||||
@ -1219,7 +1219,7 @@ class Contact extends CommonObject
|
||||
global $langs;
|
||||
$langs->load("dict");
|
||||
|
||||
$code=(! empty($this->civility_id)?$this->civility_id:(! empty($this->civilite_id)?$this->civilite_id:''));
|
||||
$code=(! empty($this->civility_id)?$this->civility:(! empty($this->civilite)?$this->civilite:''));
|
||||
if (empty($code)) return '';
|
||||
return $langs->getLabelFromKey($this->db, "Civility".$code, "c_civility", "code", "label", $code);
|
||||
}
|
||||
|
||||
261
htdocs/contrat/agenda.php
Normal file
261
htdocs/contrat/agenda.php
Normal file
@ -0,0 +1,261 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/agenda.php
|
||||
* \ingroup contrat
|
||||
* \brief Page of contract events
|
||||
*/
|
||||
|
||||
require "../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "contracts"));
|
||||
|
||||
if (GETPOST('actioncode', 'array'))
|
||||
{
|
||||
$actioncode=GETPOST('actioncode', 'array', 3);
|
||||
if (! count($actioncode)) $actioncode='0';
|
||||
}
|
||||
else
|
||||
{
|
||||
$actioncode=GETPOST("actioncode", "alpha", 3)?GETPOST("actioncode", "alpha", 3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
|
||||
}
|
||||
$search_agenda_label=GETPOST('search_agenda_label');
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat', $id, '');
|
||||
|
||||
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST("page", 'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortfield) $sortfield='a.datep,a.id';
|
||||
if (! $sortorder) $sortorder='DESC,DESC';
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('agendacontract','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$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))
|
||||
{
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
// 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
|
||||
{
|
||||
$actioncode='';
|
||||
$search_agenda_label='';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db);
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
// Load object modContract
|
||||
$module=(! empty($conf->global->CONTRACT_ADDON)?$conf->global->CONTRACT_ADDON:'mod_contract_serpis');
|
||||
if (substr($module, 0, 13) == 'mod_contract_' && substr($module, -3) == 'php')
|
||||
{
|
||||
$module = substr($module, 0, dol_strlen($module)-4);
|
||||
}
|
||||
$result=dol_include_once('/core/modules/contract/'.$module.'.php');
|
||||
if ($result > 0)
|
||||
{
|
||||
$modCodeContract = new $module();
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
|
||||
$object = new Contrat($db);
|
||||
$result = $object->fetch($id);
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$title=$langs->trans("Agenda");
|
||||
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) $title=$object->ref." - ".$title;
|
||||
llxHeader('', $title);
|
||||
|
||||
if (! empty($conf->notification->enabled)) $langs->load("mails");
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'agenda', $langs->trans("Contract"), -1, 'contract');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='';
|
||||
if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
} else {
|
||||
$morehtmlref.=$form->editfieldkey("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 3);
|
||||
$morehtmlref.=$form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2);
|
||||
}
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$morehtmlref.=$form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef');
|
||||
// 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.'/contrat/list.php?socid='.$object->thirdparty->id.'&search_name='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherContracts").'</a>)';
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a 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="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $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->thirdparty->id, $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, 'id', $linkback, 1, 'ref', 'none', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
$object->info($id);
|
||||
dol_print_object_info($object, 1);
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
|
||||
// Actions buttons
|
||||
|
||||
/*$objthirdparty=$object;
|
||||
$objcon=new stdClass();
|
||||
|
||||
$out='';
|
||||
$permok=$user->rights->agenda->myactions->create;
|
||||
if ((! empty($objthirdparty->id) || ! empty($objcon->id)) && $permok)
|
||||
{
|
||||
//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
|
||||
if (get_class($objthirdparty) == 'Societe') $out.='&socid='.$objthirdparty->id;
|
||||
$out.=(! empty($objcon->id)?'&contactid='.$objcon->id:'').'&backtopage=1&percentage=-1';
|
||||
//$out.=$langs->trans("AddAnAction").' ';
|
||||
//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
|
||||
//$out.="</a>";
|
||||
}*/
|
||||
|
||||
|
||||
//print '<div class="tabsAction">';
|
||||
//print '</div>';
|
||||
|
||||
|
||||
$newcardbutton='';
|
||||
if (! empty($conf->agenda->enabled))
|
||||
{
|
||||
if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create))
|
||||
{
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
$param='&id='.$id;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
|
||||
print load_fiche_titre($langs->trans("ActionsOnContract"), $newcardbutton, '');
|
||||
//print_barre_liste($langs->trans("ActionsOnCompany"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $newcardbutton, '', 0, 1, 1);
|
||||
|
||||
// List of all actions
|
||||
$filters=array();
|
||||
$filters['search_agenda_label']=$search_agenda_label;
|
||||
|
||||
// TODO Replace this with same code than into list.php
|
||||
show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
|
||||
}
|
||||
}
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -2209,10 +2209,14 @@ else
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
$MAXEVENT = 10;
|
||||
|
||||
$morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt', DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id);
|
||||
|
||||
// List of actions on element
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
|
||||
$formactions = new FormActions($db);
|
||||
$somethingshown = $formactions->showactions($object, 'contract', $socid, 1);
|
||||
$somethingshown = $formactions->showactions($object, 'contract', $socid, 1, 'listactions', $MAXEVENT, '', $morehtmlright);
|
||||
|
||||
|
||||
print '</div></div></div>';
|
||||
@ -2237,14 +2241,18 @@ $db->close();
|
||||
<?php
|
||||
if (! empty($conf->margin->enabled) && $action == 'editline')
|
||||
{
|
||||
// TODO Why this ? To manage margin on contracts ?
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
var idprod = $("input[name='idprod']").val();
|
||||
var fournprice = $("input[name='fournprice']").val();
|
||||
var token = '<?php echo $_SESSION["token"]; ?>'; // For AJAX Call we use old 'token' and not 'newtoken'
|
||||
if (idprod > 0) {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {'idprod': idprod}, function(data) {
|
||||
$.post('<?php echo DOL_URL_ROOT; ?>/fourn/ajax/getSupplierPrices.php', {
|
||||
'idprod': idprod,
|
||||
'token': token
|
||||
}, function(data) {
|
||||
if (data.length > 0) {
|
||||
var options = '';
|
||||
var trouve=false;
|
||||
@ -2289,6 +2297,5 @@ $(document).ready(function() {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
@ -486,13 +486,18 @@ class Contrat extends CommonObject
|
||||
// Rename directory if dir was a temporary ref
|
||||
if (preg_match('/^[\(]?PROV/i', $this->ref))
|
||||
{
|
||||
// Rename of object directory ($this->ref = old ref, $num = new ref)
|
||||
// to not lose the linked files
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'contract/".$this->db->escape($this->newref)."'";
|
||||
$sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'contract/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->error = $this->db->lasterror(); }
|
||||
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->contract->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->contract->dir_output.'/'.$newref;
|
||||
if (file_exists($dirsource))
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
|
||||
@ -517,7 +517,7 @@ if ($resql)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
@ -596,7 +596,7 @@ if ($resql)
|
||||
$staticcompany->name=$obj->name;
|
||||
print $staticcompany->getNomUrl(1, '', 20);
|
||||
print '</td>';
|
||||
print '<td width="16" class="right"><a href="ligne.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print '<td width="16" class="right"><a href="line.php?id='.$obj->fk_contrat.'&ligne='.$obj->cid.'">';
|
||||
print $staticcontratligne->LibStatut($obj->statut, 3, 1);
|
||||
print '</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
@ -1,156 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/contrat/info.php
|
||||
* \ingroup contrat
|
||||
* \brief Page des informations d'un contrat
|
||||
*/
|
||||
|
||||
require "../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->load("contracts");
|
||||
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'contrat', $id, '');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('contractcard','globalcard'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('', $langs->trans("Contract"), "");
|
||||
|
||||
$object = new Contrat($db);
|
||||
$object->fetch($id, $ref);
|
||||
if ($object->id > 0)
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
}
|
||||
|
||||
$object->info($object->id);
|
||||
|
||||
$head = contract_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'info', $langs->trans("Contract"), -1, 'contract');
|
||||
|
||||
|
||||
// Contract card
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contrat/list.php?restore_lastsearch_values=1'.(! empty($socid)?'&socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
|
||||
$morehtmlref='';
|
||||
//if (! empty($modCodeContract->code_auto)) {
|
||||
$morehtmlref.=$object->ref;
|
||||
/*} else {
|
||||
$morehtmlref.=$form->editfieldkey("",'ref',$object->ref,0,'string','',0,3);
|
||||
$morehtmlref.=$form->editfieldval("",'ref',$object->ref,0,'string','',0,2);
|
||||
}*/
|
||||
|
||||
$morehtmlref.='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, 0, 'string', '', null, null, '', 1, 'getFormatedCustomerRef');
|
||||
// Ref supplier
|
||||
$morehtmlref.='<br>';
|
||||
$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, 'getFormatedSupplierRef');
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->contrat->creer)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
//$morehtmlref.='<a 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="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects($object->thirdparty->id, $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->thirdparty->id, $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', 'none', $morehtmlref);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<table width="100%"><tr><td>';
|
||||
dol_print_object_info($object);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -2053,6 +2053,43 @@ abstract class CommonObject
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the retained warranty payments terms
|
||||
*
|
||||
* @param int $id Id of new payment terms
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
public function setRetainedWarrantyPaymentTerms($id)
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms('.$id.')');
|
||||
if ($this->statut >= 0 || $this->element == 'societe')
|
||||
{
|
||||
$fieldname = 'retained_warranty_fk_cond_reglement';
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= ' SET '.$fieldname.' = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->retained_warranty_fk_cond_reglement = $id;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms Erreur '.$sql.' - '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::setRetainedWarrantyPaymentTerms, status of the object is incompatible');
|
||||
$this->error='Status of the object is incompatible '.$this->statut;
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define delivery address
|
||||
@ -6382,7 +6419,7 @@ abstract class CommonObject
|
||||
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
|
||||
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $onetrtd All fields in same tr td
|
||||
* @param string $onetrtd All fields in same tr td (TODO field not used ?)
|
||||
* @return string
|
||||
*/
|
||||
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0)
|
||||
@ -6494,10 +6531,7 @@ abstract class CommonObject
|
||||
|
||||
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.'" '.$domData.' >';
|
||||
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
||||
{
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||
}
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||
|
||||
if ($action == 'selectlines') { $colspan++; }
|
||||
|
||||
|
||||
@ -492,7 +492,10 @@ class Conf
|
||||
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
|
||||
|
||||
// By default, suppliers objects can be linked to all projects
|
||||
$this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
|
||||
if (! isset($this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)) $this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
|
||||
|
||||
// By default we enable feature to bill time spent
|
||||
if (! isset($this->global->PROJECT_BILL_TIME_SPENT)) $this->global->PROJECT_BILL_TIME_SPENT = 1;
|
||||
|
||||
// MAIN_HTML_TITLE
|
||||
if (! isset($this->global->MAIN_HTML_TITLE)) $this->global->MAIN_HTML_TITLE='noapp,thirdpartynameonly,contactnameonly,projectnameonly';
|
||||
|
||||
@ -92,6 +92,7 @@ class CUnits // extends CommonObject
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->active=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
if (isset($this->scale)) $this->scale=trim($this->scale);
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
@ -103,12 +104,14 @@ class CUnits // extends CommonObject
|
||||
$sql.= "label,";
|
||||
$sql.= "short_label,";
|
||||
$sql.= "unit_type";
|
||||
$sql.= "scale";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||
$sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->escape($this->short_label)."'").",";
|
||||
$sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($this->unit_type)."'");
|
||||
$sql.= " ".(! isset($this->scale)?'NULL':"'".$this->db->escape($this->scale)."'");
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
@ -173,6 +176,7 @@ class CUnits // extends CommonObject
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.scale,";
|
||||
$sql.= " t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_units as t";
|
||||
$sql_where=array();
|
||||
@ -196,6 +200,7 @@ class CUnits // extends CommonObject
|
||||
$this->label = $obj->label;
|
||||
$this->short_label = $obj->short_label;
|
||||
$this->unit_type = $obj->unit_type;
|
||||
$this->scale = $obj->scale;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -235,6 +240,7 @@ class CUnits // extends CommonObject
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.scale,";
|
||||
$sql.= " t.active";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_units as t';
|
||||
// Manage filter
|
||||
@ -279,6 +285,7 @@ class CUnits // extends CommonObject
|
||||
$record->label = $obj->label;
|
||||
$record->short_label = $obj->short_label;
|
||||
$record->unit_type = $obj->unit_type;
|
||||
$record->scale = $obj->scale;
|
||||
$record->active = $obj->active;
|
||||
$this->records[$record->id] = $record;
|
||||
}
|
||||
@ -312,6 +319,7 @@ class CUnits // extends CommonObject
|
||||
if (isset($this->label)) $this->libelle=trim($this->label);
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->libelle=trim($this->unit_type);
|
||||
if (isset($this->scale)) $this->scale=trim($this->scale);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
// Check parameters
|
||||
@ -323,6 +331,7 @@ class CUnits // extends CommonObject
|
||||
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " short_label=".(isset($this->short_label)?"'".$this->db->escape($this->short_label)."'":"null").",";
|
||||
$sql.= " unit_type=".(isset($this->unit_type)?"'".$this->db->escape($this->unit_type)."'":"null").",";
|
||||
$sql.= " scale=".(isset($this->scale)?"'".$this->db->escape($this->scale)."'":"null").",";
|
||||
$sql.= " active=".(isset($this->active)?$this->active:"null");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
|
||||
@ -63,11 +63,20 @@ class Events // extends CommonObject
|
||||
|
||||
public $dateevent;
|
||||
|
||||
public $ip;
|
||||
|
||||
public $user_agent;
|
||||
|
||||
/**
|
||||
* @var string description
|
||||
*/
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* @var string Prefix session obtained with method dol_getprefix()
|
||||
*/
|
||||
public $prefix_session;
|
||||
|
||||
// List of all Audit/Security events supported by triggers
|
||||
public $eventstolog=array(
|
||||
array('id'=>'USER_LOGIN', 'test'=>1),
|
||||
@ -108,6 +117,18 @@ class Events // extends CommonObject
|
||||
);
|
||||
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
/**
|
||||
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
|
||||
*/
|
||||
public $fields=array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20),
|
||||
'prefix_session'=>array('type'=>'varchar(255)', 'label'=>'PrefixSession', 'enabled'=>1, 'visible'=>-1, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
'user_agent' =>array('type'=>'varchar(255)', 'label'=>'UserAgent', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000),
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -144,7 +165,8 @@ class Events // extends CommonObject
|
||||
$sql.= "user_agent,";
|
||||
$sql.= "dateevent,";
|
||||
$sql.= "fk_user,";
|
||||
$sql.= "description";
|
||||
$sql.= "description,";
|
||||
$sql.= "prefix_session";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->db->escape($this->type)."',";
|
||||
$sql.= " ".$conf->entity.",";
|
||||
@ -152,7 +174,8 @@ class Events // extends CommonObject
|
||||
$sql.= " ".($this->user_agent ? "'".$this->db->escape(dol_trunc($this->user_agent, 250))."'" : 'NULL').",";
|
||||
$sql.= " '".$this->db->idate($this->dateevent)."',";
|
||||
$sql.= " ".($user->id?"'".$this->db->escape($user->id)."'":'NULL').",";
|
||||
$sql.= " '".$this->db->escape(dol_trunc($this->description, 250))."'";
|
||||
$sql.= " '".$this->db->escape(dol_trunc($this->description, 250))."',";
|
||||
$sql.= " '".$this->db->escape(dol_getprefix())."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -222,7 +245,8 @@ class Events // extends CommonObject
|
||||
$sql.= " t.dateevent,";
|
||||
$sql.= " t.description,";
|
||||
$sql.= " t.ip,";
|
||||
$sql.= " t.user_agent";
|
||||
$sql.= " t.user_agent,";
|
||||
$sql.= " t.prefix_session";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."events as t";
|
||||
$sql.= " WHERE t.rowid = ".$id;
|
||||
|
||||
@ -242,6 +266,7 @@ class Events // extends CommonObject
|
||||
$this->description = $obj->description;
|
||||
$this->ip = $obj->ip;
|
||||
$this->user_agent = $obj->user_agent;
|
||||
$this->prefix_session = $obj->prefix_session;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -293,5 +318,8 @@ class Events // extends CommonObject
|
||||
$this->type='';
|
||||
$this->dateevent=time();
|
||||
$this->description='This is a specimen event';
|
||||
$this->ip = '1.2.3.4';
|
||||
$this->user_agent = 'Mozilla specimen User Agent X.Y';
|
||||
$this->prefix_session = dol_getprefix();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1411,7 +1411,7 @@ class ExtraFields
|
||||
// current object id can be use into filter
|
||||
if (strpos($InfoFieldList[4], '$ID$') !== false && !empty($objectid)) {
|
||||
$InfoFieldList[4] = str_replace('$ID$', $objectid, $InfoFieldList[4]);
|
||||
} elseif (preg_match("#^.*list.php$#", $_SERVER["DOCUMENT_URI"])) {
|
||||
} elseif (preg_match("#^.*list.php$#", $_SERVER["PHP_SELF"])) {
|
||||
// Pattern for word=$ID$
|
||||
$word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$';
|
||||
|
||||
@ -1445,13 +1445,13 @@ class ExtraFields
|
||||
$InfoFieldList[4] = str_replace('$ID$', '0', $InfoFieldList[4]);
|
||||
} else {
|
||||
if (!empty($matchCondition[1])) {
|
||||
$boolCond = (($matchCondition[1] == "AND") ? ' AND 1 ' : ' OR 0 ');
|
||||
$boolCond = (($matchCondition[1] == "AND") ? ' AND TRUE ' : ' OR FALSE ');
|
||||
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond . $matchCondition[3], $InfoFieldList[4]);
|
||||
} elseif (!empty($matchCondition[3])) {
|
||||
$boolCond = (($matchCondition[3] == "AND") ? ' 1 AND ' : ' 0 OR');
|
||||
$boolCond = (($matchCondition[3] == "AND") ? ' TRUE AND ' : ' FALSE OR');
|
||||
$InfoFieldList[4] = str_replace($matchCondition[0], $boolCond, $InfoFieldList[4]);
|
||||
} else {
|
||||
$InfoFieldList[4] = 1;
|
||||
$InfoFieldList[4] = " TRUE ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1679,7 +1679,7 @@ class Form
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100imp '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
if ($show_empty && !$multiple) $out.= '<option value="-1"'.((empty($selected) || in_array(-1, $selected))?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.((in_array(-2, $selected))?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
@ -6618,7 +6618,7 @@ class Form
|
||||
|
||||
print '</table>';
|
||||
|
||||
if(!empty($compatibleImportElementsList))
|
||||
if (!empty($compatibleImportElementsList))
|
||||
{
|
||||
$res=@include dol_buildpath('core/tpl/ajax/objectlinked_lineimport.tpl.php');
|
||||
}
|
||||
@ -6672,7 +6672,8 @@ class Form
|
||||
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),
|
||||
'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'),
|
||||
'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande_fournisseur').')'),
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')')
|
||||
'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture_fourn').')'),
|
||||
'ticket'=>array('enabled'=>$conf->ticket->enabled , 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('ticket').')')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ class FormCompany
|
||||
/**
|
||||
* Return combo list with people title
|
||||
*
|
||||
* @param string $selected Title preselected
|
||||
* @param string $selected Civility/Title code preselected
|
||||
* @param string $htmlname Name of HTML select combo field
|
||||
* @param string $morecss Add more css on SELECT element
|
||||
* @return string String with HTML select
|
||||
|
||||
@ -130,15 +130,35 @@ class FormFile
|
||||
|
||||
$out .= '<td class="valignmiddle nowrap">';
|
||||
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // En Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // En inconnu
|
||||
$max=$conf->global->MAIN_UPLOAD_DOC; // In Kb
|
||||
$maxphp=@ini_get('upload_max_filesize'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp)) $maxphp=$maxphp*1;
|
||||
if (preg_match('/m$/i', $maxphp)) $maxphp=$maxphp*1024;
|
||||
if (preg_match('/g$/i', $maxphp)) $maxphp=$maxphp*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp)) $maxphp=$maxphp*1024*1024*1024;
|
||||
// Now $max and $maxphp are in Kb
|
||||
$maxphp2=@ini_get('post_max_size'); // In unknown
|
||||
if (preg_match('/k$/i', $maxphp2)) $maxphp2=$maxphp2*1;
|
||||
if (preg_match('/m$/i', $maxphp2)) $maxphp2=$maxphp2*1024;
|
||||
if (preg_match('/g$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024;
|
||||
if (preg_match('/t$/i', $maxphp2)) $maxphp2=$maxphp2*1024*1024*1024;
|
||||
// Now $max and $maxphp and $maxphp2 are in Kb
|
||||
$maxmin = $max;
|
||||
if ($maxphp > 0) $maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphptoshowparam = '';
|
||||
if ($maxphp > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp);
|
||||
$maxphptoshow = $maxphp;
|
||||
$maxphptoshowparam = 'upload_max_filesize';
|
||||
}
|
||||
if ($maxphp2 > 0)
|
||||
{
|
||||
$maxmin=min($max, $maxphp2);
|
||||
if ($maxphp2 < $maxphp)
|
||||
{
|
||||
$maxphptoshow = $maxphp2;
|
||||
$maxphptoshowparam = 'post_max_size';
|
||||
}
|
||||
}
|
||||
|
||||
if ($maxmin > 0)
|
||||
{
|
||||
@ -168,7 +188,7 @@ class FormFile
|
||||
{
|
||||
$langs->load('other');
|
||||
$out .= ' ';
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphp), 1);
|
||||
$out .= info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -60,7 +60,7 @@ class FormProjets
|
||||
* @param int $maxlength Maximum length of label
|
||||
* @param int $option_only Return only html options lines without the select tag
|
||||
* @param int $show_empty Add an empty line
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable)
|
||||
* @param int $discard_closed Discard closed projects (0=Keep, 1=hide completely, 2=Disable). Use a negative value to not show the "discarded" tooltip.
|
||||
* @param int $forcefocus Force focus on field (works with javascript only)
|
||||
* @param int $disabled Disabled
|
||||
* @param int $mode 0 for HTML mode and 1 for JSON mode
|
||||
@ -100,13 +100,13 @@ class FormProjets
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss);
|
||||
$out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, abs($discard_closed), $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid, $morecss);
|
||||
}
|
||||
if ($discard_closed)
|
||||
if ($discard_closed > 0)
|
||||
{
|
||||
if (class_exists('Form'))
|
||||
{
|
||||
if (empty($form)) $form=new Form($this->db);
|
||||
if (! is_object($form)) $form=new Form($this->db);
|
||||
$out.=$form->textwithpicto('', $langs->trans("ClosedProjectsAreHidden"));
|
||||
}
|
||||
}
|
||||
@ -367,7 +367,7 @@ class FormProjets
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out.=$comboenhancement;
|
||||
$morecss='minwidth200 maxwidth500';
|
||||
$morecss='minwidth200imp maxwidth500';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
|
||||
@ -733,40 +733,97 @@ class FormTicket
|
||||
print ajax_combobox('select'.$htmlname);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Clear list of attached files in send mail form (also stored in session)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clear_attached_files()
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$user;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
// Set tmp user directory
|
||||
$vardir=$conf->user->dir_output."/".$user->id;
|
||||
$upload_dir = $vardir.'/temp/'; // TODO Add $keytoavoidconflict in upload_dir path
|
||||
if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir);
|
||||
|
||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||
unset($_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
unset($_SESSION["listofnames".$keytoavoidconflict]);
|
||||
unset($_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form to add message on ticket
|
||||
*
|
||||
* @param string $width Width of form
|
||||
* @return void
|
||||
* @param string $width Width of form
|
||||
* @return void
|
||||
*/
|
||||
public function showMessageForm($width = '40%')
|
||||
{
|
||||
global $conf, $langs, $user, $mysoc;
|
||||
global $conf, $langs, $user, $hookmanager, $form, $mysoc;
|
||||
|
||||
$formmail = new FormMail($this->db);
|
||||
$addfileaction = 'addfile';
|
||||
|
||||
if (! is_object($form)) $form=new Form($this->db);
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('other', 'mails'));
|
||||
|
||||
$addfileaction = 'addfile';
|
||||
// Clear temp files. Must be done at beginning, before call of triggers
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
|
||||
{
|
||||
$this->clear_attached_files();
|
||||
}
|
||||
|
||||
$form = new Form($this->db);
|
||||
$formmail = new FormMail($this->db);
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('other');
|
||||
}
|
||||
|
||||
// Get message template for $this->param["models"] into c_email_templates
|
||||
$arraydefaultmessage = -1;
|
||||
if ($this->param['models'] != 'none')
|
||||
{
|
||||
$model_id=0;
|
||||
if (array_key_exists('models_id', $this->param))
|
||||
{
|
||||
$model_id=$this->param["models_id"];
|
||||
}
|
||||
|
||||
$arraydefaultmessage=$formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); // If $model_id is empty, preselect the first one
|
||||
}
|
||||
|
||||
// Define list of attached files
|
||||
$listofpaths = array();
|
||||
$listofnames = array();
|
||||
$listofmimes = array();
|
||||
if (!empty($_SESSION["listofpaths"])) {
|
||||
$listofpaths = explode(';', $_SESSION["listofpaths"]);
|
||||
$keytoavoidconflict = empty($this->trackid)?'':'-'.$this->trackid; // this->trackid must be defined
|
||||
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1'))
|
||||
{
|
||||
if (! empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit']))
|
||||
{
|
||||
foreach($this->param['fileinit'] as $file)
|
||||
{
|
||||
$this->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_SESSION["listofnames"])) {
|
||||
$listofnames = explode(';', $_SESSION["listofnames"]);
|
||||
}
|
||||
|
||||
if (!empty($_SESSION["listofmimes"])) {
|
||||
$listofmimes = explode(';', $_SESSION["listofmimes"]);
|
||||
}
|
||||
if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@ -808,6 +865,7 @@ class FormTicket
|
||||
print '<form method="post" name="ticket" enctype="multipart/form-data" action="' . $this->param["returnurl"] . '">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="' . $this->action . '">';
|
||||
print '<input type="hidden" name="actionbis" value="add_message">';
|
||||
foreach ($this->param as $key => $value) {
|
||||
print '<input type="hidden" name="' . $key . '" value="' . $value . '">';
|
||||
}
|
||||
@ -1000,7 +1058,7 @@ class FormTicket
|
||||
$out .= '<div id="attachfile_' . $key . '">';
|
||||
$out .= img_mime($listofnames[$key]) . ' ' . $listofnames[$key];
|
||||
if (!$this->withfilereadonly) {
|
||||
$out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />';
|
||||
$out .= ' <input type="image" style="border: 0px;" src="' . DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/delete.png" value="' . ($key + 1) . '" class="removedfile reposition" id="removedfile_' . $key . '" name="removedfile_' . $key . '" />';
|
||||
}
|
||||
$out .= '<br></div>';
|
||||
}
|
||||
|
||||
@ -422,7 +422,8 @@ class Menubase
|
||||
$this->position='';
|
||||
$this->url='http://dummy';
|
||||
$this->target='';
|
||||
$this->titre='Specimen menu';
|
||||
$this->titre='Specimen menu'; // deprecated
|
||||
$this->title='Specimen menu';
|
||||
$this->langs='';
|
||||
$this->level='';
|
||||
$this->leftmenu='';
|
||||
|
||||
@ -1261,6 +1261,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", o.ref";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql.= ", o.ref";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
|
||||
@ -1284,6 +1285,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') $sql.= ", ".MAIN_DB_PREFIX."ticket as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') $sql.= ", ".MAIN_DB_PREFIX."bom_bom as o";
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') $sql.= ", ".MAIN_DB_PREFIX."contrat as o";
|
||||
|
||||
$sql.= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if ($force_filter_contact === false) {
|
||||
@ -1314,6 +1316,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
|
||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
}
|
||||
elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat')
|
||||
{
|
||||
$sql.= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
|
||||
if ($filterobj->id) $sql.= " AND a.fk_element = ".$filterobj->id;
|
||||
}
|
||||
}
|
||||
|
||||
// Condition on actioncode
|
||||
@ -1368,6 +1375,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
} elseif (empty($sql) && !empty($sql2)) {
|
||||
$sql = $sql2;
|
||||
}
|
||||
|
||||
//TODO Add limit in nb of results
|
||||
$sql.= $db->order($sortfield_new, $sortorder);
|
||||
dol_syslog("company.lib::show_actions_done", LOG_DEBUG);
|
||||
|
||||
@ -30,8 +30,8 @@
|
||||
*/
|
||||
function contract_prepare_head(Contrat $object)
|
||||
{
|
||||
global $db, $langs, $conf;
|
||||
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -79,9 +79,14 @@ function contract_prepare_head(Contrat $object)
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$head[$h][0] = DOL_URL_ROOT.'/contrat/agenda.php?id='.$object->id;
|
||||
$head[$h][1].= $langs->trans("Events");
|
||||
if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) ))
|
||||
{
|
||||
$head[$h][1].= '/';
|
||||
$head[$h][1].= $langs->trans("Agenda");
|
||||
}
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract', 'remove');
|
||||
|
||||
@ -1559,6 +1559,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
$info = pathinfo($destfile);
|
||||
|
||||
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||
|
||||
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
|
||||
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
|
||||
$destfile = dol_string_nohtmltag($destfile);
|
||||
|
||||
@ -2955,22 +2955,23 @@ function dol_trunc($string, $size = 40, $trunc = 'right', $stringencoding = 'UTF
|
||||
/**
|
||||
* Show picto whatever it's its name (generic function)
|
||||
*
|
||||
* @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1.
|
||||
* @param string $picto Name of image file to show ('filenew', ...)
|
||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path
|
||||
* @param int $srconly Return only content of the src attribute of img.
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind people
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
|
||||
* @return string Return img tag
|
||||
* @param string $titlealt Text on title tag for tooltip. Not used if param notitle is set to 1.
|
||||
* @param string $picto Name of image file to show ('filenew', ...)
|
||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @param string $moreatt Add more attribute on img tag (For example 'style="float: right"')
|
||||
* @param boolean|int $pictoisfullpath If true or 1, image path is a full path
|
||||
* @param int $srconly Return only content of the src attribute of img.
|
||||
* @param int $notitle 1=Disable tag title. Use it if you add js tooltip, to avoid duplicate tooltip.
|
||||
* @param string $alt Force alt for bind people
|
||||
* @param string $morecss Add more class css on img tag (For example 'myclascss'). Work only if $moreatt is empty.
|
||||
* @param string $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left maring on picto, 0 = No margin left. Works for fontawesome picto only.
|
||||
* @return string Return img tag
|
||||
* @see img_object(), img_picto_common()
|
||||
*/
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '')
|
||||
function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0, $alt = '', $morecss = '', $marginleftonlyshort = 2)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -3006,7 +3007,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
if (empty($conf->global->MAIN_DISABLE_FONT_AWESOME_5)) $fa='fas';
|
||||
$fakey = $pictowithoutext;
|
||||
$facolor = ''; $fasize = '';
|
||||
$marginleftonlyshort = 2;
|
||||
|
||||
if ($pictowithoutext == 'setup') {
|
||||
$fakey = 'fa-cog';
|
||||
$fasize = '1.4em';
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
* \ingroup HRM
|
||||
* \brief Library for hrm
|
||||
*/
|
||||
$langs->load('hrm');
|
||||
|
||||
/**
|
||||
* Return head table for establishment tabs screen
|
||||
@ -32,6 +31,8 @@ function establishment_prepare_head($object)
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
$langs->load('hrm');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
@ -65,6 +66,8 @@ function hrm_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$langs->load('hrm');
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
|
||||
@ -136,7 +136,14 @@ function invoice_admin_prepare_head()
|
||||
$head[$h][1] = $langs->trans("Payments");
|
||||
$head[$h][2] = 'payment';
|
||||
$h++;
|
||||
|
||||
|
||||
if($conf->global->INVOICE_USE_SITUATION){
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/facture_situation.php';
|
||||
$head[$h][1] = $langs->trans("InvoiceSituation");
|
||||
$head[$h][2] = 'situation';
|
||||
$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
|
||||
|
||||
@ -2212,3 +2212,49 @@ function pdf_getSizeForImage($realpath)
|
||||
}
|
||||
return array('width'=>$width,'height'=>$height);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return line total amount discount
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @return string Return total of line excl tax
|
||||
*/
|
||||
function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = 0)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
$sign=1;
|
||||
if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
|
||||
if ($object->lines[$i]->special_code == 3)
|
||||
{
|
||||
return $outputlangs->transnoentities("Option");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (is_object($hookmanager))
|
||||
{
|
||||
$special_code = $object->lines[$i]->special_code;
|
||||
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
|
||||
|
||||
$parameters = array(
|
||||
'i'=>$i,
|
||||
'outputlangs'=>$outputlangs,
|
||||
'hidedetails'=>$hidedetails,
|
||||
'special_code'=>$special_code
|
||||
);
|
||||
|
||||
$action='';
|
||||
|
||||
if( $hookmanager->executeHooks('getlinetotalremise', $parameters, $object, $action)>0)
|
||||
{
|
||||
return $hookmanager->resPrint; // Note that $action and $object may have been modified by some hooks
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($hidedetails) || $hidedetails > 1) return $sign * ( ($object->lines[$i]->subprice * $object->lines[$i]->qty) - $object->lines[$i]->total_ht );
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -371,7 +371,8 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
$numlines=count($lines);
|
||||
|
||||
// We declare counter as global because we want to edit them into recursive call
|
||||
global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_declared_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed;
|
||||
global $total_projectlinesa_spent, $total_projectlinesa_planned, $total_projectlinesa_spent_if_planned, $total_projectlinesa_declared_if_planned, $total_projectlinesa_tobill, $total_projectlinesa_billed;
|
||||
|
||||
if ($level == 0)
|
||||
{
|
||||
$total_projectlinesa_spent=0;
|
||||
@ -492,9 +493,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
//else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/task.php?id='.$lines[$i]->id.'&withproject=1">';
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print " ";
|
||||
print '<div class="marginleftonly">';
|
||||
}
|
||||
print $lines[$i]->label;
|
||||
for ($k = 0 ; $k < $level ; $k++)
|
||||
{
|
||||
print '</div>';
|
||||
}
|
||||
if ($showlineingray) print '</i>';
|
||||
//else print '</a>';
|
||||
print "</td>\n";
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||
* Copyright (C) 2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -27,15 +28,15 @@
|
||||
function salaries_prepare_head($object)
|
||||
{
|
||||
|
||||
global $db, $langs, $conf;
|
||||
global $db, $langs, $conf;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
@ -43,23 +44,56 @@ function salaries_prepare_head($object)
|
||||
// $this->tabs = array('entity:-tabname); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries');
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->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.'/compta/salaries/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/document.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>';
|
||||
$head[$h][2] = 'documents';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Info");
|
||||
$head[$h][2] = 'info';
|
||||
$h++;
|
||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/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, 'salaries', 'remove');
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'salaries', 'remove');
|
||||
|
||||
return $head;
|
||||
return $head;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @return array head
|
||||
*/
|
||||
function salaries_admin_prepare_head()
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries.php';
|
||||
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||
$head[$h][2] = 'general';
|
||||
$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:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
|
||||
complete_head_from_modules($conf, $langs, '', $head, $h, 'salaries_admin');
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/salaries/admin/salaries_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsSalaries");
|
||||
$head[$h][2] = 'attributes';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, '', $head, $h, 'salaries_admin', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@ -185,5 +185,5 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
||||
print '</center><br>';
|
||||
}
|
||||
|
||||
print '<div style="margin-left: 50px; margin-right: 50px;">';
|
||||
print '<div class="ticketlargemargin">';
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ function dolWebsiteOutput($content)
|
||||
global $db, $langs, $conf, $user;
|
||||
global $dolibarr_main_url_root, $dolibarr_main_data_root;
|
||||
|
||||
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." (USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
|
||||
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
@ -339,6 +339,14 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('USEDOLIBARREDITOR'))
|
||||
{
|
||||
print '<div class="margintoponly marginleftonly">';
|
||||
print "This page contains dynamic code that make a redirect to '".$containerref."' in your current context. There is no preview for this page.";
|
||||
print '</div>';
|
||||
exit;
|
||||
}
|
||||
|
||||
if (defined('USEDOLIBARRSERVER')) // When page called from Dolibarr server
|
||||
{
|
||||
// Check new container exists
|
||||
@ -397,7 +405,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
||||
*/
|
||||
function includeContainer($containerref)
|
||||
{
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
||||
global $includehtmlcontentopened;
|
||||
global $websitekey, $websitepagefile;
|
||||
|
||||
@ -434,7 +442,124 @@ function includeContainer($containerref)
|
||||
$includehtmlcontentopened--;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML content to add structured data for an article, news or Blog Post.
|
||||
*
|
||||
* @param string $type 'blogpost', 'product', 'software'...
|
||||
* @param array $data Array of data parameters for structured data
|
||||
* @return string HTML content
|
||||
*/
|
||||
function getStructuredData($type, $data = array())
|
||||
{
|
||||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
|
||||
global $includehtmlcontentopened;
|
||||
global $websitekey, $websitepagefile;
|
||||
|
||||
if ($type == 'software')
|
||||
{
|
||||
$ret = '<!-- Add structured data for blog post -->'."\n";
|
||||
$ret .= '<script type="application/ld+json">'."\n";
|
||||
$ret .= '{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "SoftwareApplication",
|
||||
"name": "'.$data['name'].'",
|
||||
"operatingSystem": "'.$data['os'].'",
|
||||
"applicationCategory": "https://schema.org/GameApplication",
|
||||
"aggregateRating": {
|
||||
"@type": "AggregateRating",
|
||||
"ratingValue": "'.$data['ratingvalue'].'",
|
||||
"ratingCount": "'.$data['ratingcount'].'"
|
||||
},
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"price": "'.$data['price'].'",
|
||||
"priceCurrency": "'.($data['currency']?$data['currency']:$conf->currency).'"
|
||||
}
|
||||
}'."\n";
|
||||
$ret .= '</script>'."\n";
|
||||
}
|
||||
elseif ($type == 'blogpost')
|
||||
{
|
||||
if ($websitepage->fk_user_creat > 0)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
|
||||
$tmpuser = new User($db);
|
||||
$restmpuser = $tmpuser->fetch($websitepage->fk_user_creat);
|
||||
|
||||
if ($restmpuser > 0)
|
||||
{
|
||||
$ret = '<!-- Add structured data for blog post -->'."\n";
|
||||
$ret .= '<script type="application/ld+json">'."\n";
|
||||
$ret .= '{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "NewsArticle",
|
||||
"mainEntityOfPage": {
|
||||
"@type": "WebPage",
|
||||
"@id": "'.$websitepage->pageurl.'"
|
||||
},
|
||||
"headline": "'.$websitepage->title.'",
|
||||
"image": [
|
||||
"'.$websitepage->image.'"
|
||||
],
|
||||
"datePublished": "'.dol_print_date($websitepage->date_creation, 'dayhourrfc').'",
|
||||
"dateModified": "'.dol_print_date($websitepage->date_modification, 'dayhourrfc').'",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "'.$tmpuser->getFullName($weblangs).'"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"name": "'.$mysoc->name.'",
|
||||
"logo": {
|
||||
"@type": "ImageObject",
|
||||
"url": "/viewimage.php?modulepart=mycompany&file=logos%2F'.urlencode($mysoc->logo).'"
|
||||
}
|
||||
},
|
||||
"description": "'.$websitepage->description.'"
|
||||
}'."\n";
|
||||
$ret .= '</script>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($type == 'product')
|
||||
{
|
||||
$ret = '<!-- Add structured data for blog post -->'."\n";
|
||||
$ret.= '<script type="application/ld+json">'."\n";
|
||||
$ret.= '{
|
||||
"@context": "https://schema.org/",
|
||||
"@type": "Product",
|
||||
"name": "'.$data['label'].'",
|
||||
"image": [
|
||||
"'.$data['image'].'",
|
||||
],
|
||||
"description": "'.$data['description'].'",
|
||||
"sku": "'.$data['ref'].'",
|
||||
"brand": {
|
||||
"@type": "Thing",
|
||||
"name": "'.$data['brand'].'"
|
||||
},
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "'.$data['author'].'"
|
||||
}
|
||||
},
|
||||
"offers": {
|
||||
"@type": "Offer",
|
||||
"url": "https://example.com/anvil",
|
||||
"priceCurrency": "'.($data['currency']?$data['currency']:$conf->currency).'",
|
||||
"price": "'.$data['price'].'",
|
||||
"itemCondition": "https://schema.org/UsedCondition",
|
||||
"availability": "https://schema.org/InStock",
|
||||
"seller": {
|
||||
"@type": "Organization",
|
||||
"name": "'.$mysoc->name.'"
|
||||
}
|
||||
}
|
||||
}'."\n";
|
||||
$ret.= '</script>'."\n";
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download all images found into page content $tmp.
|
||||
|
||||
@ -218,10 +218,10 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
|
||||
-- insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2003__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/stats/index.php?mainmenu=billing&leftmenu=donations', 'Statistics', 1, 'donations', '$user->rights->don->lire', '', 2, 2, __ENTITY__);
|
||||
-- Special expenses
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled || $conf->salaries->enabled || $conf->loan->enabled || $conf->banque->enabled', __HANDLER__, 'left', 2200__+MAX_llx_menu__, 'billing', 'tax', 6__+MAX_llx_menu__, '/compta/charges/index.php?mainmenu=billing&leftmenu=tax', 'MenuSpecialExpenses', 0, 'compta', '(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) || (! empty($conf->loan->enabled) && $user->rights->loan->read) || (! empty($conf->banque->enabled) && $user->rights->banque->lire)', '', 0, 6, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/compta/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/card.php?mainmenu=billing&leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/compta/salaries/stats/index.php?mainmenu=billing&leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled', __HANDLER__, 'left', 2210__+MAX_llx_menu__, 'billing', 'tax_sal', 2200__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Salaries', 1, 'salaries', '$user->rights->salaries->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2211__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/card.php?mainmenu=billing&leftmenu=tax_salary&action=create', 'NewPayment', 2, 'companies', '$user->rights->salaries->write', '', 0, 2, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2212__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/list.php?mainmenu=billing&leftmenu=tax_salary', 'Payments', 2, 'companies', '$user->rights->salaries->read', '', 0, 3, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->salaries->enabled && $leftmenu=="tax_salary"', __HANDLER__, 'left', 2213__+MAX_llx_menu__, 'billing', '', 2210__+MAX_llx_menu__, '/salaries/stats/index.php?mainmenu=billing&leftmenu=tax_salary', 'Statistics', 2, 'companies', '$user->rights->salaries->read', '', 0, 4, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled', __HANDLER__, 'left', 2220__+MAX_llx_menu__, 'billing', 'tax_loan', 2200__+MAX_llx_menu__, '/loan/list.php?mainmenu=billing&leftmenu=tax_loan', 'Loans', 1, 'loan', '$user->rights->loan->read', '', 0, 1, __ENTITY__);
|
||||
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2221__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/card.php?mainmenu=billing&leftmenu=tax_loan&action=create', 'NewLoan', 2, 'loan', '$user->rights->loan->write', '', 0, 2, __ENTITY__);
|
||||
--insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->loan->enabled && $leftmenu=="tax_loan"', __HANDLER__, 'left', 2222__+MAX_llx_menu__, 'billing', '', 2220__+MAX_llx_menu__, '/loan/payment/list.php?mainmenu=billing&leftmenu=tax_loan', 'Payments', 2, 'companies', '$user->rights->loan->read', '', 0, 3, __ENTITY__);
|
||||
|
||||
@ -1108,11 +1108,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
if (! empty($conf->salaries->enabled))
|
||||
{
|
||||
$langs->load("salaries");
|
||||
$newmenu->add("/compta/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 1, $user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
||||
$newmenu->add("/salaries/list.php?leftmenu=tax_salary&mainmenu=billing", $langs->trans("Salaries"), 1, $user->rights->salaries->read, '', $mainmenu, 'tax_salary');
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/^tax_salary/i', $leftmenu)) {
|
||||
$newmenu->add("/compta/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("NewPayment"), 2, $user->rights->salaries->write);
|
||||
$newmenu->add("/compta/salaries/list.php?leftmenu=tax_salary", $langs->trans("Payments"), 2, $user->rights->salaries->read);
|
||||
$newmenu->add("/compta/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 2, $user->rights->salaries->read);
|
||||
$newmenu->add("/salaries/card.php?leftmenu=tax_salary&action=create", $langs->trans("NewPayment"), 2, $user->rights->salaries->write);
|
||||
$newmenu->add("/salaries/list.php?leftmenu=tax_salary", $langs->trans("Payments"), 2, $user->rights->salaries->read);
|
||||
$newmenu->add("/salaries/stats/index.php?leftmenu=tax_salary", $langs->trans("Statistics"), 2, $user->rights->salaries->read);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1285,7 +1285,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
||||
$newmenu->add("/accountancy/bookkeeping/balance.php?mainmenu=accountancy&leftmenu=accountancy_accountancy", $langs->trans("AccountBalance"), 1, $user->rights->accounting->mouvements->lire);
|
||||
|
||||
// Files
|
||||
if (! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
|
||||
if ((! empty($conf->global->MAIN_FEATURES_LEVEL) && $conf->global->MAIN_FEATURES_LEVEL >= 1) || ! empty($conf->global->ACCOUNTANCY_SHOW_EXPORT_FILES_MENU))
|
||||
{
|
||||
$newmenu->add("/compta/accounting-files.php?mainmenu=accountancy&leftmenu=accountancy_files", $langs->trans("AccountantFiles"), 1, $user->rights->accounting->mouvements->lire);
|
||||
}
|
||||
|
||||
@ -1938,7 +1938,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
|
||||
$menu->type=$this->menu[$key]['type'];
|
||||
$menu->mainmenu=isset($this->menu[$key]['mainmenu'])?$this->menu[$key]['mainmenu']:(isset($menu->fk_mainmenu)?$menu->fk_mainmenu:'');
|
||||
$menu->leftmenu=isset($this->menu[$key]['leftmenu'])?$this->menu[$key]['leftmenu']:'';
|
||||
$menu->titre=$this->menu[$key]['titre'];
|
||||
$menu->titre=$this->menu[$key]['titre']; // deprecated
|
||||
$menu->title=$this->menu[$key]['titre'];
|
||||
$menu->url=$this->menu[$key]['url'];
|
||||
$menu->langs=$this->menu[$key]['langs'];
|
||||
$menu->position=$this->menu[$key]['position'];
|
||||
|
||||
@ -1217,6 +1217,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
@ -1227,8 +1229,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return void
|
||||
*/
|
||||
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
// Load traductions files requiredby by page
|
||||
@ -1437,6 +1440,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
return $top_shift;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
@ -1446,8 +1451,9 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
|
||||
@ -1352,6 +1352,8 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
@ -1362,8 +1364,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return void
|
||||
*/
|
||||
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "PdfOrderTitle")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
// Translations
|
||||
@ -1564,6 +1567,8 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
return $top_shift;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show footer of page. Need this->emetteur object
|
||||
*
|
||||
@ -1573,8 +1578,9 @@ class pdf_eratosthene extends ModelePDFCommandes
|
||||
* @param int $hidefreetext 1=Hide free text
|
||||
* @return int Return height of bottom margin including footer text
|
||||
*/
|
||||
private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
protected function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
|
||||
return pdf_pagefoot($pdf, $outputlangs, 'ORDER_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
|
||||
|
||||
@ -57,6 +57,8 @@ class pdf_proforma extends pdf_einstein
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
|
||||
/**
|
||||
* Show top header of page.
|
||||
*
|
||||
@ -67,8 +69,9 @@ class pdf_proforma extends pdf_einstein
|
||||
* @param string $titlekey Translation key to show as title of document
|
||||
* @return void
|
||||
*/
|
||||
private function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
|
||||
protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs, $titlekey = "InvoiceProForma")
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf,$langs,$hookmanager;
|
||||
|
||||
parent::_pagehead($pdf, $object, $showaddress, $outputlangs, $titlekey);
|
||||
|
||||
@ -414,7 +414,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
}
|
||||
}
|
||||
// Make substitutions into odt of thirdparty
|
||||
$tmparray=$this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||
if ($socobject->element == 'contact') {
|
||||
$tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs);
|
||||
} else {
|
||||
$tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||
}
|
||||
foreach($tmparray as $key=>$value)
|
||||
{
|
||||
try {
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user