Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
c939273fd5
@ -26,6 +26,7 @@ Following changes may create regression for some external modules, but were nece
|
||||
Dolibarr better:
|
||||
- Function log() of class CommandeFournisseur has been removed. Using it is no more required.
|
||||
- Method select_type_comptes_financiers() has been renamed into selectTypeOfBankAccount()
|
||||
- Property ->client that was deprecated 6 years ago, is replaced in all core code with ->thirdparty.
|
||||
- File '/core/tpl/document_actions_pre_headers.tpl.php' were renamed into '/core/actions_linkedfiles.inc.php'.
|
||||
So if you included it into your module, change your code like this to be compatible with all version:
|
||||
$res=@include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php';
|
||||
|
||||
@ -71,7 +71,6 @@ class Skeleton_Class extends CommonObject
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2015 Ari Elbaz (elarifr) <github@accedinfo.com>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,18 +30,6 @@
|
||||
*/
|
||||
class FormVentilation extends Form
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db) {
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return select filter with date of transaction
|
||||
*
|
||||
@ -49,38 +38,25 @@ class FormVentilation extends Form
|
||||
* @return string HTML edit field
|
||||
*/
|
||||
function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') {
|
||||
$options = array();
|
||||
|
||||
$sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping';
|
||||
$sql .= ' ORDER BY import_key DESC';
|
||||
|
||||
$out = '<SELECT name="' . $htmlname . '">';
|
||||
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey sql=" . $sql, LOG_DEBUG);
|
||||
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$selected = '';
|
||||
if ($selectedkey == $obj->import_key) {
|
||||
$selected = ' selected ';
|
||||
}
|
||||
|
||||
$out .= '<OPTION value="' . $obj->import_key . '"' . $selected . '>' . dol_print_date($obj->import_key, 'dayhourtext') . '</OPTION>';
|
||||
|
||||
$i ++;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_bookkeeping_importkey " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
}
|
||||
|
||||
$out .= '</SELECT>';
|
||||
|
||||
return $out;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->import_key] = dol_print_date($obj->import_key, 'dayhourtext');
|
||||
}
|
||||
|
||||
return Form::selectarray($htmlname, $options, $selectedkey);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,8 +76,8 @@ class FormVentilation extends Form
|
||||
global $conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
|
||||
$out = '';
|
||||
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : 50;
|
||||
|
||||
$sql = "SELECT DISTINCT aa.account_number, aa.label, aa.rowid, aa.fk_pcg_version";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
@ -110,49 +86,44 @@ class FormVentilation extends Form
|
||||
$sql .= " AND aa.active = 1";
|
||||
$sql .= " ORDER BY aa.account_number";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_account sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
|
||||
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
if ($select_in == 0)
|
||||
$select_value_in = $obj->rowid;
|
||||
if ($select_in == 1)
|
||||
$select_value_in = $obj->account_number;
|
||||
if ($select_out == 0)
|
||||
$select_value_out = $obj->rowid;
|
||||
if ($select_out == 1)
|
||||
$select_value_out = $obj->account_number;
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
// $out .= '<option value="' . $obj->account_number . '" selected>' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
// $out .= '<option value="' . $obj->account_number . '">' . $label . '</option>';
|
||||
$out .= '<option value="' . $select_value_out . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_account " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
$options = array();
|
||||
$selected = null;
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$label = length_accountg($obj->account_number) . ' - ' . $obj->label;
|
||||
$label = dol_trunc($label, $trunclength);
|
||||
|
||||
$select_value_in = $obj->rowid;
|
||||
$select_value_out = $obj->rowid;
|
||||
|
||||
if ($select_in == 1) {
|
||||
$select_value_in = $obj->account_number;
|
||||
}
|
||||
if ($select_out == 1) {
|
||||
$select_value_out = $obj->account_number;
|
||||
}
|
||||
|
||||
// Remember guy's we store in database llx_facturedet the rowid of accounting_account and not the account_number
|
||||
// Because same account_number can be share between different accounting_system and do have the same meaning
|
||||
if (($selectid != '') && $selectid == $select_value_in) {
|
||||
$selected = $select_value_out;
|
||||
}
|
||||
|
||||
$options[$select_value_out] = $label;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selected, $showempty);
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -170,44 +141,30 @@ class FormVentilation extends Form
|
||||
function select_pcgtype($selectid, $htmlname = 'pcg_type', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_type ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_type";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_pcgtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->pcg_type;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_type) {
|
||||
$out .= '<option value="' . $obj->pcg_type . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_type . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->pcg_type] = $obj->pcg_type;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -225,44 +182,30 @@ class FormVentilation extends Form
|
||||
function select_pcgsubtype($selectid, $htmlname = 'pcg_subtype', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$sql = "SELECT DISTINCT pcg_subtype ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
|
||||
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
|
||||
$sql .= " ORDER BY pcg_subtype";
|
||||
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
while ( $i < $num ) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$label = $obj->pcg_subtype;
|
||||
|
||||
if (($selectid != '') && $selectid == $obj->pcg_subtype) {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '" selected>' . $label . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $obj->pcg_subtype . '">' . $label . '</option>';
|
||||
}
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$options = array();
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$options[$obj->pcg_subtype] = $obj->pcg_subtype;
|
||||
}
|
||||
|
||||
$out .= Form::selectarray($htmlname, $options, $selectid, $showempty);
|
||||
|
||||
$this->db->free($resql);
|
||||
return $out;
|
||||
}
|
||||
@ -278,68 +221,51 @@ class FormVentilation extends Form
|
||||
* @return string String with HTML select
|
||||
*/
|
||||
function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $event = array()) {
|
||||
global $conf;
|
||||
|
||||
$out = '';
|
||||
|
||||
$aux_account = array ();
|
||||
|
||||
|
||||
$aux_account = array();
|
||||
|
||||
// Auxiliary customer account
|
||||
$sql = "SELECT DISTINCT code_compta, nom ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
if (! empty($obj->code_compta)) {
|
||||
$aux_account[$obj->code_compta] = $obj->code_compta . ' (' . $obj->nom . ')';
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!empty($obj->code_compta)) {
|
||||
$aux_account[$obj->code_compta] = $obj->code_compta.' ('.$obj->nom.')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
// Auxiliary supplier account
|
||||
$sql = "SELECT DISTINCT code_compta_fournisseur, nom ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "societe";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
dol_syslog(get_class($this) . "::select_auxaccount", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
if (! empty($obj->code_compta_fournisseur)) {
|
||||
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur . ' (' . $obj->nom . ')';
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!empty($obj->code_compta_fournisseur)) {
|
||||
$aux_account[$obj->code_compta_fournisseur] = $obj->code_compta_fournisseur.' ('.$obj->nom.')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::select_pcgsubtype " . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
// Build select
|
||||
if (count($aux_account) > 0) {
|
||||
|
||||
$out .= ajax_combobox($htmlname, $event);
|
||||
|
||||
$out .= '<select id="' . $htmlname . '" class="flat" name="' . $htmlname . '">';
|
||||
if ($showempty)
|
||||
$out .= '<option value="-1"></option>';
|
||||
foreach ( $aux_account as $key => $val ) {
|
||||
if (($selectid != '') && $selectid == $key) {
|
||||
$out .= '<option value="' . $key . '" selected>' . $val . '</option>';
|
||||
} else {
|
||||
$out .= '<option value="' . $key . '">' . $val . '</option>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
}
|
||||
|
||||
$out = ajax_combobox($htmlname, $event);
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty);
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
@ -352,55 +278,29 @@ class FormVentilation extends Form
|
||||
* @param string $output_format (html/opton (for option html only)/array (to return options arrays
|
||||
* @return string/array
|
||||
*/
|
||||
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') {
|
||||
$out = '';
|
||||
$out_array = array ();
|
||||
|
||||
if ($output_format == 'html') {
|
||||
$out .= '<select class="flat" placeholder="aa" id="' . $htmlname . '" name="' . $htmlname . '"' . $option . ' >';
|
||||
}
|
||||
if ($useempty) {
|
||||
$selected_html = '';
|
||||
if ($selected == '') {
|
||||
$selected_html = ' selected';
|
||||
}
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
$out .= '<option value=""' . $selected_html . '> </option>';
|
||||
} elseif ($output_format == 'array') {
|
||||
$out_array[''] = '';
|
||||
}
|
||||
}
|
||||
|
||||
function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
|
||||
{
|
||||
$out_array = array();
|
||||
|
||||
$sql = "SELECT DISTINCT date_format(doc_date,'%Y') as dtyear";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping";
|
||||
$sql .= " ORDER BY doc_date";
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ( $obj = $this->db->fetch_object($resql) ) {
|
||||
$selected_html = '';
|
||||
if ($selected > 0 && $obj->dtyear == $selected)
|
||||
$selected_html = ' selected';
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
$out .= '<option value="' . $obj->dtyear . '"' . $selected_html . ' >' . $obj->dtyear . '</option>';
|
||||
} elseif ($output_format == 'array') {
|
||||
$out_array[$obj->dtyear] = $obj->dtyear;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error " . $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__ . $this->error, LOG_ERR);
|
||||
return - 1;
|
||||
|
||||
if (!$resql) {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::".__METHOD__.$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$out_array[$obj->dtyear] = $obj->dtyear;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
|
||||
if ($output_format == 'html') {
|
||||
$out .= "</select>\n";
|
||||
}
|
||||
|
||||
if ($output_format == 'html' || $output_format == 'options') {
|
||||
return $out;
|
||||
} elseif ($output_format == 'array') {
|
||||
return Form::selectarray($htmlname, $out_array, $selected, $useempty, 0, 0, 'placeholder="aa"');
|
||||
} else {
|
||||
return $out_array;
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,6 +144,7 @@ class CategoryApi extends DolibarrApi
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
@ -224,6 +225,7 @@ class CategoryApi extends DolibarrApi
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$i=0;
|
||||
$num = $db->num_rows($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
@ -318,7 +318,7 @@ if ($action == 'add')
|
||||
$db->begin();
|
||||
|
||||
// On cree l'action
|
||||
$idaction=$object->add($user);
|
||||
$idaction=$object->create($user);
|
||||
|
||||
if ($idaction > 0)
|
||||
{
|
||||
|
||||
@ -173,7 +173,7 @@ class ActionComm extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
@ -189,7 +189,7 @@ class ActionComm extends CommonObject
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
*/
|
||||
function add($user,$notrigger=0)
|
||||
public function create(User $user, $notrigger = 0)
|
||||
{
|
||||
global $langs,$conf,$hookmanager;
|
||||
|
||||
@ -395,6 +395,20 @@ class ActionComm extends CommonObject
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an action/event into database.
|
||||
* $this->type_id OR $this->type_code must be set.
|
||||
*
|
||||
* @param User $user Object user making action
|
||||
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
|
||||
* @return int Id of created event, < 0 if KO
|
||||
* @deprecated Use create instead
|
||||
*/
|
||||
public function add(User $user, $notrigger = 0)
|
||||
{
|
||||
$this->create($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
@ -436,7 +450,7 @@ class ActionComm extends CommonObject
|
||||
}
|
||||
|
||||
// Create clone
|
||||
$result=$this->add($fuser);
|
||||
$result=$this->create($fuser);
|
||||
if ($result < 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
|
||||
@ -146,7 +146,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,16 +247,16 @@ class Propal extends CommonObject
|
||||
|
||||
$productdesc = $prod->description;
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$this->client,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->client,$prod->id);
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->client,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->client,$tva_npr);
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr);
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
{
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1975,7 +1975,7 @@ class Propal extends CommonObject
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
|
||||
@ -177,7 +177,7 @@ if ($object->id > 0)
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
|
||||
@ -99,10 +99,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->client) )
|
||||
if ( is_null($object->thirdparty) )
|
||||
$object->fetch_thirdparty();
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Discounts
|
||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="3">';
|
||||
|
||||
@ -1420,15 +1420,15 @@ class Commande extends CommonOrder
|
||||
$prod=new Product($this->db);
|
||||
$prod->fetch($idproduct);
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$this->client,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->client,$prod->id);
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->client,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->client,$mysoc,$tva_npr);
|
||||
$localtax1_tx=get_localtax($tva_tx,1,$this->thirdparty,$mysoc,$tva_npr);
|
||||
$localtax2_tx=get_localtax($tva_tx,2,$this->thirdparty,$mysoc,$tva_npr);
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
else
|
||||
$price = $prod->price;
|
||||
|
||||
@ -1844,13 +1844,13 @@ class Commande extends CommonOrder
|
||||
|
||||
/**
|
||||
* Load array this->expeditions of lines of shipments with nb of products sent for each order line
|
||||
*
|
||||
* Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order
|
||||
*
|
||||
* @param int $filtre_statut Filter on status
|
||||
* @param int $fk_product Filter on a product
|
||||
* @return int <0 if KO, Nb of lines found if OK
|
||||
*
|
||||
* TODO deprecate, move to Shipping class
|
||||
*/
|
||||
function loadExpeditions($filtre_statut=-1)
|
||||
function loadExpeditions($filtre_statut=-1, $fk_product=0)
|
||||
{
|
||||
$this->expeditions = array();
|
||||
|
||||
@ -1863,6 +1863,7 @@ class Commande extends CommonOrder
|
||||
if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND';
|
||||
$sql.= ' ed.fk_origin_line = cd.rowid';
|
||||
$sql.= ' AND cd.fk_commande =' .$this->id;
|
||||
if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product;
|
||||
if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut;
|
||||
$sql.= ' GROUP BY cd.rowid, cd.fk_product';
|
||||
//print $sql;
|
||||
|
||||
@ -171,10 +171,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</tr>';
|
||||
|
||||
// Customer
|
||||
if (is_null($object->client)) $object->fetch_thirdparty();
|
||||
if (is_null($object->thirdparty)) $object->fetch_thirdparty();
|
||||
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
// Delivery address
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
|
||||
@ -1932,7 +1932,7 @@ class Facture extends CommonInvoice
|
||||
$this->date=dol_now();
|
||||
$this->date_lim_reglement=$this->calculate_date_lim_reglement();
|
||||
}
|
||||
$num = $this->getNextNumRef($this->client);
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1971,7 +1971,7 @@ class Facture extends CommonInvoice
|
||||
if (! $error)
|
||||
{
|
||||
// Define third party as a customer
|
||||
$result=$this->client->set_as_client();
|
||||
$result=$this->thirdparty->set_as_client();
|
||||
|
||||
// Si active on decremente le produit principal et ses composants a la validation de facture
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0)
|
||||
@ -3085,7 +3085,7 @@ class Facture extends CommonInvoice
|
||||
// If not a draft invoice and not temporary invoice
|
||||
if ($facref != 'PROV')
|
||||
{
|
||||
$maxfacnumber = $this->getNextNumRef($this->client,'last');
|
||||
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
|
||||
$ventilExportCompta = $this->getVentilExportCompta();
|
||||
// If there is no invoice into the reset range and not already dispatched, we can delete
|
||||
if ($maxfacnumber == '' && $ventilExportCompta == 0) return 1;
|
||||
|
||||
@ -175,7 +175,7 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Customer
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1,'compta').'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1,'compta').'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
@ -281,7 +281,7 @@ if ($action == 'create')
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->client->getNomUrl(1,'customer').'</td>';
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1,'customer').'</td>';
|
||||
print '<td>';
|
||||
print $langs->trans("Comment");
|
||||
print '</td></tr>';
|
||||
|
||||
@ -540,7 +540,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -449,14 +449,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
print '<input type="hidden" name="facid" value="'.$facture->id.'">';
|
||||
print '<input type="hidden" name="socid" value="'.$facture->socid.'">';
|
||||
print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">';
|
||||
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
|
||||
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->thirdparty->name).'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Third party
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans('Company').'</span></td><td colspan="2">'.$facture->thirdparty->getNomUrl(4)."</td></tr>\n";
|
||||
|
||||
// Date payment
|
||||
print '<tr><td><span class="fieldrequired">'.$langs->trans('Date').'</span></td><td>';
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
|
||||
*
|
||||
* 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
|
||||
@ -130,12 +131,6 @@ abstract class CommonObject
|
||||
* @see fetch_thirdparty()
|
||||
*/
|
||||
public $thirdparty;
|
||||
/**
|
||||
* @deprecated
|
||||
* @var Societe A related customer
|
||||
* @see thirdparty
|
||||
*/
|
||||
public $client;
|
||||
|
||||
/**
|
||||
* @var User A related user
|
||||
@ -1016,12 +1011,10 @@ abstract class CommonObject
|
||||
if ($idtofetch) {
|
||||
$thirdparty = new Societe($this->db);
|
||||
$result = $thirdparty->fetch($idtofetch);
|
||||
$this->client = $thirdparty; // deprecated
|
||||
$this->thirdparty = $thirdparty;
|
||||
|
||||
// Use first price level if level not defined for third party
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->thirdparty->price_level)) {
|
||||
$this->client->price_level = 1; // deprecated
|
||||
$this->thirdparty->price_level = 1;
|
||||
}
|
||||
|
||||
@ -4237,6 +4230,88 @@ abstract class CommonObject
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
/**
|
||||
* Update an exta field value for the current object.
|
||||
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* This function delte record with all extrafields and insert them again from the array $this->array_options.
|
||||
* $key key of the extrafield
|
||||
* @return int -1=error, O=did nothing, 1=OK
|
||||
*/
|
||||
function updateExtraField($key)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$error=0;
|
||||
|
||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used
|
||||
|
||||
if (! empty($this->array_options) && !empty($this->array_options["options_$key"]))
|
||||
{
|
||||
// Check parameters
|
||||
$langs->load('admin');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields = new ExtraFields($this->db);
|
||||
$target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element);
|
||||
|
||||
$value=$this->array_options["options_$key"];
|
||||
$attributeType = $extrafields->attribute_type[$key];
|
||||
$attributeLabel = $extrafields->attribute_label[$key];
|
||||
$attributeParam = $extrafields->attribute_param[$key];
|
||||
switch ($attributeType)
|
||||
{
|
||||
case 'int':
|
||||
if (!is_numeric($value) && $value!='')
|
||||
{
|
||||
$this->errors[]=$langs->trans("ExtraFieldHasWrongValue",$attributeLabel);
|
||||
return -1;
|
||||
}
|
||||
elseif ($value=='')
|
||||
{
|
||||
$this->array_options["options_$key"] = null;
|
||||
}
|
||||
break;
|
||||
case 'price':
|
||||
$this->array_options["options_$key"] = price2num($this->array_options["options_$key"]);
|
||||
break;
|
||||
case 'date':
|
||||
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]);
|
||||
break;
|
||||
case 'datetime':
|
||||
$this->array_options["options_$key"]=$this->db->idate($this->array_options["options_$key"]);
|
||||
break;
|
||||
case 'link':
|
||||
$param_list=array_keys($attributeParam ['options']);
|
||||
// 0 : ObjectName
|
||||
// 1 : classPath
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
dol_include_once($InfoFieldList[1]);
|
||||
$object = new $InfoFieldList[0]($this->db);
|
||||
if ($value)
|
||||
{
|
||||
$object->fetch(0,$value);
|
||||
$this->array_options["options_$key"]=$object->id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
$this->db->begin();
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element."_extrafields SET $key=".$this->array_options["options_$key"];
|
||||
$sql .= " WHERE fk_object = ".$this->id;
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to show lines of extrafields with output datas
|
||||
|
||||
@ -300,17 +300,17 @@ class dolReceiptPrinter extends Escpos
|
||||
function selectTypePrinter($selected='', $htmlname='printertypeid')
|
||||
{
|
||||
global $langs;
|
||||
$error = 0;
|
||||
$html = '<select class="flat" name="'.$htmlname.'">';
|
||||
$html.= '<option value="1" '.($selected==1?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_DUMMY').'</option>';
|
||||
$html.= '<option value="2" '.($selected==2?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_FILE_PRINT').'</option>';
|
||||
$html.= '<option value="3" '.($selected==3?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_NETWORK_PRINT').'</option>';
|
||||
$html.= '<option value="4" '.($selected==4?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_WINDOWS_PRINT').'</option>';
|
||||
//$html.= '<option value="5" '.($selected==5?'selected="selected"':'').'>'.$langs->trans('CONNECTOR_JAVA').'</option>';
|
||||
$html.= '</select>';
|
||||
|
||||
$this->resprint = $html;
|
||||
return $error;
|
||||
|
||||
$options = array(
|
||||
1 => $langs->trans('CONNECTOR_DUMMY'),
|
||||
2 => $langs->trans('CONNECTOR_FILE_PRINT'),
|
||||
3 => $langs->trans('CONNECTOR_NETWORK_PRINT'),
|
||||
4 => $langs->trans('CONNECTOR_WINDOWS_PRINT')
|
||||
);
|
||||
|
||||
$this->resprint = Form::selectarray($htmlname, $options, $selected);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -324,17 +324,17 @@ class dolReceiptPrinter extends Escpos
|
||||
function selectProfilePrinter($selected='', $htmlname='printerprofileid')
|
||||
{
|
||||
global $langs;
|
||||
$error = 0;
|
||||
$html = '<select class="flat" name="'.$htmlname.'">';
|
||||
$html.= '<option value="0" '.($selected==0?'selected="selected"':'').'>'.$langs->trans('PROFILE_DEFAULT').'</option>';
|
||||
$html.= '<option value="1" '.($selected==1?'selected="selected"':'').'>'.$langs->trans('PROFILE_SIMPLE').'</option>';
|
||||
$html.= '<option value="2" '.($selected==2?'selected="selected"':'').'>'.$langs->trans('PROFILE_EPOSTEP').'</option>';
|
||||
$html.= '<option value="3" '.($selected==3?'selected="selected"':'').'>'.$langs->trans('PROFILE_P822D').'</option>';
|
||||
$html.= '<option value="4" '.($selected==4?'selected="selected"':'').'>'.$langs->trans('PROFILE_STAR').'</option>';
|
||||
$html.= '</select>';
|
||||
|
||||
$this->profileresprint = $html;
|
||||
return $error;
|
||||
|
||||
$options = array(
|
||||
0 => $langs->trans('PROFILE_DEFAULT'),
|
||||
1 => $langs->trans('PROFILE_SIMPLE'),
|
||||
2 => $langs->trans('PROFILE_EPOSTEP'),
|
||||
3 => $langs->trans('PROFILE_P822D'),
|
||||
4 => $langs->trans('PROFILE_STAR')
|
||||
);
|
||||
|
||||
$this->profileresprint = Form::selectarray($htmlname, $options, $selected);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -146,9 +146,6 @@ class FormCompany
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($empty) print '<option value=""> </option>';
|
||||
|
||||
dol_syslog(get_class($this).'::form_prospect_level',LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel";
|
||||
@ -157,25 +154,25 @@ class FormCompany
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$options = array();
|
||||
|
||||
print '<option value="'.$obj->code.'"';
|
||||
if ($selected == $obj->code) print ' selected';
|
||||
print '>';
|
||||
$level=$langs->trans($obj->code);
|
||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||
print $level;
|
||||
print '</option>';
|
||||
|
||||
$i++;
|
||||
if ($empty) {
|
||||
$options[''] = '';
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$level = $langs->trans($obj->code);
|
||||
|
||||
if ($level == $obj->code) {
|
||||
$level = $langs->trans($obj->label);
|
||||
}
|
||||
|
||||
$options[$obj->code] = $level;
|
||||
}
|
||||
|
||||
print Form::selectarray($htmlname, $options, $selected);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
print '</select>';
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
|
||||
@ -920,6 +920,7 @@ class FormMail extends Form
|
||||
*/
|
||||
function setSubstitFromObject($object)
|
||||
{
|
||||
global $user;
|
||||
$this->substit['__REF__'] = $object->ref;
|
||||
$this->substit['__SIGNATURE__'] = $user->signature;
|
||||
$this->substit['__REFCLIENT__'] = $object->ref_client;
|
||||
|
||||
@ -27,22 +27,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
|
||||
*/
|
||||
class FormMailing extends Form
|
||||
{
|
||||
public $db;
|
||||
public $error;
|
||||
public $errors=array();
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a select with destinaries status
|
||||
*
|
||||
@ -59,26 +45,14 @@ class FormMailing extends Form
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php';
|
||||
$mailing = new Mailing($this->db);
|
||||
|
||||
|
||||
$array = $mailing->statut_dest;
|
||||
//Cannot use form->selectarray because empty value is defaulted to -1 in this method and we use here status -1...
|
||||
|
||||
$out = '<select name="'.$htmlname.'" class="flat">';
|
||||
$options = array();
|
||||
|
||||
if ($show_empty) {
|
||||
$out .= '<option value=""></option>';
|
||||
$options[''] = '';
|
||||
}
|
||||
|
||||
foreach($mailing->statut_dest as $id=>$status) {
|
||||
if ($selectedid==$id) {
|
||||
$selected=" selected ";
|
||||
}else {
|
||||
$selected="";
|
||||
}
|
||||
$out .= '<option '.$selected.' value="'.$id.'">'.$langs->trans($status).'</option>';
|
||||
}
|
||||
$options = array_merge($options, $mailing->statut_dest);
|
||||
|
||||
$out .= '</select>';
|
||||
return $out;
|
||||
return Form::selectarray($htmlname, $options, $selectedid, 0, 0, 0, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -21,29 +22,14 @@
|
||||
* \brief File of predefined functions for HTML forms for order module
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/html.form.class.php';
|
||||
|
||||
/**
|
||||
* Class to manage HTML output components for orders
|
||||
* Before adding component here, check they are not into common part Form.class.php
|
||||
*/
|
||||
class FormOrder
|
||||
class FormOrder extends Form
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return combo list of differents status of a orders
|
||||
@ -53,51 +39,32 @@ class FormOrder
|
||||
* @param string $hmlname Name of HTML select element
|
||||
* @return void
|
||||
*/
|
||||
function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status')
|
||||
public function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status')
|
||||
{
|
||||
$tmpsupplierorder=new CommandeFournisseur($db);
|
||||
|
||||
print '<select class="flat" name="'.$hmlname.'">';
|
||||
print '<option value="-1"> </option>';
|
||||
$statustohow=array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6,7','9'=>'9'); // 7 is same label than 6. 8 does not exists (billed is another field)
|
||||
$options = array();
|
||||
|
||||
foreach($statustohow as $key => $value)
|
||||
{
|
||||
print '<option value="'.$value.'"'.(($selected == $key || $selected == $value)?' selected':'').'>';
|
||||
$tmpsupplierorder->statut=$key;
|
||||
print $tmpsupplierorder->getLibStatut($short);
|
||||
print '</option>';
|
||||
}
|
||||
print '</select>';
|
||||
// 7 is same label than 6. 8 does not exists (billed is another field)
|
||||
$statustohow = array(
|
||||
'0' => '0',
|
||||
'1' => '1',
|
||||
'2' => '2',
|
||||
'3' => '3',
|
||||
'4' => '4',
|
||||
'5' => '5',
|
||||
'6' => '6,7',
|
||||
'9' => '9'
|
||||
);
|
||||
|
||||
$tmpsupplierorder = new CommandeFournisseur($this->db);
|
||||
|
||||
foreach ($statustohow as $key => $value) {
|
||||
$tmpsupplierorder->statut = $key;
|
||||
$options[$value] = $tmpsupplierorder->getLibStatut($short);
|
||||
}
|
||||
|
||||
print Form::selectarray($hmlname, $options, $selected, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of way to order
|
||||
*
|
||||
* @param string $selected Id of preselected order origin
|
||||
* @param string $htmlname Name of HTML select list
|
||||
* @param int $addempty 0=liste sans valeur nulle, 1=ajoute valeur inconnue
|
||||
* @return array Tableau des sources de commandes
|
||||
*/
|
||||
function selectSourcesCommande($selected='',$htmlname='source_id',$addempty=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
if ($addempty) print '<option value="-1" selected> </option>';
|
||||
|
||||
// TODO Use the table called llx_c_input_reason
|
||||
print '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans('OrderSource0').'</option>';
|
||||
print '<option value="1"'.($selected=='1'?' selected':'').'>'.$langs->trans('OrderSource1').'</option>';
|
||||
print '<option value="2"'.($selected=='2'?' selected':'').'>'.$langs->trans('OrderSource2').'</option>';
|
||||
print '<option value="3"'.($selected=='3'?' selected':'').'>'.$langs->trans('OrderSource3').'</option>';
|
||||
print '<option value="4"'.($selected=='4'?' selected':'').'>'.$langs->trans('OrderSource4').'</option>';
|
||||
print '<option value="5"'.($selected=='5'?' selected':'').'>'.$langs->trans('OrderSource5').'</option>';
|
||||
print '<option value="6"'.($selected=='6'?' selected':'').'>'.$langs->trans('OrderSource6').'</option>';
|
||||
|
||||
print '</select>';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return list of input method (mode used to receive order, like order received by email, fax, online)
|
||||
* List found into table c_input_method.
|
||||
@ -107,11 +74,9 @@ class FormOrder
|
||||
* @param int $addempty 0=list with no empty value, 1=list with empty value
|
||||
* @return array Tableau des sources de commandes
|
||||
*/
|
||||
function selectInputMethod($selected='',$htmlname='source_id',$addempty=0)
|
||||
public function selectInputMethod($selected='',$htmlname='source_id',$addempty=0)
|
||||
{
|
||||
global $conf,$langs,$form;
|
||||
|
||||
if (! is_object($form)) $form=new Form($this->db);
|
||||
global $langs;
|
||||
|
||||
$listofmethods=array();
|
||||
|
||||
@ -121,24 +86,18 @@ class FormOrder
|
||||
|
||||
dol_syslog(get_class($this)."::selectInputMethod", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$i = 0;
|
||||
$num = $this->db->num_rows($resql);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$listofmethods[$obj->rowid] = $langs->trans($obj->code)!=$obj->code?$langs->trans($obj->code):$obj->label;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (!$resql) {
|
||||
dol_print_error($this->db);
|
||||
return -1;
|
||||
}
|
||||
|
||||
print $form->selectarray($htmlname,$listofmethods,$selected,$addempty);
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
$listofmethods[$obj->rowid] = $langs->trans($obj->code) != $obj->code ? $langs->trans($obj->code) : $obj->label;
|
||||
}
|
||||
|
||||
print Form::selectarray($htmlname,$listofmethods,$selected,$addempty);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -57,17 +57,17 @@ function societe_prepare_head(Societe $object)
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && ($object->client==1 || $object->client==3)) $head[$h][1] .= $langs->trans("Customer");
|
||||
$head[$h][2] = 'customer';
|
||||
$h++;
|
||||
}
|
||||
if (($object->client==1 || $object->client==2 || $object->client==3) && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)))
|
||||
{
|
||||
$langs->load("products");
|
||||
// price
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CustomerPrices");
|
||||
$head[$h][2] = 'price';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
|
||||
{
|
||||
$langs->load("products");
|
||||
// price
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CustomerPrices");
|
||||
$head[$h][2] = 'price';
|
||||
$h++;
|
||||
}
|
||||
}
|
||||
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
|
||||
|
||||
@ -1358,7 +1358,7 @@ function dol_meta_create($object)
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$nblignes = count($object->lines);
|
||||
$client = $object->client->name . " " . $object->client->address . " " . $object->client->zip . " " . $object->client->town;
|
||||
$client = $object->thirdparty->name . " " . $object->thirdparty->address . " " . $object->thirdparty->zip . " " . $object->thirdparty->town;
|
||||
$meta = "REFERENCE=\"" . $object->ref . "\"
|
||||
DATE=\"" . dol_print_date($object->date,'') . "\"
|
||||
NB_ITEMS=\"" . $nblignes . "\"
|
||||
|
||||
@ -3937,13 +3937,10 @@ function get_product_localtax_for_country($idprod, $local, $thirdparty_seller)
|
||||
* @return float Taux de tva a appliquer, -1 si ne peut etre determine
|
||||
* @see get_default_npr, get_default_localtax
|
||||
*/
|
||||
function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (!is_object($thirdparty_seller)) return -1;
|
||||
if (!is_object($thirdparty_buyer)) return -1;
|
||||
|
||||
// Note: possible values for tva_assuj are 0/1 or franchise/reel
|
||||
$seller_use_vat=((is_numeric($thirdparty_seller->tva_assuj) && ! $thirdparty_seller->tva_assuj) || (! is_numeric($thirdparty_seller->tva_assuj) && $thirdparty_seller->tva_assuj=='franchise'))?0:1;
|
||||
|
||||
@ -4020,7 +4017,7 @@ function get_default_tva($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idpr
|
||||
* @return float 0 or 1
|
||||
* @see get_default_tva, get_default_localtax
|
||||
*/
|
||||
function get_default_npr($thirdparty_seller, $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
function get_default_npr(Societe $thirdparty_seller, Societe $thirdparty_buyer, $idprod=0, $idprodfournprice=0)
|
||||
{
|
||||
global $db;
|
||||
|
||||
|
||||
@ -289,11 +289,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
else $socobject = $object->thirdparty;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
|
||||
@ -556,12 +556,12 @@ class pdf_strato extends ModelePDFContract
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R');
|
||||
|
||||
if ($object->client->code_client)
|
||||
if ($object->thirdparty->code_client)
|
||||
{
|
||||
$posy+=4;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->thirdparty->code_client), '', 'R');
|
||||
}
|
||||
|
||||
if ($showaddress)
|
||||
@ -576,7 +576,7 @@ class pdf_strato extends ModelePDFContract
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
|
||||
}
|
||||
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -614,19 +614,19 @@ class pdf_strato extends ModelePDFContract
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
$this->recipient = $object->client;
|
||||
$this->recipient = $object->thirdparty;
|
||||
|
||||
//Recipient name
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$this->recipient->name = pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target', $object);
|
||||
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, (isset($object->contact)?$object->contact:''), $usecontact, 'target', $object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -289,11 +289,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
else $socobject = $object->thirdparty;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
|
||||
@ -291,14 +291,14 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else {
|
||||
$socobject = $object->client;
|
||||
$socobject = $object->thirdparty;
|
||||
// if we have a BILLING contact and we dont use it as recipient we store the contact object for later use
|
||||
$contactobject = $object->contact;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Fetch info for linked propal
|
||||
|
||||
@ -1061,7 +1061,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
|
||||
@ -1113,7 +1113,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if ($showaddress)
|
||||
{
|
||||
// Sender properties
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
|
||||
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty);
|
||||
|
||||
// Show sender
|
||||
$posy=42;
|
||||
@ -1158,12 +1158,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
if ($usecontact && !empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
|
||||
$thirdparty = $object->contact;
|
||||
} else {
|
||||
$thirdparty = $object->client;
|
||||
$thirdparty = $object->thirdparty;
|
||||
}
|
||||
|
||||
$carac_client_name= pdfBuildThirdpartyName($thirdparty, $outputlangs);
|
||||
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->thirdparty,($usecontact?$object->contact:''),$usecontact,'target',$object);
|
||||
|
||||
// Show recipient
|
||||
$widthrecbox=100;
|
||||
|
||||
@ -320,11 +320,11 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
{
|
||||
// On peut utiliser le nom de la societe du contact
|
||||
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||
else $socobject = $object->client;
|
||||
else $socobject = $object->thirdparty;
|
||||
}
|
||||
else
|
||||
{
|
||||
$socobject=$object->client;
|
||||
$socobject=$object->thirdparty;
|
||||
}
|
||||
|
||||
// Make substitution
|
||||
|
||||
@ -803,7 +803,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$actioncomm->fk_element = $object->id;
|
||||
$actioncomm->elementtype = $object->element;
|
||||
|
||||
$ret=$actioncomm->add($user); // User creating action
|
||||
$ret=$actioncomm->create($user); // User creating action
|
||||
|
||||
unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action.
|
||||
|
||||
|
||||
@ -264,7 +264,7 @@ if ($action == 'builddoc')
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -501,7 +501,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -1562,7 +1562,7 @@ else if ($id || $ref)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
|
||||
if (empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -1850,7 +1850,7 @@ else if ($id || $ref)
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->client->default_lang;
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
|
||||
@ -530,7 +530,7 @@ if ($id > 0 || ! empty($ref))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if (empty($newlang)) $newlang=$commande->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$commande->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -123,7 +123,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -152,7 +152,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -410,7 +410,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -515,7 +515,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -612,7 +612,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -647,7 +647,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -668,7 +668,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -688,7 +688,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -750,12 +750,12 @@ if (empty($reshook))
|
||||
// Recipient was provided from combo list
|
||||
if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $object->client->email;
|
||||
$sendto = $object->thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $object->client->contact_get_property(GETPOST('receiver'),'email');
|
||||
$sendto = $object->thirdparty->contact_get_property(GETPOST('receiver'),'email');
|
||||
$sendtoid = GETPOST('receiver','alpha');
|
||||
}
|
||||
}
|
||||
@ -1261,12 +1261,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
// Print form confirm
|
||||
print $formconfirm;
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST" name="formfichinter">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
if ($action == 'edit_extras') print '<input type="hidden" name="action" value="update_extras">';
|
||||
if ($action == 'contrat') print '<input type="hidden" name="action" value="setcontrat">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||
@ -1277,7 +1271,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
print '</td></tr>';
|
||||
|
||||
// Third party
|
||||
print "<tr><td>".$langs->trans("Company").'</td><td colspan="3">'.$object->client->getNomUrl(1)."</td></tr>";
|
||||
print "<tr><td>".$langs->trans("Company").'</td><td colspan="3">'.$object->thirdparty->getNomUrl(1)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
|
||||
{
|
||||
@ -1406,8 +1400,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '</form>';
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
|
||||
{
|
||||
$blocname = 'contacts';
|
||||
@ -1824,7 +1816,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->client->default_lang;
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
|
||||
@ -133,11 +133,11 @@ if ($id > 0 || ! empty($ref))
|
||||
print "</td></tr>";
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->client) )
|
||||
if ( is_null($object->thirdparty) )
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
print "<tr><td>".$langs->trans("Company")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
print "</table>";
|
||||
|
||||
print '</div>';
|
||||
|
||||
@ -111,7 +111,7 @@ if ($object->id)
|
||||
print '</td></tr>';
|
||||
|
||||
// Societe
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
|
||||
print "<tr><td>".$langs->trans("Company")."</td><td>".$object->thirdparty->getNomUrl(1)."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||
|
||||
@ -975,7 +975,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
}
|
||||
else if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
|
||||
{
|
||||
$num = $this->getNextNumRef($this->client);
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1184,12 +1184,12 @@ if (empty($reshook))
|
||||
// Recipient was provided from combo list
|
||||
if (GETPOST('receiver','alpha') == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $object->client->email;
|
||||
$sendto = $object->thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $object->client->contact_get_property(GETPOST('receiver','alpha'),'email');
|
||||
$sendto = $object->thirdparty->contact_get_property(GETPOST('receiver','alpha'),'email');
|
||||
$sendtoid = GETPOST('receiver','alpha');
|
||||
}
|
||||
}
|
||||
@ -2451,7 +2451,7 @@ elseif (! empty($object->id))
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->client->default_lang;
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
|
||||
@ -976,12 +976,12 @@ if (empty($reshook))
|
||||
// Recipient was provided from combo list
|
||||
if ($_POST['receiver'] == 'thirdparty') // Id of third party
|
||||
{
|
||||
$sendto = $object->client->email;
|
||||
$sendto = $object->thirdparty->email;
|
||||
$sendtoid = 0;
|
||||
}
|
||||
else // Id du contact
|
||||
{
|
||||
$sendto = $object->client->contact_get_property($_POST['receiver'],'email');
|
||||
$sendto = $object->thirdparty->contact_get_property($_POST['receiver'],'email');
|
||||
$sendtoid = $_POST['receiver'];
|
||||
}
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ if (empty($reshook))
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -2423,7 +2423,7 @@ else
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
||||
$newlang = $_REQUEST['lang_id'];
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
||||
$newlang = $object->client->default_lang;
|
||||
$newlang = $object->thirdparty->default_lang;
|
||||
|
||||
if (!empty($newlang))
|
||||
{
|
||||
|
||||
@ -102,6 +102,8 @@ UPDATE llx_projet as p set p.opp_percent = (SELECT percent FROM llx_c_lead_statu
|
||||
ALTER TABLE llx_facturedet ADD COLUMN fk_contract_line integer NULL AFTER rang;
|
||||
ALTER TABLE llx_facturedet_rec ADD COLUMN import_key varchar(14);
|
||||
|
||||
--DROP TABLE llx_website_page;
|
||||
--DROP TABLE llx_website;
|
||||
CREATE TABLE llx_website
|
||||
(
|
||||
rowid integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
|
||||
@ -255,7 +255,7 @@ if ($action == 'builddoc') // En get ou en post
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -413,7 +413,7 @@ if ($action == 'create') // Seems to no be used
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if (empty($newlang)) $newlang=$commande->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$commande->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
@ -755,7 +755,7 @@ else
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
|
||||
if (empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if (empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -236,6 +236,12 @@ print '<td>'.$langs->trans('ForceBuyingPriceIfNullDetails').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
// GLOBAL DISCOUNT MANAGEMENT
|
||||
$methods = array(
|
||||
1 => $langs->trans('UseDiscountAsProduct'),
|
||||
2 => $langs->trans('UseDiscountAsService'),
|
||||
3 => $langs->trans('UseDiscountOnTotal')
|
||||
);
|
||||
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
@ -243,20 +249,7 @@ print "<input type=\"hidden\" name=\"action\" value=\"remises\">";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>'.$langs->trans("MARGIN_METHODE_FOR_DISCOUNT").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<select name="MARGIN_METHODE_FOR_DISCOUNT" class="flat">';
|
||||
print '<option value="1" ';
|
||||
if (isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT) && $conf->global->MARGIN_METHODE_FOR_DISCOUNT == '1')
|
||||
print 'selected ';
|
||||
print '>'.$langs->trans('UseDiscountAsProduct').'</option>';
|
||||
print '<option value="2" ';
|
||||
if (isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT) && $conf->global->MARGIN_METHODE_FOR_DISCOUNT == '2')
|
||||
print 'selected ';
|
||||
print '>'.$langs->trans('UseDiscountAsService').'</option>';
|
||||
print '<option value="3" ';
|
||||
if (isset($conf->global->MARGIN_METHODE_FOR_DISCOUNT) && $conf->global->MARGIN_METHODE_FOR_DISCOUNT == '3')
|
||||
print 'selected ';
|
||||
print '>'.$langs->trans('UseDiscountOnTotal').'</option>';
|
||||
print '</select>';
|
||||
print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, $conf->global->MARGIN_METHODE_FOR_DISCOUNT);
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||
|
||||
@ -183,7 +183,7 @@ if (! empty($action) && $action == 'fetch' && ! empty($id))
|
||||
if (empty($mode) || $mode == 1) {
|
||||
$arrayresult = $form->select_produits_list("", $htmlname, $type, "", $price_level, $searchkey, $status, $finished, $outjson, $socid);
|
||||
} elseif ($mode == 2) {
|
||||
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson, $socid);
|
||||
$arrayresult = $form->select_produits_fournisseurs_list($socid, "", $htmlname, $type, "", $searchkey, $status, $outjson);
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -44,7 +44,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/product/modules_product.php';
|
||||
|
||||
@ -152,7 +151,7 @@ if (empty($reshook))
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
|
||||
@ -262,43 +262,11 @@ if ($object->id)
|
||||
|
||||
print '<tr class="liste_titre"><td>';
|
||||
|
||||
$delauft_lang = (empty($lang_id)) ? $langs->getDefaultLang() : $lang_id;
|
||||
$delauft_lang = empty($lang_id) ? $langs->getDefaultLang() : $lang_id;
|
||||
|
||||
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12);
|
||||
|
||||
print '<select class="flat" id="lang_id" name="lang_id">';
|
||||
|
||||
asort($langs_available);
|
||||
|
||||
$uncompletelanguages = array (
|
||||
'da_DA',
|
||||
'fi_FI',
|
||||
'hu_HU',
|
||||
'is_IS',
|
||||
'pl_PL',
|
||||
'ro_RO',
|
||||
'ru_RU',
|
||||
'sv_SV',
|
||||
'tr_TR',
|
||||
'zh_CN'
|
||||
);
|
||||
foreach ( $langs_available as $key => $value )
|
||||
{
|
||||
if ($showwarning && in_array($key, $uncompletelanguages))
|
||||
{
|
||||
// $value.=' - '.$langs->trans("TranslationUncomplete",$key);
|
||||
}
|
||||
if ($filter && is_array($filter)) {
|
||||
if (! array_key_exists($key, $filter)) {
|
||||
print '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
} else if ($delauft_lang == $key) {
|
||||
print '<option value="' . $key . '" selected>' . $value . '</option>';
|
||||
} else {
|
||||
print '<option value="' . $key . '">' . $value . '</option>';
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
print Form::selectarray('lang_id', $langs_available, $delauft_lang, 0, 0, 0, '', 0, 0, 0, 'ASC');
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS) {
|
||||
print '<input type="submit" class="button" name="refresh" value="' . $langs->trans('Refresh') . '">';
|
||||
|
||||
@ -439,12 +439,12 @@ abstract class ActionsCardCommon
|
||||
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
|
||||
|
||||
// TODO create a function
|
||||
$this->tpl['select_customertype'] = '<select class="flat" name="client">';
|
||||
$this->tpl['select_customertype'].= '<option value="2"'.($this->object->client==2?' selected':'').'>'.$langs->trans('Prospect').'</option>';
|
||||
$this->tpl['select_customertype'].= '<option value="3"'.($this->object->client==3?' selected':'').'>'.$langs->trans('ProspectCustomer').'</option>';
|
||||
$this->tpl['select_customertype'].= '<option value="1"'.($this->object->client==1?' selected':'').'>'.$langs->trans('Customer').'</option>';
|
||||
$this->tpl['select_customertype'].= '<option value="0"'.($this->object->client==0?' selected':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
|
||||
$this->tpl['select_customertype'].= '</select>';
|
||||
$this->tpl['select_customertype'] = Form::selectarray('client', array(
|
||||
0 => $langs->trans('NorProspectNorCustomer'),
|
||||
1 => $langs->trans('Customer'),
|
||||
2 => $langs->trans('Prospect'),
|
||||
3 => $langs->trans('ProspectCustomer')
|
||||
), $this->object->client);
|
||||
|
||||
// Customer
|
||||
$this->tpl['customercode'] = $this->object->code_client;
|
||||
|
||||
@ -678,6 +678,7 @@ class Societe extends CommonObject
|
||||
$this->idprof5 = (! empty($this->idprof5)?trim($this->idprof5):'');
|
||||
$this->idprof6 = (! empty($this->idprof6)?trim($this->idprof6):'');
|
||||
$this->prefix_comm = trim($this->prefix_comm);
|
||||
$this->outstanding_limit = price2num($this->outstanding_limit);
|
||||
|
||||
$this->tva_assuj = trim($this->tva_assuj);
|
||||
$this->tva_intra = dol_sanitizeFileName($this->tva_intra,'');
|
||||
@ -831,7 +832,7 @@ class Societe extends CommonObject
|
||||
$sql .= ",prefix_comm = ".(! empty($this->prefix_comm)?"'".$this->db->escape($this->prefix_comm)."'":"null");
|
||||
|
||||
$sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null");
|
||||
|
||||
$sql .= ",fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0");
|
||||
|
||||
$sql .= ",fk_forme_juridique = ".(! empty($this->forme_juridique_code)?"'".$this->db->escape($this->forme_juridique_code)."'":"null");
|
||||
@ -847,6 +848,8 @@ class Societe extends CommonObject
|
||||
$sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null");
|
||||
$sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null");
|
||||
$sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null");
|
||||
$sql .= ",outstanding_limit= '".($this->outstanding_limit!=''?$this->outstanding_limit:'null')."'";
|
||||
$sql .= ",fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
|
||||
$sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null");
|
||||
$sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null");
|
||||
@ -3178,30 +3181,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_prospect_level(User $user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::set_prospect_level", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3274,31 +3258,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_commnucation_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_commnucation_level", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3306,35 +3270,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_OutstandingBill(User $user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
$outstanding = price2num($this->outstanding_limit);
|
||||
|
||||
// Set outstanding amount
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " outstanding_limit= '".($outstanding!=''?$outstanding:'null')."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_outstanding", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -191,7 +191,7 @@ if (empty($reshook))
|
||||
$object = new Client($db);
|
||||
$result=$object->fetch(GETPOST('stcommsocid'));
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
|
||||
$action='';
|
||||
|
||||
@ -221,16 +221,16 @@ class SupplierProposal extends CommonObject
|
||||
|
||||
$productdesc = $prod->description;
|
||||
|
||||
$tva_tx = get_default_tva($mysoc,$this->client,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->client,$prod->id);
|
||||
$tva_tx = get_default_tva($mysoc,$this->thirdparty,$prod->id);
|
||||
$tva_npr = get_default_npr($mysoc,$this->thirdparty,$prod->id);
|
||||
if (empty($tva_tx)) $tva_npr=0;
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->client,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->client,$tva_npr);
|
||||
$localtax1_tx = get_localtax($tva_tx,1,$mysoc,$this->thirdparty,$tva_npr);
|
||||
$localtax2_tx = get_localtax($tva_tx,2,$mysoc,$this->thirdparty,$tva_npr);
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->client->price_level)
|
||||
if($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level)
|
||||
{
|
||||
$price = $prod->multiprices[$this->client->price_level];
|
||||
$price = $prod->multiprices[$this->thirdparty->price_level];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1662,7 +1662,7 @@ class SupplierProposal extends CommonObject
|
||||
if (! empty($conf->global->MAIN_MULTILANGS))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->client->default_lang);
|
||||
$newlang=(GETPOST('lang_id') ? GETPOST('lang_id') : $this->thirdparty->default_lang);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
//$ret=$object->fetch($id); // Reload to get new records
|
||||
@ -1764,7 +1764,7 @@ class SupplierProposal extends CommonObject
|
||||
$values = array(
|
||||
"'".$this->db->idate($now)."'",
|
||||
$product->fk_product,
|
||||
$this->client->id,
|
||||
$this->thirdparty->id,
|
||||
"'".$product->ref_fourn."'",
|
||||
$price,
|
||||
$qty,
|
||||
|
||||
@ -87,10 +87,10 @@ if ($id > 0 || ! empty($ref))
|
||||
print '</td></tr>';
|
||||
|
||||
// Customer
|
||||
if ( is_null($object->client) )
|
||||
if ( is_null($object->thirdparty) )
|
||||
$object->fetch_thirdparty();
|
||||
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('SupplierProposalDate').'</td><td colspan="3">';
|
||||
print dol_print_date($object->date_livraison,'daytext');
|
||||
|
||||
@ -459,7 +459,7 @@ function createActionComm($authentication,$actioncomm)
|
||||
|
||||
$db->begin();
|
||||
|
||||
$result=$newobject->add($fuser);
|
||||
$result=$newobject->create($fuser);
|
||||
if ($result <= 0)
|
||||
{
|
||||
$error++;
|
||||
|
||||
@ -374,7 +374,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang=''
|
||||
$product->load_stock();
|
||||
|
||||
$dir = (!empty($conf->product->dir_output)?$conf->product->dir_output:$conf->service->dir_output);
|
||||
$pdir = get_exdir($product->id,2,0,0,$product,'product') . $product->id ."/photos/";
|
||||
$pdir = get_exdir($product->id,2,0,0,$product,'product') . $product->ref . "/";
|
||||
$dir = $dir . '/'. $pdir;
|
||||
|
||||
if (! empty($product->multilangs[$langs->defaultlang]["label"])) $product->label = $product->multilangs[$langs->defaultlang]["label"];
|
||||
|
||||
@ -55,9 +55,9 @@ class WebsitePage extends CommonObject
|
||||
public $keywords;
|
||||
public $content;
|
||||
public $status;
|
||||
public $date_creation = '';
|
||||
public $date_modification = '';
|
||||
public $tms = '';
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
public $tms;
|
||||
|
||||
/**
|
||||
*/
|
||||
@ -71,7 +71,6 @@ class WebsitePage extends CommonObject
|
||||
public function __construct(DoliDB $db)
|
||||
{
|
||||
$this->db = $db;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,11 +545,10 @@ class WebsitePage extends CommonObject
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
global $menumanager;
|
||||
|
||||
|
||||
$result = '';
|
||||
$companylink = '';
|
||||
|
||||
$label = '<u>' . $langs->trans("MyModule") . '</u>';
|
||||
$label = '<u>' . $langs->trans("Page") . '</u>';
|
||||
$label.= '<div width="100%">';
|
||||
$label.= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user