Merge branch '15.0' of github.com:Dolibarr/dolibarr into 15_fix_bad_error_message_CronJobSendEmailsRemindersOnInvoiceDueDate
This commit is contained in:
commit
9f8a09b4c8
@ -785,12 +785,13 @@ class AccountancyCategory // extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of custom groups that are active
|
||||
* Return list of custom groups.
|
||||
*
|
||||
* @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups
|
||||
* @param int $active 1= active, 0=not active
|
||||
* @return array|int Array of groups or -1 if error
|
||||
*/
|
||||
public function getCats($categorytype = -1)
|
||||
public function getCats($categorytype = -1, $active = 1)
|
||||
{
|
||||
global $conf, $mysoc;
|
||||
|
||||
@ -801,7 +802,7 @@ class AccountancyCategory // extends CommonObject
|
||||
|
||||
$sql = "SELECT c.rowid, c.code, c.label, c.formula, c.position, c.category_type, c.sens";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as c";
|
||||
$sql .= " WHERE c.active = 1";
|
||||
$sql .= " WHERE c.active = " . (int) $active;
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
if ($categorytype >= 0) {
|
||||
$sql .= " AND c.category_type = 1";
|
||||
|
||||
@ -891,7 +891,8 @@ class BookKeeping extends CommonObject
|
||||
}
|
||||
// Affichage par compte comptable
|
||||
if (!empty($option)) {
|
||||
$sql .= ' AND t.subledger_account IS NOT NULL';
|
||||
$sql .= " AND t.subledger_account IS NOT NULL";
|
||||
$sql .= " AND t.subledger_account <> ''";
|
||||
$sortfield = 't.subledger_account'.($sortfield ? ','.$sortfield : '');
|
||||
$sortorder = 'ASC'.($sortfield ? ','.$sortfield : '');
|
||||
} else {
|
||||
|
||||
@ -328,8 +328,8 @@ class Adherent extends CommonObject
|
||||
'photo' => array('type' => 'varchar(255)', 'label' => 'Photo', 'enabled' => 1, 'visible' => -1, 'position' => 135),
|
||||
'public' => array('type' => 'smallint(6)', 'label' => 'Public', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 145),
|
||||
'datefin' => array('type' => 'datetime', 'label' => 'DateEnd', 'enabled' => 1, 'visible' => -1, 'position' => 150),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'note_private' => array('type' => 'text', 'label' => 'NotePrivate', 'enabled' => 1, 'visible' => 0, 'position' => 155),
|
||||
'note_public' => array('type' => 'text', 'label' => 'NotePublic', 'enabled' => 1, 'visible' => 0, 'position' => 160),
|
||||
'datevalid' => array('type' => 'datetime', 'label' => 'DateValidation', 'enabled' => 1, 'visible' => -1, 'position' => 165),
|
||||
'datec' => array('type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'visible' => -1, 'position' => 170),
|
||||
'tms' => array('type' => 'timestamp', 'label' => 'DateModification', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 175),
|
||||
|
||||
@ -336,7 +336,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."adherent as d";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (d.rowid = ef.fk_object)";
|
||||
}
|
||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||
if ((!empty($search_categ) && ($search_categ > 0 || $search_categ == -2)) || !empty($catid)) {
|
||||
// We need this table joined to the select in order to filter by categ
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_member as cm ON d.rowid = cm.fk_member";
|
||||
}
|
||||
|
||||
@ -1978,7 +1978,7 @@ if ($id) {
|
||||
} elseif ($value == 'fk_tva') {
|
||||
foreach ($form->cache_vatrates as $key => $Tab) {
|
||||
if ($form->cache_vatrates[$key]['rowid'] == $valuetoshow) {
|
||||
$valuetoshow = $form->cache_vatrates[$key]['libtva'];
|
||||
$valuetoshow = $form->cache_vatrates[$key]['label'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso") {
|
||||
print ' }';
|
||||
|
||||
print ' function generatelink(){';
|
||||
print ' return "security.php?action=updatepattern&pattern="+getStringArg();';
|
||||
print ' return "security.php?action=updatepattern&token='.newToken().'&pattern="+getStringArg();';
|
||||
print ' }';
|
||||
|
||||
print ' function valuePatternChange(){';
|
||||
|
||||
@ -29,35 +29,50 @@
|
||||
*/
|
||||
function printDropdownBookmarksList()
|
||||
{
|
||||
global $conf, $user, $db, $langs;
|
||||
global $conf, $user, $db, $langs, $sortfield, $sortorder;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
|
||||
$langs->load("bookmarks");
|
||||
|
||||
$authorized_var=array('limit','optioncss','contextpage');
|
||||
$url = $_SERVER["PHP_SELF"];
|
||||
|
||||
$url_param=array();
|
||||
if (!empty($_SERVER["QUERY_STRING"])) {
|
||||
$url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : '');
|
||||
} else {
|
||||
global $sortfield, $sortorder;
|
||||
$tmpurl = '';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) {
|
||||
$tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield);
|
||||
}
|
||||
if ($sortorder) {
|
||||
$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
|
||||
}
|
||||
if (is_array($_POST)) {
|
||||
foreach ($_POST as $key => $val) {
|
||||
if (preg_match('/^search_/', $key) && $val != '') {
|
||||
$tmpurl .= ($tmpurl ? '&' : '').http_build_query(array($key => $val));
|
||||
if (is_array($_GET)) {
|
||||
foreach ($_GET as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $tmpsubval) {
|
||||
$url_param[] = http_build_query(array(dol_escape_htmltag($key).'[]' => dol_escape_htmltag($tmpsubval)));
|
||||
}
|
||||
} elseif ($val != '') {
|
||||
$url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
|
||||
}
|
||||
}
|
||||
}
|
||||
$url .= ($tmpurl ? '?'.$tmpurl : '');
|
||||
}
|
||||
$tmpurl = '';
|
||||
// No urlencode, all param $url will be urlencoded later
|
||||
if ($sortfield) {
|
||||
$tmpurl .= ($tmpurl ? '&' : '').'sortfield='.urlencode($sortfield);
|
||||
}
|
||||
if ($sortorder) {
|
||||
$tmpurl .= ($tmpurl ? '&' : '').'sortorder='.urlencode($sortorder);
|
||||
}
|
||||
if (is_array($_POST)) {
|
||||
foreach ($_POST as $key => $val) {
|
||||
if ((preg_match('/^search_/', $key) || in_array($key, $authorized_var))
|
||||
&& $val != ''
|
||||
&& !array_key_exists($key, $url_param)) {
|
||||
$url_param[$key] = http_build_query(array(dol_escape_htmltag($key) => dol_escape_htmltag($val)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$url .= ($tmpurl ? '?'.$tmpurl : '');
|
||||
if (!empty($url_param)) {
|
||||
$url .= '&'.implode('&', $url_param);
|
||||
}
|
||||
|
||||
$searchForm = '<!-- form with POST method by default, will be replaced with GET for external link by js -->'."\n";
|
||||
|
||||
@ -1599,7 +1599,7 @@ if ($action == 'create') {
|
||||
//$warehouse_id = $soc->warehouse_id;
|
||||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@ -317,8 +317,8 @@ class Propal extends CommonObject
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'Currency', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
|
||||
@ -1924,7 +1924,7 @@ if ($resql) {
|
||||
// Note public
|
||||
if (!empty($arrayfields['p.note_public']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -1933,7 +1933,7 @@ if ($resql) {
|
||||
// Note private
|
||||
if (!empty($arrayfields['p.note_private']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -1608,7 +1608,7 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td>';
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
print img_picto('', 'company').$form->select_company('', 'socid', '((s.client = 1 OR s.client = 2 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth175 maxwidth500 widthcentpercentminusxx');
|
||||
// reload page to retrieve customer informations
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@ -319,8 +319,8 @@ class Commande extends CommonOrder
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'LocalTax2', 'enabled'=>1, 'visible'=>-1, 'position'=>135, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>150),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
|
||||
@ -1832,7 +1832,7 @@ if ($resql) {
|
||||
// Note public
|
||||
if (!empty($arrayfields['c.note_public']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -1842,7 +1842,7 @@ if ($resql) {
|
||||
// Note private
|
||||
if (!empty($arrayfields['c.note_private']['checked'])) {
|
||||
print '<td align="center" class="nowrap">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -614,7 +614,7 @@ if (!empty($date_start) && !empty($date_stop)) {
|
||||
|
||||
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
|
||||
|
||||
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.currentToken().'&output=file&file='.urlencode($filename).$param.'"';
|
||||
if (empty($TData)) {
|
||||
print " disabled";
|
||||
}
|
||||
|
||||
@ -303,7 +303,7 @@ class Account extends CommonObject
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
|
||||
@ -3071,7 +3071,7 @@ if ($action == 'create') {
|
||||
} else {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Customer').'</td>';
|
||||
print '<td colspan="2">';
|
||||
print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print img_picto('', 'company').$form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status = 1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
// Option to reload page to retrieve customer informations.
|
||||
if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) {
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@ -184,8 +184,8 @@ class FactureRec extends CommonInvoice
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'Fk cond reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>90),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'Fk mode reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>95),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'Date lim reglement', 'enabled'=>1, 'visible'=>-1, 'position'=>100),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'modelpdf' =>array('type'=>'varchar(255)', 'label'=>'Modelpdf', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'date_last_gen' =>array('type'=>'varchar(7)', 'label'=>'Last gen', 'enabled'=>1, 'visible'=>-1, 'position'=>120),
|
||||
'unit_frequency' =>array('type'=>'varchar(2)', 'label'=>'Unit frequency', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2016-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2022 Sylvain Legrand <contact@infras.fr>
|
||||
*
|
||||
@ -129,21 +129,32 @@ class Facture extends CommonInvoice
|
||||
/**
|
||||
* @var int Date expected for delivery
|
||||
* @deprecated
|
||||
* @see delivery_date
|
||||
*/
|
||||
public $date_livraison; // deprecated; Use delivery_date instead.
|
||||
public $date_livraison;
|
||||
|
||||
/**
|
||||
* @var int Date expected for delivery
|
||||
*/
|
||||
public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after)
|
||||
|
||||
/**
|
||||
* @var string customer ref
|
||||
* @deprecated
|
||||
* @see ref_customer
|
||||
*/
|
||||
public $ref_client;
|
||||
|
||||
/**
|
||||
* @var string customer ref
|
||||
*/
|
||||
public $ref_customer;
|
||||
|
||||
/**
|
||||
* @var int Ref Int
|
||||
* @deprecated
|
||||
*/
|
||||
public $ref_int; // deprecated
|
||||
public $ref_int;
|
||||
|
||||
//Check constants for types
|
||||
public $type = self::TYPE_STANDARD;
|
||||
@ -328,8 +339,8 @@ class Facture extends CommonInvoice
|
||||
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'CurrencyCode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>190),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>205),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>210),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>215),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>225),
|
||||
'situation_cycle_ref' =>array('type'=>'smallint(6)', 'label'=>'Situation cycle ref', 'enabled'=>'$conf->global->INVOICE_USE_SITUATION', 'visible'=>-1, 'position'=>230),
|
||||
@ -1684,8 +1695,9 @@ class Facture extends CommonInvoice
|
||||
$this->id = $obj->rowid;
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_client = $obj->ref_client;
|
||||
$this->ref_customer = $obj->ref_client;
|
||||
$this->ref_ext = $obj->ref_ext;
|
||||
$this->type = $obj->type;
|
||||
$this->date = $this->db->jdate($obj->df);
|
||||
@ -3253,7 +3265,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline id=$this->id,desc=$desc,pu_ht=$pu_ht,qty=$qty,txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product,remise_percent=$remise_percent,date_start=$date_start,date_end=$date_end,ventil=$ventil,info_bits=$info_bits,fk_remise_except=$fk_remise_except,price_base_type=$price_base_type,pu_ttc=$pu_ttc,type=$type, fk_unit=$fk_unit", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::addline id=$this->id, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, date_start=$date_start, date_end=$date_end, ventil=$ventil, info_bits=$info_bits, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, desc=".dol_trunc($desc, 25), LOG_DEBUG);
|
||||
|
||||
if ($this->statut == self::STATUS_DRAFT) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -4903,7 +4915,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
/**
|
||||
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
|
||||
* @return number or -1 if not available
|
||||
* @return float or -1 if not available
|
||||
*/
|
||||
public function getRetainedWarrantyAmount($rounding = -1)
|
||||
{
|
||||
|
||||
@ -2273,7 +2273,7 @@ if ($resql) {
|
||||
// Note public
|
||||
if (!empty($arrayfields['f.note_public']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -2282,7 +2282,7 @@ if ($resql) {
|
||||
// Note private
|
||||
if (!empty($arrayfields['f.note_private']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -454,9 +454,6 @@ class BonPrelevement extends CommonObject
|
||||
dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
|
||||
}
|
||||
}
|
||||
//var_dump($paiement->amounts);
|
||||
//var_dump($thirdpartyid);
|
||||
//var_dump($cursoramounts);
|
||||
}
|
||||
|
||||
// Update withdrawal line
|
||||
@ -1057,9 +1054,9 @@ class BonPrelevement extends CommonObject
|
||||
$this->emetteur_iban = $account->iban;
|
||||
$this->emetteur_bic = $account->bic;
|
||||
|
||||
$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics);
|
||||
$this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics);
|
||||
|
||||
$this->raison_sociale = $account->proprio;
|
||||
$this->raison_sociale = $account->proprio;
|
||||
}
|
||||
|
||||
$this->factures = $factures_prev_id;
|
||||
@ -2208,7 +2205,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_SEPA_INFO .= ' </CdtrSchmeId>'.$CrLf;*/
|
||||
}
|
||||
} else {
|
||||
fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf);
|
||||
fputs($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
|
||||
$XML_SEPA_INFO = '';
|
||||
}
|
||||
return $XML_SEPA_INFO;
|
||||
}
|
||||
|
||||
@ -1062,7 +1062,11 @@ if ($modecompta == 'BOOKKEEPING') {
|
||||
$sql .= " AND $column >= '".$db->idate($date_start)."' AND $column <= '".$db->idate($date_end)."'";
|
||||
}
|
||||
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
//No need of GROUP BY
|
||||
} else {
|
||||
$sql .= " GROUP BY u.rowid, p.rowid, p.ref, u.firstname, u.lastname, dm";
|
||||
}
|
||||
$newsortfield = $sortfield;
|
||||
if ($newsortfield == 's.nom, s.rowid') {
|
||||
$newsortfield = 'p.ref';
|
||||
@ -1520,15 +1524,17 @@ $hookmanager->initHooks(array('externalbalance'));
|
||||
$reshook = $hookmanager->executeHooks('addBalanceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
||||
|
||||
// Total
|
||||
print '<tr>';
|
||||
print '<td colspan="4"> </td>';
|
||||
print '<td colspan="'.($modecompta == 'BOOKKEEPING' ? 3 : 4).'"> </td>';
|
||||
print '</tr>';
|
||||
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Income").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht_income, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc_income, 'MT')).'</td>';
|
||||
@ -1536,7 +1542,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Outcome").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ht_outcome, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num(-$total_ttc_outcome, 'MT')).'</td>';
|
||||
@ -1544,7 +1550,7 @@ print '</tr>';
|
||||
print '<tr class="liste_total"><td class="left" colspan="2">'.$langs->trans("Profit").'</td>';
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
print '<td class="liste_total right">'.price(price2num($total_ht, 'MT')).'</td>';
|
||||
} else {
|
||||
} elseif ($modecompta == 'RECETTES-DEPENSES') {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="liste_total right">'.price(price2num($total_ttc, 'MT')).'</td>';
|
||||
|
||||
@ -274,6 +274,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
} elseif ($modecompta == "BOOKKEEPING") {
|
||||
// Get array of all report groups that are active
|
||||
$cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include
|
||||
$unactive_cats = $AccCat->getCats(-1, 0);
|
||||
|
||||
/*
|
||||
$sql = 'SELECT DISTINCT t.numero_compte as nb FROM '.MAIN_DB_PREFIX.'accounting_bookkeeping as t, '.MAIN_DB_PREFIX.'accounting_account as aa';
|
||||
@ -325,6 +326,11 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
$vars = array();
|
||||
|
||||
// Unactive categories have a total of 0 to be used in the formula.
|
||||
foreach ($unactive_cats as $un_cat) {
|
||||
$vars[$un_cat['code']] = 0;
|
||||
}
|
||||
|
||||
// Previous Fiscal year (N-1)
|
||||
foreach ($sommes as $code => $det) {
|
||||
$vars[$code] = $det['NP'];
|
||||
@ -405,6 +411,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
|
||||
// Set $cpts with array of accounts in the category/group
|
||||
$cpts = $AccCat->getCptsCat($cat['rowid']);
|
||||
// We should loop over empty $cpts array, else the category _code_ is used in the formula, which leads to wrong result if the code is a number.
|
||||
if (empty($cpts)) $cpts[] = array();
|
||||
|
||||
|
||||
$arrayofaccountforfilter = array();
|
||||
foreach ($cpts as $i => $cpt) { // Loop on each account.
|
||||
@ -477,7 +486,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
// Label of group
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($cat['label']);
|
||||
if (count($cpts) > 0) { // Show example of 5 first accounting accounts
|
||||
if (count($cpts) > 0 && !empty($cpts[0])) { // Show example of 5 first accounting accounts
|
||||
$i = 0;
|
||||
foreach ($cpts as $cpt) {
|
||||
if ($i > 5) {
|
||||
|
||||
@ -1208,6 +1208,15 @@ class Contact extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTACT_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Get all rowid of element_contact linked to a type that is link to llx_socpeople
|
||||
$sql = "SELECT ec.rowid";
|
||||
@ -1298,15 +1307,6 @@ class Contact extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error && !$notrigger) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger('CONTACT_DELETE', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
|
||||
@ -237,8 +237,8 @@ class Contrat extends CommonObject
|
||||
'fk_commercial_signature' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial signature', 'enabled'=>1, 'visible'=>-1, 'position'=>80),
|
||||
'fk_commercial_suivi' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk commercial suivi', 'enabled'=>1, 'visible'=>-1, 'position'=>85),
|
||||
'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>90),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>105),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>110),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>115),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>120),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>125),
|
||||
|
||||
@ -815,6 +815,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
$lineid = $result;
|
||||
} else {
|
||||
$lineid = 0;
|
||||
$errors[] = $objecttmp->error;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
@ -959,7 +960,7 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
|
||||
$action = 'create';
|
||||
$_GET["origin"] = $_POST["origin"];
|
||||
$_GET["originid"] = $_POST["originid"];
|
||||
setEventMessages("Error", null, 'errors');
|
||||
setEventMessages("Error", $errors, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -1381,7 +1382,6 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
||||
// @todo : propose model selection
|
||||
if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
|
||||
$db->begin();
|
||||
|
||||
$objecttmp = new $objectclass($db);
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid) {
|
||||
@ -1389,7 +1389,6 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
|
||||
if ($result > 0) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
|
||||
$newlang = GETPOST('lang_id', 'aZ09');
|
||||
}
|
||||
@ -1399,6 +1398,10 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) {
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) {
|
||||
$newlang = $objecttmp->default_lang; // for thirdparty
|
||||
}
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && empty($objecttmp->thirdparty)) { //load lang from thirdparty
|
||||
$objecttmp->fetch_thirdparty();
|
||||
$newlang = $objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||
}
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
|
||||
@ -28,9 +28,10 @@ if (!defined('NOREQUIREHTML')) {
|
||||
if (!defined('NOREQUIREAJAX')) {
|
||||
define('NOREQUIREAJAX', '1');
|
||||
}
|
||||
if (!defined('NOREQUIRESOC')) {
|
||||
// Needed for create other object with workflow
|
||||
/*if (!defined('NOREQUIRESOC')) {
|
||||
define('NOREQUIRESOC', '1');
|
||||
}
|
||||
}*/
|
||||
if (!defined('NOCSRFCHECK')) {
|
||||
define('NOCSRFCHECK', '1');
|
||||
}
|
||||
@ -212,6 +213,15 @@ if ($action == "importSignature") {
|
||||
$db->commit();
|
||||
$response = "success";
|
||||
setEventMessages("PropalSigned", null, 'warnings');
|
||||
if (method_exists($object, 'call_trigger')) {
|
||||
//customer is not a user !?! so could we use same user as validation ?
|
||||
$user = new User($db);
|
||||
$user->fetch($object->user_valid_id);
|
||||
$result = $object->call_trigger('PROPAL_CLOSE_SIGNED', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
$error++;
|
||||
|
||||
@ -3529,10 +3529,11 @@ abstract class CommonObject
|
||||
if (!$resqlfix) {
|
||||
dol_print_error($this->db, 'Failed to update line');
|
||||
}
|
||||
$this->total_tva -= $diff;
|
||||
$this->total_ttc -= $diff;
|
||||
$total_tva_by_vats[$obj->vatrate] -= $diff;
|
||||
$total_ttc_by_vats[$obj->vatrate] -= $diff;
|
||||
|
||||
$this->total_tva = (float) price2num($this->total_tva - $diff, '', 1);
|
||||
$this->total_ttc = (float) price2num($this->total_ttc - $diff, '', 1);
|
||||
$total_tva_by_vats[$obj->vatrate] = (float) price2num($total_tva_by_vats[$obj->vatrate] - $diff, '', 1);
|
||||
$total_ttc_by_vats[$obj->vatrate] = (float) price2num($total_ttc_by_vats[$obj->vatrate] - $diff, '', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3559,9 +3560,16 @@ abstract class CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Clean total
|
||||
$this->total_ht = (float) price2num($this->total_ht);
|
||||
$this->total_tva = (float) price2num($this->total_tva);
|
||||
$this->total_localtax1 = (float) price2num($this->total_localtax1);
|
||||
$this->total_localtax2 = (float) price2num($this->total_localtax2);
|
||||
$this->total_ttc = (float) price2num($this->total_ttc);
|
||||
|
||||
$this->db->free($resql);
|
||||
|
||||
// Now update global field total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
|
||||
// Now update global fields total_ht, total_ttc, total_tva, total_localtax1, total_localtax2, multicurrency_total_*
|
||||
$fieldht = 'total_ht';
|
||||
$fieldtva = 'tva';
|
||||
$fieldlocaltax1 = 'localtax1';
|
||||
@ -3592,11 +3600,11 @@ abstract class CommonObject
|
||||
|
||||
if (empty($nodatabaseupdate)) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.' SET';
|
||||
$sql .= " ".$fieldht." = ".((float) price2num($this->total_ht)).",";
|
||||
$sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva)).",";
|
||||
$sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1)).",";
|
||||
$sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2)).",";
|
||||
$sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc));
|
||||
$sql .= " ".$fieldht." = ".((float) price2num($this->total_ht, 'MT', 1)).",";
|
||||
$sql .= " ".$fieldtva." = ".((float) price2num($this->total_tva, 'MT', 1)).",";
|
||||
$sql .= " ".$fieldlocaltax1." = ".((float) price2num($this->total_localtax1, 'MT', 1)).",";
|
||||
$sql .= " ".$fieldlocaltax2." = ".((float) price2num($this->total_localtax2, 'MT', 1)).",";
|
||||
$sql .= " ".$fieldttc." = ".((float) price2num($this->total_ttc, 'MT', 1));
|
||||
$sql .= ", multicurrency_total_ht = ".((float) price2num($this->multicurrency_total_ht, 'MT', 1));
|
||||
$sql .= ", multicurrency_total_tva = ".((float) price2num($this->multicurrency_total_tva, 'MT', 1));
|
||||
$sql .= ", multicurrency_total_ttc = ".((float) price2num($this->multicurrency_total_ttc, 'MT', 1));
|
||||
@ -4152,7 +4160,7 @@ abstract class CommonObject
|
||||
* @param int $status Status to set
|
||||
* @param int $elementId Id of element to force (use this->id by default if null)
|
||||
* @param string $elementType Type of element to force (use this->table_element by default)
|
||||
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it not recommended and is deprecated.
|
||||
* @param string $trigkey Trigger key to use for trigger. Use '' means automatic but it is not recommended and is deprecated.
|
||||
* @param string $fieldstatus Name of status field in this->table_element
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
@ -4202,41 +4210,49 @@ abstract class CommonObject
|
||||
if ($status == 1 && in_array($elementTable, array('inventory'))) {
|
||||
$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
|
||||
}
|
||||
$sql .= " WHERE rowid=".((int) $elementId);
|
||||
$sql .= " WHERE rowid = ".((int) $elementId);
|
||||
$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
|
||||
|
||||
dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
|
||||
if ($this->db->query($sql)) {
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$error = 0;
|
||||
|
||||
// Try autoset of trigkey
|
||||
if (empty($trigkey)) {
|
||||
if ($this->element == 'supplier_proposal' && $status == 2) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 3) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 4) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 3) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_DONE';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 2) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_BILLED';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 1) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_UNBILLED';
|
||||
}
|
||||
}
|
||||
$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
|
||||
|
||||
if ($trigkey) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger($trigkey, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
if ($nb_rows_affected >= 0) {
|
||||
if (empty($trigkey)) {
|
||||
// Try to guess trigkey (for backward compatibility, now we should have trigkey defined into the call of setStatus)
|
||||
if ($this->element == 'supplier_proposal' && $status == 2) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_SIGN'; // 2 = SupplierProposal::STATUS_SIGNED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 3) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_REFUSE'; // 3 = SupplierProposal::STATUS_REFUSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'supplier_proposal' && $status == 4) {
|
||||
$trigkey = 'SUPPLIER_PROPOSAL_CLOSE'; // 4 = SupplierProposal::STATUS_CLOSED. Can't use constant into this generic class
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 3) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_DONE';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 2) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_BILLED';
|
||||
}
|
||||
if ($this->element == 'fichinter' && $status == 1) {
|
||||
$trigkey = 'FICHINTER_CLASSIFY_UNBILLED';
|
||||
}
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
if ($trigkey) {
|
||||
// Call trigger
|
||||
$result = $this->call_trigger($trigkey, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
} else {
|
||||
// The status was probably already good. We do nothing more, no triggers.
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@ -2088,9 +2088,12 @@ class ExtraFields
|
||||
$dateparamname_end = $keysuffix . 'options_' . $key . $keyprefix . '_end';
|
||||
if (GETPOSTISSET($dateparamname_start . 'year') && GETPOSTISSET($dateparamname_end . 'year')) {
|
||||
// values provided as a date pair (start date + end date), each date being broken down as year, month, day, etc.
|
||||
$dateparamname_end_hour = GETPOST($dateparamname_end . 'hour', 'int') !='-1' ? GETPOST($dateparamname_end . 'hour', 'int') : '23';
|
||||
$dateparamname_end_min = GETPOST($dateparamname_end . 'min', 'int') !='-1' ? GETPOST($dateparamname_end . 'min', 'int') : '59';
|
||||
$dateparamname_end_sec = GETPOST($dateparamname_end . 'sec', 'int') !='-1' ? GETPOST($dateparamname_end . 'sec', 'int') : '59';
|
||||
$value_key = array(
|
||||
'start' => dol_mktime(GETPOST($dateparamname_start . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_start . 'month', 'int'), GETPOST($dateparamname_start . 'day', 'int'), GETPOST($dateparamname_start . 'year', 'int'), 'tzuserrel'),
|
||||
'end' => dol_mktime(GETPOST($dateparamname_end . 'hour', 'int'), GETPOST($dateparamname_start . 'min', 'int'), GETPOST($dateparamname_start . 'sec', 'int'), GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')
|
||||
'end' => dol_mktime($dateparamname_end_hour, $dateparamname_end_min, $dateparamname_end_sec, GETPOST($dateparamname_end . 'month', 'int'), GETPOST($dateparamname_end . 'day', 'int'), GETPOST($dateparamname_end . 'year', 'int'), 'tzuserrel')
|
||||
);
|
||||
} elseif (GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) {
|
||||
// Clean parameters
|
||||
|
||||
@ -892,7 +892,7 @@ class FormFile
|
||||
}
|
||||
$out .= '>';
|
||||
$out .= img_mime($file["name"], $langs->trans("File").': '.$file["name"]);
|
||||
$out .= dol_trunc($file["name"], 40);
|
||||
$out .= dol_trunc($file["name"], 150);
|
||||
$out .= '</a>'."\n";
|
||||
$out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param);
|
||||
$out .= '</td>';
|
||||
@ -1374,7 +1374,7 @@ class FormFile
|
||||
}
|
||||
// Preview link
|
||||
if (!$editline) {
|
||||
print $this->showPreview($file, $modulepart, $filepath, 0, 'entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
|
||||
print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity));
|
||||
}
|
||||
|
||||
print "</td>\n";
|
||||
|
||||
@ -2857,6 +2857,10 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
// Wrapping for import module
|
||||
$accessallowed = $user->rights->import->run;
|
||||
$original_file = $conf->import->dir_temp.'/'.$original_file;
|
||||
} elseif ($modulepart == 'recruitment' && !empty($conf->recruitment->dir_output)) {
|
||||
// Wrapping for import module
|
||||
$accessallowed = $user->rights->recruitment->recruitmentjobposition->read;
|
||||
$original_file = $conf->recruitment->dir_output.'/'.$original_file;
|
||||
} elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) {
|
||||
// Wrapping for wysiwyg editor
|
||||
$accessallowed = 1;
|
||||
|
||||
@ -6044,7 +6044,7 @@ function get_default_tva(Societe $thirdparty_seller, Societe $thirdparty_buyer,
|
||||
|
||||
// Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
|
||||
if (($seller_country_code == $buyer_country_code)
|
||||
|| (in_array($seller_country_code, array('FR,MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined
|
||||
|| (in_array($seller_country_code, array('FR', 'MC')) && in_array($buyer_country_code, array('FR', 'MC')))) { // Warning ->country_code not always defined
|
||||
//print 'VATRULE 2';
|
||||
return get_product_vat_for_country($idprod, $thirdparty_seller, $idprodfournprice);
|
||||
}
|
||||
@ -8232,7 +8232,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
// Test dangerous char (used for RCE), we allow only PHP variable testing.
|
||||
if ($onlysimplestring == '1') {
|
||||
//print preg_quote('$_->&|', '/');
|
||||
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/', '/').']/i', $s)) {
|
||||
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@', '/').']/i', $s)) {
|
||||
if ($returnvalue) {
|
||||
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
|
||||
} else {
|
||||
@ -8242,11 +8242,11 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
||||
}
|
||||
} elseif ($onlysimplestring == '2') {
|
||||
//print preg_quote('$_->&|', '/');
|
||||
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/;[]', '/').']/i', $s)) {
|
||||
if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*/>&|=!?():"\',/@;[]', '/').']/i', $s)) {
|
||||
if ($returnvalue) {
|
||||
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
|
||||
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s;
|
||||
} else {
|
||||
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
|
||||
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring 2): '.$s);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,16 +372,16 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
|
||||
// If rounding is not using base 10 (rare)
|
||||
if (!empty($conf->global->MAIN_ROUNDING_RULE_TOT)) {
|
||||
if ($price_base_type == 'HT') {
|
||||
$result[0] = round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[0] = price2num(round($result[0] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[2] = price2num($result[0] + $result[1] + $result[9] + $result[10], 'MT');
|
||||
} else {
|
||||
$result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT;
|
||||
$result[1] = price2num(round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[2] = price2num(round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[9] = price2num(round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[10] = price2num(round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT, 'MT');
|
||||
$result[0] = price2num($result[2] - $result[1] - $result[9] - $result[10], 'MT');
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ function product_prepare_head($object)
|
||||
|
||||
if (!empty($object->status_buy) || (!empty($conf->margin->enabled) && !empty($object->status))) { // If margin is on and product on sell, we may need the cost price even if product os not on purchase
|
||||
if ((((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) && $user->rights->fournisseur->lire)
|
||||
|| (!empty($conf->margin->enabled) && $user->rights->margin->liretous)
|
||||
|| (!empty($conf->margin->enabled) && $user->rights->margins->liretous)
|
||||
) {
|
||||
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$object->id;
|
||||
$head[$h][1] = $langs->trans("BuyingPrices");
|
||||
|
||||
@ -180,7 +180,7 @@ function delivery_prepare_head($object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($tmpobject->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$tmpobject->id;
|
||||
|
||||
@ -906,7 +906,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false)
|
||||
}
|
||||
|
||||
// Use MAIN_OPTIMIZEFORTEXTBROWSER
|
||||
if ($foruserprofile && !empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
if ($foruserprofile) {
|
||||
//$default=yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER);
|
||||
$default = $langs->trans('No');
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
@ -969,8 +969,16 @@ class pdf_espadon extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -548,8 +548,16 @@ class pdf_merou extends ModelePdfExpedition
|
||||
|
||||
//*********************LOGO****************************
|
||||
$pdf->SetXY(11, 7);
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -914,8 +914,16 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) {
|
||||
$logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
}
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
|
||||
@ -1183,7 +1183,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
global $langs;
|
||||
|
||||
$langs->loadLangs(array('payment', 'paybox'));
|
||||
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
|
||||
$servicename = $langs->transnoentities('Online');
|
||||
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
|
||||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
|
||||
@ -1265,7 +1265,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
global $langs;
|
||||
|
||||
$langs->loadLangs(array('payment', 'paybox'));
|
||||
$langs->loadLangs(array('payment', 'paybox', 'stripe'));
|
||||
$servicename = $langs->transnoentities('Online');
|
||||
$paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', '');
|
||||
$linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' <a href="'.$paiement_url.'">'.$outputlangs->transnoentities("ClickHere").'</a>';
|
||||
@ -1510,7 +1510,7 @@ class pdf_sponge extends ModelePDFFactures
|
||||
// Total remise
|
||||
$total_line_remise = 0;
|
||||
foreach ($object->lines as $i => $line) {
|
||||
$total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
|
||||
$total_line_remise += (float) pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this method to core/lib/pdf.lib
|
||||
// Gestion remise sous forme de ligne négative
|
||||
if ($line->total_ht < 0) {
|
||||
$total_line_remise += -$line->total_ht;
|
||||
|
||||
@ -258,14 +258,16 @@ class modAccounting extends DolibarrModules
|
||||
$this->export_label[$r] = 'Chartofaccounts';
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_permission[$r] = array(array("accounting", "chartofaccount"));
|
||||
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa.account_parent'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
|
||||
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa.account_parent'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
|
||||
$this->export_entities_array[$r] = array('ac.rowid'=>"Accounting", 'ac.pcg_version'=>"Accounting", 'aa.rowid'=>'Accounting', 'aa.account_number'=>"Accounting", 'aa.label'=>"Accounting", 'aa.accountparent'=>"Accounting", 'aa.pcg_type'=>"Accounting", 'aa_active'=>"Accounting");
|
||||
$this->export_fields_array[$r] = array('ac.rowid'=>'ChartofaccountsId', 'ac.pcg_version'=>'Chartofaccounts', 'aa.rowid'=>'ID', 'aa.account_number'=>"AccountAccounting", 'aa.label'=>"Label", 'aa2.account_number'=>"Accountparent", 'aa.pcg_type'=>"Pcgtype", 'aa.active'=>'Status');
|
||||
$this->export_TypeFields_array[$r] = array('ac.rowid'=>'List:accounting_system:pcg_version', 'ac.pcg_version'=>'Text', 'aa.rowid'=>'Numeric', 'aa.account_number'=>"Text", 'aa.label'=>"Text", 'aa2.account_number'=>"Text", 'aa.pcg_type'=>'Text', 'aa.active'=>'Status');
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another picto
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'accounting_account as aa';
|
||||
$this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_system as ac';
|
||||
$this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').') ';
|
||||
$this->export_sql_end[$r] .= ' ,'.MAIN_DB_PREFIX.'accounting_account as aa2';
|
||||
$this->export_sql_end[$r] .= ' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting').')';
|
||||
$this->export_sql_end[$r] .= ' AND aa2.rowid = aa.account_parent AND aa2.active = 1 AND ac.pcg_version = aa2.fk_pcg_version AND aa2.entity IN ('.getEntity('accounting').')';
|
||||
|
||||
|
||||
// Imports
|
||||
|
||||
@ -164,8 +164,9 @@ class modCategorie extends DolibarrModules
|
||||
$typeexample .= ($typeexample ? " / " : "")."11=Website page";
|
||||
}
|
||||
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'pcat.label'=>'Text');
|
||||
// Definition of vars
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.type'=>"Type", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.type'=>"Numeric", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array(); // We define here only fields that use another picto
|
||||
$this->export_help_array[$r] = array('cat.type'=>$typeexample);
|
||||
|
||||
@ -181,8 +182,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->product->enabled) || !empty($conf->service->abled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref', 'p.label'=>'Label');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.label'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'product';
|
||||
@ -192,6 +193,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cp.fk_product';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -206,7 +208,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = '!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.fournisseur'=>"Supplier", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_fournisseur'=>"SupplierCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -214,7 +216,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.fournisseur'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_fournisseur'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -236,6 +238,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cf ON cf.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cf.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -252,7 +255,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = '!empty($conf->societe->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode",
|
||||
's.address'=>"Address", 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode",
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email",
|
||||
@ -260,7 +263,7 @@ class modCategorie extends DolibarrModules
|
||||
't.libelle'=>'ThirdPartyType', 'pl.code'=>'ProspectLevel', 'st.code'=>'ProspectStatus'
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text",
|
||||
's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text",
|
||||
's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text",
|
||||
@ -282,6 +285,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_societe as cs ON cs.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = cs.fk_soc';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object';
|
||||
@ -299,8 +303,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->adherent->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'adherent';
|
||||
@ -310,6 +314,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_member as cm ON cm.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'adherent as p ON p.rowid = cm.fk_member';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'adherent_extrafields as extra ON cat.rowid = extra.fk_object ';
|
||||
@ -324,7 +329,7 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_enabled[$r] = '!empty($conf->societe->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "contact", "export"));
|
||||
$this->export_fields_array[$r] = array(
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory",
|
||||
'cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategoryID", 'pcat.label'=>"ParentCategoryLabel",
|
||||
'p.rowid' => 'ContactId', 'civ.label' => 'UserTitle', 'p.lastname' => 'LastName', 'p.firstname' => 'Firstname',
|
||||
'p.address' => 'Address', 'p.zip' => 'Zip', 'p.town' => 'Town', 'c.code' => 'CountryCode', 'c.label' => 'Country',
|
||||
'p.birthday' => 'DateOfBirth', 'p.poste' => 'PostOrFunction',
|
||||
@ -335,8 +340,8 @@ class modCategorie extends DolibarrModules
|
||||
's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email"
|
||||
);
|
||||
$this->export_TypeFields_array[$r] = array(
|
||||
'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text',
|
||||
'civ.label' => 'List:c_civility:label:label', 'p.rowid'=>'Numeric', 'p.lastname' => 'Text', 'p.firstname' => 'Text',
|
||||
'p.address' => 'Text', 'p.zip' => 'Text', 'p.town' => 'Text', 'c.code' => 'Text', 'c.label' => 'List:c_country:label:label',
|
||||
'p.birthday' => 'Date', 'p.poste' => 'Text',
|
||||
'p.phone' => 'Text', 'p.phone_perso' => 'Text', 'p.phone_mobile' => 'Text', 'p.fax' => 'Text', 'p.email' => 'Text',
|
||||
@ -363,6 +368,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_contact as cc ON cc.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'socpeople as p ON p.rowid = cc.fk_socpeople';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -381,8 +387,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->projet->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("projet", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text");
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref', 's.rowid'=>"IdThirdParty", 's.nom'=>"Name");
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>'Numeric', 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text");
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'projet';
|
||||
@ -392,6 +398,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_project as cp ON cp.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'projet as p ON p.rowid = cp.fk_project';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
@ -406,8 +413,8 @@ class modCategorie extends DolibarrModules
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
$this->export_enabled[$r] = '!empty($conf->user->enabled)';
|
||||
$this->export_permission[$r] = array(array("categorie", "lire"), array("user", "export"));
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'p.rowid'=>'TechnicalID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_fields_array[$r] = array('cat.rowid'=>"CategId", 'cat.label'=>"Label", 'cat.description'=>"Description", 'cat.fk_parent'=>"ParentCategory", 'pcat.label'=>"ParentCategoryLabel", 'p.rowid'=>'UserID', 'p.login'=>'Login', 'p.lastname'=>'Lastname', 'p.firstname'=>'Firstname');
|
||||
$this->export_TypeFields_array[$r] = array('cat.rowid'=>"Numeric", 'cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'Numeric', 'pcat.label'=>'Text', 'p.rowid'=>'Numeric', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text');
|
||||
$this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto
|
||||
|
||||
$keyforselect = 'user';
|
||||
@ -417,6 +424,7 @@ class modCategorie extends DolibarrModules
|
||||
|
||||
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as cat';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie as pcat ON pcat.rowid = cat.fk_parent';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'categorie_user as cu ON cu.fk_categorie = cat.rowid';
|
||||
$this->export_sql_end[$r] .= ' INNER JOIN '.MAIN_DB_PREFIX.'user as p ON p.rowid = cu.fk_user';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON extra.fk_object = p.rowid';
|
||||
|
||||
@ -161,31 +161,39 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
*/
|
||||
public function getExample($langs, $objsoc = 0, $type = -1)
|
||||
{
|
||||
$error = 0;
|
||||
$examplecust = '';
|
||||
$examplesup = '';
|
||||
$errmsg = array(
|
||||
"ErrorBadMask",
|
||||
"ErrorCantUseRazIfNoYearInMask",
|
||||
"ErrorCantUseRazInStartedYearIfNoYearMonthInMask",
|
||||
"ErrorCounterMustHaveMoreThan3Digits",
|
||||
"ErrorBadMaskBadRazMonth",
|
||||
"ErrorCantUseRazWithYearOnOneDigit",
|
||||
);
|
||||
if ($type != 1) {
|
||||
$examplecust = $this->getNextValue($objsoc, 0);
|
||||
if (!$examplecust) {
|
||||
$examplecust = $langs->trans('NotConfigured');
|
||||
$examplecust = '<div class="error">'.$langs->trans('NotConfigured').'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
if (in_array($examplecust, $errmsg)) {
|
||||
$langs->load("errors");
|
||||
$examplecust = $langs->trans($examplecust);
|
||||
$examplecust = '<div class="error">'.$langs->trans($examplecust).'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
if ($type != 0) {
|
||||
$examplesup = $this->getNextValue($objsoc, 1);
|
||||
if (!$examplesup) {
|
||||
$examplesup = $langs->trans('NotConfigured');
|
||||
$examplesup = '<div class="error">'.$langs->trans('NotConfigured').'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
if (in_array($examplesup, $errmsg)) {
|
||||
$langs->load("errors");
|
||||
$examplesup = $langs->trans($examplesup);
|
||||
$examplesup = '<div class="error">'.$langs->trans($examplesup).'</div>';
|
||||
$error = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,7 +202,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
|
||||
} elseif ($type == 1) {
|
||||
return $examplesup;
|
||||
} else {
|
||||
return $examplecust.'<br>'.$examplesup;
|
||||
if ($error == 1) {
|
||||
return $examplecust.' '.$examplesup;
|
||||
} else {
|
||||
return $examplecust.'<br>'.$examplesup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -483,7 +483,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
||||
$pageposafter = $pageposbefore;
|
||||
//print $pageposafter.'-'.$pageposbefore;exit;
|
||||
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc);
|
||||
pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1);
|
||||
|
||||
$pageposafter = $pdf->getPage();
|
||||
$posyafter = $pdf->GetY();
|
||||
|
||||
@ -256,9 +256,10 @@ llxHeader('', $title, 'Livraison');
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
if ($action == 'create') { // Create. Seems to no be used
|
||||
} else // View
|
||||
{
|
||||
if ($action == 'create') {
|
||||
// Create. Seems to no be used
|
||||
} else {
|
||||
// View
|
||||
if ($object->id > 0) {
|
||||
// Origin of a 'livraison' (delivery receipt) is ALWAYS 'expedition' (shipment).
|
||||
// However, origin of shipment in future may differs (commande, proposal, ...)
|
||||
@ -359,9 +360,9 @@ if ($action == 'create') { // Create. Seems to no be used
|
||||
}
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$morehtmlright = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
|
||||
$morehtmlstatus = $langs->trans("StatusReceipt").' : '.$object->getLibStatut(6).'<br><br class="small">';
|
||||
|
||||
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlright);
|
||||
dol_banner_tab($expedition, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', $morehtmlstatus);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
@ -181,8 +181,6 @@ if (empty($reshook)) {
|
||||
$object->date = $donation_date;
|
||||
$object->public = $public_donation;
|
||||
$object->fk_project = (int) GETPOST("fk_project", 'int');
|
||||
$object->note_private = (string) GETPOST("note_private", 'restricthtml');
|
||||
$object->note_public = (string) GETPOST("note_public", 'restricthtml');
|
||||
$object->modepaymentid = (int) GETPOST('modepayment', 'int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
||||
@ -405,11 +405,17 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'create_delivery' && $conf->delivery_note->enabled && $user->rights->expedition->delivery->creer) {
|
||||
// Build a receiving receipt
|
||||
$db->begin();
|
||||
|
||||
$result = $object->create_delivery($user);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/delivery/card.php?action=create_delivery&id='.$result);
|
||||
exit;
|
||||
} else {
|
||||
$db->rollback();
|
||||
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'confirm_valid' && $confirm == 'yes' &&
|
||||
@ -547,6 +553,7 @@ if (empty($reshook)) {
|
||||
$object->fetch($id);
|
||||
$lines = $object->lines;
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fk_expedition = $object->id;
|
||||
|
||||
$num_prod = count($lines);
|
||||
for ($i = 0; $i < $num_prod; $i++) {
|
||||
@ -588,6 +595,7 @@ if (empty($reshook)) {
|
||||
for ($i = 0; $i < $num_prod; $i++) {
|
||||
if ($lines[$i]->id == $line_id) { // we have found line to update
|
||||
$line = new ExpeditionLigne($db);
|
||||
$line->fk_expedition = $object->id;
|
||||
|
||||
// Extrafields Lines
|
||||
$line->array_options = $extrafields->getOptionalsFromPost($object->table_element_line);
|
||||
|
||||
@ -2167,7 +2167,7 @@ class Expedition extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut='.self::STATUS_CLOSED;
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut = '.self::STATUS_CLOSED;
|
||||
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > 0';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2191,8 +2191,9 @@ class Expedition extends CommonObject
|
||||
}
|
||||
}
|
||||
if ($shipments_match_order) {
|
||||
dol_syslog("Qty for the ".count($order->lines)." lines of order have same value for shipments with status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order');
|
||||
$order->cloture($user);
|
||||
dol_syslog("Qty for the ".count($order->lines)." lines of the origin order is same than qty for lines in the shipment we close (shipments_match_order is true), with new status Expedition::STATUS_CLOSED=".self::STATUS_CLOSED.', so we close order');
|
||||
// We close the order
|
||||
$order->cloture($user); // Note this may also create an invoice if module workflow ask it
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -658,7 +658,7 @@ if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
|
||||
// Delivery method
|
||||
print '<td class="liste_titre center">';
|
||||
$shipment->fetch_delivery_methods();
|
||||
print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1);
|
||||
print $form->selectarray("search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, "", 1, 0, 0, '', 'maxwidth150');
|
||||
print "</td>\n";
|
||||
}
|
||||
// Tracking number
|
||||
@ -904,7 +904,7 @@ while ($i < min($num, $limit)) {
|
||||
if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
|
||||
// Get code using getLabelFromKey
|
||||
$code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
|
||||
print '<td class="center">';
|
||||
print '<td class="center tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("SendingMethod".strtoupper($code))).'">';
|
||||
if ($shipment->shipping_method_id > 0) print $langs->trans("SendingMethod".strtoupper($code));
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -698,7 +698,7 @@ if ($resql) {
|
||||
// Note public
|
||||
if (!empty($arrayfields['f.note_public']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_public);
|
||||
print dol_string_nohtmltag($obj->note_public);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
@ -707,7 +707,7 @@ if ($resql) {
|
||||
// Note private
|
||||
if (!empty($arrayfields['f.note_private']['checked'])) {
|
||||
print '<td class="center">';
|
||||
print dol_escape_htmltag($obj->note_private);
|
||||
print dol_string_nohtmltag($obj->note_private);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -215,8 +215,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
'localtax2' =>array('type'=>'double(24,8)', 'label'=>'Localtax2', 'enabled'=>1, 'visible'=>-1, 'position'=>140, 'isameasure'=>1),
|
||||
'total_ht' =>array('type'=>'double(24,8)', 'label'=>'TotalHT', 'enabled'=>1, 'visible'=>-1, 'position'=>145, 'isameasure'=>1),
|
||||
'total_ttc' =>array('type'=>'double(24,8)', 'label'=>'TotalTTC', 'enabled'=>1, 'visible'=>-1, 'position'=>150, 'isameasure'=>1),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>155),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>160),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>165),
|
||||
'fk_input_method' =>array('type'=>'integer', 'label'=>'InputMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
|
||||
@ -2006,6 +2006,8 @@ class CommandeFournisseur extends CommonOrder
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
$inventorycode = dol_print_date(dol_now(), 'dayhourlog');
|
||||
|
||||
if (($this->statut == self::STATUS_ORDERSENT || $this->statut == self::STATUS_RECEIVED_PARTIALLY || $this->statut == self::STATUS_RECEIVED_COMPLETELY)) {
|
||||
$this->db->begin();
|
||||
|
||||
@ -2039,7 +2041,7 @@ class CommandeFournisseur extends CommonOrder
|
||||
// $price should take into account discount (except if option STOCK_EXCLUDE_DISCOUNT_FOR_PMP is on)
|
||||
$mouv->origin = &$this;
|
||||
$mouv->setOrigin($this->element, $this->id);
|
||||
$result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch);
|
||||
$result = $mouv->reception($user, $product, $entrepot, $qty, $price, $comment, $eatby, $sellby, $batch, '', 0, $inventorycode);
|
||||
if ($result < 0) {
|
||||
$this->error = $mouv->error;
|
||||
$this->errors = $mouv->errors;
|
||||
|
||||
@ -284,8 +284,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>155),
|
||||
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>160),
|
||||
'date_lim_reglement' =>array('type'=>'date', 'label'=>'DateLimReglement', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170),
|
||||
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>175),
|
||||
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>180),
|
||||
'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
'fk_incoterms' =>array('type'=>'integer', 'label'=>'IncotermCode', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
|
||||
|
||||
@ -578,7 +578,7 @@ class ProductFournisseur extends Product
|
||||
$sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,";
|
||||
$sql .= " pfp.barcode, pfp.fk_barcode_type, pfp.packaging,";
|
||||
$sql .= " p.ref as product_ref";
|
||||
$sql .= " p.ref as product_ref, p.tosell as status, p.tobuy as status_buy";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE pfp.rowid = ".(int) $rowid;
|
||||
$sql .= " AND pfp.fk_product = p.rowid";
|
||||
@ -594,7 +594,8 @@ class ProductFournisseur extends Product
|
||||
$this->fk_product = $obj->fk_product;
|
||||
$this->product_id = $obj->fk_product;
|
||||
$this->product_ref = $obj->product_ref;
|
||||
|
||||
$this->status = $obj->status;
|
||||
$this->status_buy = $obj->status_buy;
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->fourn_ref = $obj->ref_fourn; // deprecated
|
||||
$this->ref_supplier = $obj->ref_fourn;
|
||||
@ -670,7 +671,7 @@ class ProductFournisseur extends Product
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref,";
|
||||
$sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id, p.ref as product_ref, p.tosell as status, p.tobuy as status_buy, ";
|
||||
$sql .= " pfp.rowid as product_fourn_pri_id, pfp.entity, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product as product_fourn_id, pfp.fk_supplier_price_expression,";
|
||||
$sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,";
|
||||
$sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,";
|
||||
@ -699,6 +700,8 @@ class ProductFournisseur extends Product
|
||||
|
||||
$prodfourn->product_ref = $record["product_ref"];
|
||||
$prodfourn->product_fourn_price_id = $record["product_fourn_pri_id"];
|
||||
$prodfourn->status = $record["status"];
|
||||
$prodfourn->status_buy = $record["status_buy"];
|
||||
$prodfourn->product_fourn_id = $record["product_fourn_id"];
|
||||
$prodfourn->product_fourn_entity = $record["entity"];
|
||||
$prodfourn->ref_supplier = $record["ref_fourn"];
|
||||
|
||||
@ -1215,7 +1215,7 @@ if (empty($reshook)) {
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
|
||||
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
|
||||
$object->multicurrency_tx = price2num(GETPOST('originmulticurrency_tx', 'alpha'));
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
|
||||
@ -221,6 +221,7 @@ if ($action == 'denydispatchline' && $permissiontocontrol) {
|
||||
|
||||
if ($action == 'dispatch' && $permissiontoreceive) {
|
||||
$error = 0;
|
||||
$notrigger = 0;
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -1005,7 +1006,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
if (empty($conf->multicurrency->enabled) && empty($conf->dynamicprices->enabled)) {
|
||||
// Price
|
||||
print '<td class="right">';
|
||||
print '<input id="pu'.$suffix.'" name="pu'.$suffix.'" type="text" size="8" value="'.price((GETPOST('pu'.$suffix) != '' ? GETPOST('pu'.$suffix) : $up_ht_disc)).'">';
|
||||
print '<input id="pu'.$suffix.'" name="pu'.$suffix.'" type="text" size="8" value="'.price((GETPOST('pu'.$suffix) != '' ? price2num(GETPOST('pu'.$suffix)) : $up_ht_disc)).'">';
|
||||
print '</td>';
|
||||
|
||||
// Discount
|
||||
@ -1201,10 +1202,6 @@ if ($id > 0 || !empty($ref)) {
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$tmpproduct->id = $objp->fk_product;
|
||||
$tmpproduct->ref = $objp->ref;
|
||||
$tmpproduct->label = $objp->label;
|
||||
|
||||
if ($action == 'editline' && $lineid == $objp->dispatchlineid) {
|
||||
print '<form name="editdispatchedlines" id="editdispatchedlines" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'#line_'.GETPOST('lineid', 'int').'" method="POST">
|
||||
<input type="hidden" name="token" value="'.newToken().'">
|
||||
|
||||
@ -1971,7 +1971,7 @@ if ($action == 'create') {
|
||||
print $societe->getNomUrl(1, 'supplier');
|
||||
print '<input type="hidden" name="socid" value="'.$societe->id.'">';
|
||||
} else {
|
||||
print img_picto('', 'company').$form->select_company($societe->id, 'socid', 's.fournisseur=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
print img_picto('', 'company').$form->select_company($societe->id, 'socid', '(s.fournisseur = 1 and s.status = 1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
|
||||
// reload page to retrieve supplier informations
|
||||
if (!empty($conf->global->RELOAD_PAGE_ON_SUPPLIER_CHANGE)) {
|
||||
print '<script type="text/javascript">
|
||||
|
||||
@ -194,11 +194,13 @@ delete from llx_delivery where rowid not in (select fk_target from llx_elemen
|
||||
|
||||
-- Fix delete element_element orphelins (right side)
|
||||
delete from llx_element_element where targettype='shipping' and fk_target not in (select rowid from llx_expedition);
|
||||
delete from llx_element_element where targettype='delivery' and fk_target not in (select rowid from llx_delivery);
|
||||
delete from llx_element_element where targettype='propal' and fk_target not in (select rowid from llx_propal);
|
||||
delete from llx_element_element where targettype='facture' and fk_target not in (select rowid from llx_facture);
|
||||
delete from llx_element_element where targettype='commande' and fk_target not in (select rowid from llx_commande);
|
||||
-- Fix delete element_element orphelins (left side)
|
||||
delete from llx_element_element where sourcetype='shipping' and fk_source not in (select rowid from llx_expedition);
|
||||
delete from llx_element_element where sourcetype='delivery' and fk_source not in (select rowid from llx_delivery);
|
||||
delete from llx_element_element where sourcetype='propal' and fk_source not in (select rowid from llx_propal);
|
||||
delete from llx_element_element where sourcetype='facture' and fk_source not in (select rowid from llx_facture);
|
||||
delete from llx_element_element where sourcetype='commande' and fk_source not in (select rowid from llx_commande);
|
||||
|
||||
@ -58,6 +58,7 @@ MainAccountForSuppliersNotDefined=Main accounting account for vendors not define
|
||||
MainAccountForUsersNotDefined=Main accounting account for users not defined in setup
|
||||
MainAccountForVatPaymentNotDefined=Main accounting account for VAT payment not defined in setup
|
||||
MainAccountForSubscriptionPaymentNotDefined=Main accounting account for subscription payment not defined in setup
|
||||
UserAccountNotDefined=Accounting account for user not defined in setup
|
||||
|
||||
AccountancyArea=Accounting area
|
||||
AccountancyAreaDescIntro=Usage of the accountancy module is done in several step:
|
||||
|
||||
@ -67,6 +67,7 @@ StockCategoriesShort=Warehouse tags/categories
|
||||
ThisCategoryHasNoItems=This category does not contain any items.
|
||||
CategId=Tag/category id
|
||||
ParentCategory=Parent tag/category
|
||||
ParentCategoryID=ID of parent tag/category
|
||||
ParentCategoryLabel=Label of parent tag/category
|
||||
CatSupList=List of vendors tags/categories
|
||||
CatCusList=List of customers/prospects tags/categories
|
||||
|
||||
@ -43,8 +43,6 @@ $result = restrictedArea($user, 'societe', '', '');
|
||||
$result = restrictedArea($user, 'margins');
|
||||
|
||||
|
||||
$mesg = '';
|
||||
|
||||
// Load variable for pagination
|
||||
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
|
||||
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
||||
@ -64,18 +62,18 @@ if (!$sortorder) {
|
||||
}
|
||||
|
||||
$startdate = $enddate = '';
|
||||
|
||||
if (!empty($_POST['startdatemonth'])) {
|
||||
$startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (GETPOST('startdatemonth')) {
|
||||
$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
|
||||
}
|
||||
if (!empty($_POST['enddatemonth'])) {
|
||||
$enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
if (GETPOST('enddatemonth')) {
|
||||
$enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Societe($db);
|
||||
$hookmanager->initHooks(array('margincustomerlist'));
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -188,7 +186,7 @@ print '<table class="border centpercent">';
|
||||
|
||||
// Total Margin
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
||||
print '<span id="totalMargin" class="amount"></span> <span class="amount">'.$langs->getCurrencySymbol($conf->currency).'</span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
// Margin Rate
|
||||
@ -271,6 +269,30 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$param = '&socid='.((int) $socid);
|
||||
if (GETPOST('startdatemonth', 'int')) {
|
||||
$param .= '&startdateyear='.GETPOST('startdateyear', 'int');
|
||||
$param .= '&startdatemonth='.GETPOST('startdatemonth', 'int');
|
||||
$param .= '&startdateday='.GETPOST('startdateday', 'int');
|
||||
}
|
||||
if (GETPOST('enddatemonth', 'int')) {
|
||||
$param .= '&enddateyear='.GETPOST('enddateyear', 'int');
|
||||
$param .= '&enddatemonth='.GETPOST('enddatemonth', 'int');
|
||||
$param .= '&enddateday='.GETPOST('enddateday', 'int');
|
||||
}
|
||||
$listofproducts = GETPOST('products', 'array:int');
|
||||
if (is_array($listofproducts)) {
|
||||
foreach ($listofproducts as $val) {
|
||||
$param .= '&products[]='.$val;
|
||||
}
|
||||
}
|
||||
$listofcateg = GETPOST('categories', 'array:int');
|
||||
if (is_array($listofcateg)) {
|
||||
foreach ($listofcateg as $val) {
|
||||
$param .= '&categories[]='.$val;
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog('margin::customerMargins.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
@ -293,19 +315,19 @@ if ($result) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (!empty($client)) {
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$socid, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$socid, 'align="center"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
} else {
|
||||
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -73,18 +73,18 @@ if (!$sortfield) {
|
||||
}
|
||||
|
||||
$startdate = $enddate = '';
|
||||
|
||||
if (!empty($_POST['startdatemonth'])) {
|
||||
$startdate = dol_mktime(0, 0, 0, $_POST['startdatemonth'], $_POST['startdateday'], $_POST['startdateyear']);
|
||||
if (GETPOST('startdatemonth')) {
|
||||
$startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int'));
|
||||
}
|
||||
if (!empty($_POST['enddatemonth'])) {
|
||||
$enddate = dol_mktime(23, 59, 59, $_POST['enddatemonth'], $_POST['enddateday'], $_POST['enddateyear']);
|
||||
if (GETPOST('enddatemonth')) {
|
||||
$enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear'));
|
||||
}
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Product($db);
|
||||
$hookmanager->initHooks(array('marginproductlist'));
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -149,7 +149,7 @@ print '<table class="border centpercent">';
|
||||
|
||||
// Total Margin
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalMargin").'</td><td colspan="4">';
|
||||
print '<span id="totalMargin"></span>'; // set by jquery (see below)
|
||||
print '<span id="totalMargin" class="amount"></span> <span class="amount">'.$langs->getCurrencySymbol($conf->currency).'</span>'; // set by jquery (see below)
|
||||
print '</td></tr>';
|
||||
|
||||
// Margin Rate
|
||||
@ -224,13 +224,31 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
// TODO: calculate total to display then restore pagination
|
||||
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
|
||||
|
||||
$param = '&id='.((int) $id);
|
||||
if (GETPOST('startdatemonth', 'int')) {
|
||||
$param .= '&startdateyear='.GETPOST('startdateyear', 'int');
|
||||
$param .= '&startdatemonth='.GETPOST('startdatemonth', 'int');
|
||||
$param .= '&startdateday='.GETPOST('startdateday', 'int');
|
||||
}
|
||||
if (GETPOST('enddatemonth', 'int')) {
|
||||
$param .= '&enddateyear='.GETPOST('enddateyear', 'int');
|
||||
$param .= '&enddatemonth='.GETPOST('enddatemonth', 'int');
|
||||
$param .= '&enddateday='.GETPOST('enddateday', 'int');
|
||||
}
|
||||
$listofcateg = GETPOST('categories', 'array:int');
|
||||
if (is_array($listofcateg)) {
|
||||
foreach ($listofcateg as $val) {
|
||||
$param .= '&categories[]='.$val;
|
||||
}
|
||||
}
|
||||
|
||||
dol_syslog('margin::productMargins.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
print '<br>';
|
||||
print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], "&id=".$id, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1);
|
||||
print_barre_liste($langs->trans("MarginDetails"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $num, '', 0, '', '', 0, 1);
|
||||
|
||||
//var_dump($conf->global->MARGIN_TYPE);
|
||||
if ($conf->global->MARGIN_TYPE == "1") {
|
||||
@ -247,20 +265,20 @@ if ($result) {
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if ($id > 0) {
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
} else {
|
||||
print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder);
|
||||
print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", "&id=".$id, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Qty", $_SERVER["PHP_SELF"], "product_qty", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (!empty($conf->global->DISPLAY_MARGIN_RATES)) {
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
if (!empty($conf->global->DISPLAY_MARK_RATES)) {
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", "&id=".$id, '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -660,8 +660,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
|
||||
if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) {
|
||||
$defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
|
||||
//$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog');
|
||||
$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $langs->trans("ProductionForRef", $object->ref);
|
||||
$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : dol_print_date(dol_now(), 'dayhourlog');
|
||||
|
||||
print '<div class="center'.(in_array($action, array('consumeorproduce', 'consumeandproduceall')) ? ' formconsumeproduce' : '').'">';
|
||||
print '<div class="opacitymedium hideonsmartphone paddingbottom">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></div>';
|
||||
|
||||
@ -508,9 +508,9 @@ if ($id > 0 || $ref) {
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td>';
|
||||
if ($rowid) {
|
||||
print '<input type="hidden" name="ref_fourn_old" value="'.$object->ref_supplier.'">';
|
||||
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.$object->ref_supplier.'">';
|
||||
print '<input class="flat width150" maxlength="128" name="ref_fourn" value="'.$object->ref_supplier.'">';
|
||||
} else {
|
||||
print '<input class="flat width150" maxlength="30" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">';
|
||||
print '<input class="flat width150" maxlength="128" name="ref_fourn" value="'.(GETPOST("ref_fourn") ? GETPOST("ref_fourn") : '').'">';
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@ -988,7 +988,7 @@ while ($i < min($num, $limit)) {
|
||||
// Description
|
||||
if (!empty($arrayfields['t.description']['checked'])) {
|
||||
print '<td>';
|
||||
print dol_escape_htmltag($object->description);
|
||||
print dolGetFirstLineOfText($object->description, 5);
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -168,6 +168,15 @@ if ($action == 'confirm_refusepropal' && $confirm == 'yes') {
|
||||
|
||||
$message = 'refused';
|
||||
setEventMessages("PropalRefused", null, 'warnings');
|
||||
if (method_exists($object, 'call_trigger')) {
|
||||
//customer is not a user !?! so could we use same user as validation ?
|
||||
$user = new User($db);
|
||||
$user->fetch($object->user_valid_id);
|
||||
$result = $object->call_trigger('PROPAL_CLOSE_REFUSED', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$db->rollback();
|
||||
}
|
||||
|
||||
@ -2917,7 +2917,7 @@ class SupplierProposalLine extends CommonObjectLine
|
||||
$this->product_label = $objp->product_label;
|
||||
$this->product_desc = $objp->product_desc;
|
||||
|
||||
$this->ref_fourn = $objp->ref_produit_forun;
|
||||
$this->ref_fourn = $objp->ref_produit_fourn;
|
||||
|
||||
// Multicurrency
|
||||
$this->fk_multicurrency = $objp->fk_multicurrency;
|
||||
|
||||
@ -1016,6 +1016,19 @@ class Ticket extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Delete all child tables
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_ticket";
|
||||
$sql .= " WHERE fk_ticket = ".(int) $this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if (!$result) {
|
||||
$error++;
|
||||
$this->errors[] = $this->db->lasterror();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket";
|
||||
$sql .= " WHERE rowid=".((int) $this->id);
|
||||
|
||||
@ -689,6 +689,7 @@ class User extends CommonObject
|
||||
'inventory' => 'stock',
|
||||
'invoice' => 'facture',
|
||||
'invoice_supplier' => 'fournisseur',
|
||||
'order_supplier' => 'fournisseur',
|
||||
'knowledgerecord' => 'knowledgerecord@knowledgemanagement',
|
||||
'skill@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all"
|
||||
'job@hrm' => 'all@hrm', // skill / job / position objects rights are for the moment grouped into right level "all"
|
||||
@ -711,6 +712,7 @@ class User extends CommonObject
|
||||
// If module is abc@module, we check permission user->rights->module->abc->permlevel1
|
||||
$tmp = explode('@', $rightsPath, 2);
|
||||
if (! empty($tmp[1])) {
|
||||
if (strpos($module, '@') !== false) $module = $tmp[1];
|
||||
$rightsPath = $tmp[1];
|
||||
$permlevel2 = $permlevel1;
|
||||
$permlevel1 = $tmp[0];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user