Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2024-01-26 11:29:51 +01:00
commit 4d3d0e9240
70 changed files with 528 additions and 134 deletions

View file

@ -283,7 +283,7 @@ The following changes may create regressions for some external modules, but were
* Hidden option ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USEr_ON_SALARY_BANK_PAYMENT has been renamed into ACCOUNTANCY_AUTOFIX_MISSING_LINK_TO_USER_ON_SALARY_BANK_PAYMENT
* The delete() method of AdherentType, Contact, Delivery, MultiCurrency, CurrencyRate now need $user as first parameter.
* A very high number of class properties (with old name in french) are now deprecated in favor of the property name in english.
* The load of hook context productdao has been removed before calling loadvirtualstock. Modules must use the context of main parent page or 'all' for all cases.
***** ChangeLog for 18.0.4 compared to 18.0.3 *****
FIX: $this->newref already exists and could have been modified by trigger but we still use a local variable for the filesystem-based renaming

View file

@ -423,7 +423,7 @@ class Members extends DolibarrApi
* Validate fields before creating an object
*
* @param array|null $data Data to validate
* @return array
* @return array Return array with validated mandatory fields and their value
*
* @throws RestException
*/
@ -443,8 +443,8 @@ class Members extends DolibarrApi
/**
* Clean sensible object datas
*
* @param Object $object Object to clean
* @return Object Object with cleaned properties
* @param Object $object Object to clean
* @return Object Object with cleaned properties
*/
protected function _cleanObjectDatas($object)
{

View file

@ -3,6 +3,7 @@
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -322,7 +323,7 @@ if ($mode == 'config' && $user->admin) {
print load_fiche_titre($langs->trans("ReceiptPrinterDesc"), '', '')."\n";
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
@ -416,7 +417,7 @@ if ($mode == 'config' && $user->admin) {
print '<span class="opacitymedium">'.$langs->trans("ReceiptPrinterTypeDesc").'...</span><br><br>'."\n";
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">'."\n";
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_DUMMY").'</td><td>'.$langs->trans("CONNECTOR_DUMMY_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$form->textwithpicto($langs->trans("CONNECTOR_NETWORK_PRINT"), $langs->trans("FromServerPointOfView")).'</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
@ -445,7 +446,7 @@ if ($mode == 'template' && $user->admin) {
print '<input type="hidden" name="action" value="updatetemplate">';
}
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Name").'</th>';
@ -512,7 +513,7 @@ if ($mode == 'template' && $user->admin) {
print '<br>';
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
print '<table class="noborder centpercent">'."\n";
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("Tag").'</th>';

View file

@ -53,7 +53,7 @@ $idproduct = GETPOST('idproduct', 'int');
* View
*/
top_httphead();
top_httphead('application/json');
if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) {
$product = new Product($db);
@ -65,3 +65,24 @@ if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire'))
echo json_encode($fk_unit);
exit();
}
if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) {
$product = new Product($db);
$res = $product->fetch($idproduct);
$result = array();
if ($res < 0) {
$error = 'SQL ERROR';
} elseif ($res == 0) {
$error = 'NOT FOUND';
} else {
$error = null;
$result['defaultWk']=$product->fk_default_workstation;
}
$result['error']=$error;
echo json_encode($result);
exit();
}

View file

@ -792,7 +792,7 @@ class BOM extends CommonObject
$line->array_options[$key] = $array_options[$key];
}
}
if ($fk_default_workstation > 0 && $line->fk_default_workstation != $fk_default_workstation) {
if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) {
$line->fk_default_workstation = $fk_default_workstation;
}

View file

@ -185,7 +185,7 @@ if ($filtertype != 1) {
$coldisplay++;
print '<td class="bordertop nobottom nowrap linecolworkstation right">';
print '&nbsp;';
print $formproduct->selectWorkstations('', 'idworkstations', 1);
print '</td>';
$coldisplay++;
@ -235,6 +235,7 @@ jQuery(document).ready(function() {
,type: 'POST'
,data: {
'action': 'getDurationUnitByProduct'
,'token' : "<?php echo newToken() ?>"
,'idproduct' : idproduct
}
}).done(function(data) {
@ -243,6 +244,20 @@ jQuery(document).ready(function() {
var data = JSON.parse(data);
$("#fk_unit").val(data).change();
});
$.ajax({
url : "<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
,type: 'POST'
,data: {
'action': 'getWorkstationByProduct'
,'token' : "<?php echo newToken() ?>"
,'idproduct' : idproduct
}
}).done(function(data) {
var data = JSON.parse(data);
$('#idworkstations').val(data.defaultWk).select2();
});
});
<?php } ?>
});

View file

@ -70,7 +70,8 @@ class Categories extends DolibarrApi
*/
public function __construct()
{
global $db, $conf;
global $db;
$this->db = $db;
$this->category = new Categorie($this->db);
}
@ -133,8 +134,6 @@ class Categories extends DolibarrApi
*/
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $sqlfilters = '', $properties = '')
{
global $db, $conf;
$obj_ret = array();
if (!DolibarrApiAccess::$user->rights->categorie->lire) {
@ -198,8 +197,8 @@ class Categories extends DolibarrApi
throw new RestException(401);
}
// Check mandatory fields
$result = $this->_validate($request_data);
// Check mandatory fields (throw an exception if wrong)
$this->_validate($request_data);
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
@ -666,8 +665,8 @@ class Categories extends DolibarrApi
/**
* Clean sensible object datas
*
* @param Categorie $object Object to clean
* @return Object Object with cleaned properties
* @param Categorie $object Object to clean
* @return Object Object with cleaned properties
*/
protected function _cleanObjectDatas($object)
{
@ -722,8 +721,8 @@ class Categories extends DolibarrApi
/**
* Validate fields before create or update object
*
* @param array|null $data Data to validate
* @return array
* @param array|null $data Data to validate
* @return array Return array with validated mandatory fields and their value
*
* @throws RestException
*/

View file

@ -1190,6 +1190,10 @@ if (empty($reshook)) {
if (!empty($price_ht) || (string) $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ((float) $tmpvat / 100)), 'MU');
} elseif (!empty($price_ht_devise) || (string) $price_ht_devise === '0') {
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht = '';
$pu_ttc = '';
} elseif (!empty($price_ttc) || (string) $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ((float) $tmpvat / 100)), 'MU');

View file

@ -127,8 +127,8 @@ if (empty($reshook)) {
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
$object->label = trim(GETPOST("label", 'alphanohtml'));
$object->courant = GETPOST("type");
$object->clos = GETPOST("clos");
$object->courant = GETPOSTINT("type");
$object->clos = GETPOSTINT("clos");
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
$object->url = trim(GETPOST("url", 'alpha'));
@ -157,24 +157,24 @@ if (empty($reshook)) {
} else {
$object->account_number = $account_number;
}
$fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
$fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal');
if ($fk_accountancy_journal <= 0) {
$object->fk_accountancy_journal = '';
} else {
$object->fk_accountancy_journal = $fk_accountancy_journal;
}
$object->solde = price2num(GETPOST("solde", 'alpha'));
$object->balance = price2num(GETPOST("solde", 'alpha'));
$object->solde = GETPOSTFLOAT("solde");
$object->balance = GETPOSTFLOAT("solde");
$object->date_solde = dol_mktime(12, 0, 0, GETPOST("remonth", 'int'), GETPOST('reday', 'int'), GETPOST("reyear", 'int'));
$object->currency_code = trim(GETPOST("account_currency_code"));
$object->state_id = GETPOST("account_state_id", 'int');
$object->country_id = GETPOST("account_country_id", 'int');
$object->state_id = GETPOSTINT("account_state_id");
$object->country_id = GETPOSTINT("account_country_id");
$object->min_allowed = GETPOST("account_min_allowed", 'int');
$object->min_desired = GETPOST("account_min_desired", 'int');
$object->min_allowed = GETPOSTFLOAT("account_min_allowed");
$object->min_desired = GETPOSTFLOAT("account_min_desired");
$object->comment = trim(GETPOST("account_comment", 'restricthtml'));
$object->fk_user_author = $user->id;
@ -240,8 +240,8 @@ if (empty($reshook)) {
$object->ref = dol_string_nospecial(trim(GETPOST('ref', 'alpha')));
$object->label = trim(GETPOST("label", 'alphanohtml'));
$object->courant = GETPOST("type");
$object->clos = GETPOST("clos");
$object->courant = GETPOSTINT("type");
$object->clos = GETPOSTINT("clos");
$object->rappro = (GETPOST("norappro", 'alpha') ? 0 : 1);
$object->url = trim(GETPOST("url", 'alpha'));
@ -270,7 +270,7 @@ if (empty($reshook)) {
} else {
$object->account_number = $account_number;
}
$fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int');
$fk_accountancy_journal = GETPOSTINT('fk_accountancy_journal');
if ($fk_accountancy_journal <= 0) {
$object->fk_accountancy_journal = '';
} else {
@ -279,11 +279,11 @@ if (empty($reshook)) {
$object->currency_code = trim(GETPOST("account_currency_code"));
$object->state_id = GETPOST("account_state_id", 'int');
$object->country_id = GETPOST("account_country_id", 'int');
$object->state_id = GETPOSTINT("account_state_id");
$object->country_id = GETPOSTINT("account_country_id");
$object->min_allowed = GETPOST("account_min_allowed", 'int');
$object->min_desired = GETPOST("account_min_desired", 'int');
$object->min_allowed = GETPOSTFLOAT("account_min_allowed");
$object->min_desired = GETPOSTFLOAT("account_min_desired");
$object->comment = trim(GETPOST("account_comment", 'restricthtml'));
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($object->account_number)) {

View file

@ -379,19 +379,18 @@ class PaymentVarious extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
$this->tms = '';
$this->datep = '';
$this->datev = '';
$this->sens = '';
$this->amount = '';
$this->label = '';
$this->tms = dol_now();
$this->datep = dol_now();
$this->datev = dol_now();
$this->sens = 0;
$this->amount = 100;
$this->label = 'Specimen payment';
$this->accountancy_code = '';
$this->subledger_account = '';
$this->note = '';
$this->fk_bank = '';
$this->fk_user_author = '';
$this->fk_user_modif = '';
$this->fk_bank = 0;
$this->fk_user_author = 0;
$this->fk_user_modif = 0;
}
/**

View file

@ -2218,6 +2218,10 @@ if (empty($reshook)) {
if (!empty($price_ht) || $price_ht === '0') {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU');
} elseif (!empty($price_ht_devise) || $price_ht_devise === '0') {
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$pu_ht = '';
$pu_ttc = '';
} elseif (!empty($price_ttc) || $price_ttc === '0') {
$pu_ttc = price2num($price_ttc, 'MU');
$pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU');
@ -2309,8 +2313,10 @@ if (empty($reshook)) {
$type = $prod->type;
$fk_unit = $prod->fk_unit;
} else {
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($price_ttc, 'MU');
if (!empty($price_ht)) $pu_ht = price2num($price_ht, 'MU');
else $pu_ht = '';
if (!empty($price_ttc)) $pu_ttc = price2num($price_ttc, 'MU');
else $pu_ttc = '';
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
$tva_tx = str_replace('*', '', $tva_tx);
if (empty($tva_tx)) {
@ -2336,8 +2342,8 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty, $mysoc, $tva_npr);
$pu_ht_devise = price2num(GETPOST('multicurrency_subprice'), '', 2);
$pu_ttc_devise = price2num(GETPOST('multicurrency_subprice_ttc'), '', 2);
$pu_ht_devise = price2num($price_ht_devise, '', 2);
$pu_ttc_devise = price2num($price_ttc_devise, '', 2);
// Prepare a price equivalent for minimum price check
$pu_equivalent = $pu_ht;

View file

@ -4424,7 +4424,7 @@ class Facture extends CommonInvoice
* Set percent discount
*
* @param User $user User that set discount
* @param double $remise Discount
* @param float $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int Return integer <0 if KO, >0 if OK
* @deprecated remise_percent is a deprecated field for object parent
@ -4437,16 +4437,16 @@ class Facture extends CommonInvoice
}
if ($user->hasRight('facture', 'creer')) {
$remise = price2num($remise, 2);
$remise = (float) price2num($remise, 2);
$error = 0;
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql .= ' SET remise_percent = '.((float) $remise);
$sql = "UPDATE ".MAIN_DB_PREFIX."facture";
$sql .= " SET remise_percent = ".((float) $remise);
$sql .= " WHERE rowid = ".((int) $this->id);
$sql .= ' AND fk_statut = '.self::STATUS_DRAFT;
$sql .= " AND fk_statut = ".((int) self::STATUS_DRAFT);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -6295,7 +6295,8 @@ class FactureLigne extends CommonInvoiceLine
// if buy price not defined, define buyprice as configured in margin admin
if ($this->pa_ht == 0 && $pa_ht_isemptystring) {
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) {
$result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product);
if ($result < 0) {
return $result;
} else {
$this->pa_ht = $result;
@ -6734,7 +6735,7 @@ class FactureLigne extends CommonInvoiceLine
*
* @param int $invoiceid Invoice id
* @param bool $include_credit_note Include credit note or not
* @return int >= 0
* @return float|int Reurrn previous situation percent, 0 or -1 if error
*/
public function get_prev_progress($invoiceid, $include_credit_note = true)
{

View file

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'bills', 'companies', 'compta'));
$id = GETPOST('id', 'int');
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');

View file

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills", "compta"));
$chid = GETPOST("id", 'int');
$chid = GETPOSTINT("id");
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel');

View file

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page
$langs->loadLangs(array("banks", "bills"));
$chid = GETPOST("id", 'int');
$chid = GETPOSTINT("id");
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel');

View file

@ -157,7 +157,7 @@ class LignePrelevement
*
* @param int $status Id status
* @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto
* @return null|string Label
* @return null|string Return status label (or null if $mode != 0, 1, 2, 3 or 4)
*/
public function LibStatut($status, $mode = 0)
{
@ -192,7 +192,7 @@ class LignePrelevement
}
}
// return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
return;
return null;
}
/**

View file

@ -519,13 +519,12 @@ class Cchargesociales
public function initAsSpecimen()
{
$this->id = 0;
$this->libelle = '';
$this->label = '';
$this->deductible = '';
$this->active = '';
$this->code = '';
$this->fk_pays = '';
$this->fk_pays = 0;
$this->module = '';
$this->accountancy_code = '';
}

View file

@ -531,19 +531,18 @@ class PaymentSocialContribution extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
$this->fk_charge = '';
$this->datec = '';
$this->tms = '';
$this->datep = '';
$this->amount = '';
$this->fk_charge = 0;
$this->datec = dol_now();
$this->tms = dol_now();
$this->datep = dol_now();
$this->amount = 100;
$this->fk_typepaiement = '';
$this->num_payment = '';
$this->num_payment = 'ABC123';
$this->note_private = '';
$this->note_public = '';
$this->fk_bank = '';
$this->fk_user_creat = '';
$this->fk_user_modif = '';
$this->fk_bank = 0;
$this->fk_user_creat = 0;
$this->fk_user_modif = 0;
}

View file

@ -172,7 +172,7 @@ if (empty($reshook)) {
if ($action == 'add' && !$cancel) {
$error = 0;
$object->fk_account = GETPOST("accountid", 'int');
$object->fk_account = GETPOSTINT("accountid");
$object->type_payment = GETPOST("type_payment", 'alphanohtml');
$object->num_payment = GETPOST("num_payment", 'alphanohtml');
@ -329,7 +329,8 @@ if (empty($reshook)) {
$object->fetch($id);
if ($object->id > 0) {
$object->id = $object->ref = null;
$object->id = 0;
$object->ref = null;
$object->paye = 0;
if (GETPOST('amount', 'alphanohtml')) {

View file

@ -533,13 +533,12 @@ class PaymentVAT extends CommonObject
public function initAsSpecimen()
{
$this->id = 0;
$this->fk_tva = 0;
$this->datec = '';
$this->tms = '';
$this->datep = '';
$this->amount = '';
$this->fk_typepaiement = '';
$this->fk_typepaiement = 0;
$this->num_payment = '';
$this->note_private = '';
$this->note_public = '';

View file

@ -38,7 +38,7 @@ if ($action == 'addcomment') {
if (!empty($description)) {
$comment->description = $description;
$comment->datec = dol_now();
$comment->fk_element = GETPOST('id', 'int');
$comment->fk_element = GETPOSTINT('id');
$comment->element_type = GETPOST('comment_element_type', 'alpha');
$comment->fk_user_author = $user->id;
$comment->entity = $conf->entity;

View file

@ -1751,7 +1751,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf
}
if (!$error) {
$clone_task->fk_project = GETPOST('projectid', 'int');
$clone_task->fk_project = GETPOSTINT('projectid');
$clone_task->ref = $defaultref;
$clone_task->label = $origin_task->label;
$clone_task->description = $origin_task->description;

View file

@ -7277,7 +7277,7 @@ abstract class CommonObject
if (!preg_match('/search_/', $keyprefix)) { // If keyprefix is search_ or search_options_, we must just use a simple text field
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%');
$out = $doleditor->Create(1);
$out = $doleditor->Create(1, '', true, '', '', '', $morecss);
} else {
$out = '<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').'>';
}
@ -8964,7 +8964,7 @@ abstract class CommonObject
* @param float $unitPrice Product unit price
* @param float $discountPercent Line discount percent
* @param int $fk_product Product id
* @return float Return integer <0 if KO, buyprice if OK
* @return float|int Return buy price if OK, integer <0 if KO
*/
public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_product = 0)
{

View file

@ -77,7 +77,7 @@ class FormAccounting extends Form
* @param string $morecss More css non HTML object
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
* @param int $disabledajaxcombo Disable ajax combo box.
* @return string String with HTML select
* @return string|int String with HTML select, or -1 if error
*/
public function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0)
{
@ -157,7 +157,7 @@ class FormAccounting extends Form
* @param string $morecss More css non HTML object
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
* @param int $disabledajaxcombo Disable ajax combo box.
* @return string String with HTML select
* @return string|int String with HTML select, or -1 if error
*/
public function multi_select_journal($selectedIds = array(), $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = '', $usecache = '', $disabledajaxcombo = 0)
{
@ -319,7 +319,7 @@ class FormAccounting extends Form
*
* @param string $htmlname Name of select field
* @param string $selectedkey Value
* @return string HTML edit field
* @return string|int HTML edit field, or -1 if error
*/
public function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '')
{
@ -359,7 +359,7 @@ class FormAccounting extends Form
* @param string $morecss More css non HTML object
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
* @param string $active Filter on status active or not: '0', '1' or '' for no filter
* @return string String with HTML select
* @return string|int String with HTML select, or -1 if error
*/
public function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $active = '1')
{
@ -467,7 +467,7 @@ class FormAccounting extends Form
* @param string $morecss More css
* @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache.
* @param string $labelhtmlname HTML name of label for autofill of account from name.
* @return string String with HTML select
* @return string|int String with HTML select, or -1 if error
*/
public function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'minwidth100 maxwidth300 maxwidthonsmartphone', $usecache = '', $labelhtmlname = '')
{
@ -560,7 +560,7 @@ class FormAccounting extends Form
* @param string $htmlname Name of HTML select object
* @param int $useempty Affiche valeur vide dans liste
* @param string $output_format (html/option (for option html only)/array (to return options arrays
* @return string|array HTML select component or array of select options
* @return string|array|int HTML select component || array of select options || - 1 if error
*/
public function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html')
{

View file

@ -755,7 +755,7 @@ class FormMail extends Form
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
$out .= '<tr><td>';
$out .= $langs->trans("MailToCCUsers");
$out .= '</td>';
$out .= '</td></td>';
// multiselect array convert html entities into options tags, even if we don't want this, so we encode them a second time
$tmparray = $this->withtoccuser;
@ -889,7 +889,7 @@ class FormMail extends Form
//input prompt AI
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
if (isModEnabled('ai')) {
if (isModEnabled('ai') && getDolGlobalConst('AI_CHATGPT_API_KEY')) {
$out .= $this->getHtmlForInstruction();
}
// Message

View file

@ -12826,7 +12826,11 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
$force_filter_contact = false;
if (get_class($filterobj) !== 'User') {
$force_filter_contact = false;
} else {
$force_filter_contact = true;
}
if (is_object($objcon) && $objcon->id > 0) {
$force_filter_contact = true;
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."actioncomm_resources as r ON a.id = r.fk_actioncomm";
@ -12891,6 +12895,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
$sql .= " AND a.fk_element = ".((int) $filterobj->id);
}
}
} else {
$sql .= " AND u.rowid = ". ((int) $filterobj->id);
}
// Condition on actioncode
@ -13080,8 +13086,10 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
} else {
$out .= '<input type="hidden" name="id" value="'.$filterobj->id.'" />';
}
if ($filterobj && get_class($filterobj) == 'Societe') {
if (($filterobj && get_class($filterobj) == 'Societe')) {
$out .= '<input type="hidden" name="socid" value="'.$filterobj->id.'" />';
} else {
$out .= '<input type="hidden" name="userid" value="'.$filterobj->id.'" />';
}
$out .= "\n";
@ -13139,6 +13147,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
if (get_class($filterobj) == 'Societe') {
$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&socid='.$filterobj->id.'&status=done">';
}
if (get_class($filterobj) == 'User') {
$tmp .= '<a href="'.DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&socid='.$filterobj->id.'&status=done">';
}
$tmp .= ($donetodo != 'done' ? $langs->trans("ActionsToDoShort") : '');
$tmp .= ($donetodo != 'done' && $donetodo != 'todo' ? ' / ' : '');
$tmp .= ($donetodo != 'todo' ? $langs->trans("ActionsDoneShort") : '');
@ -13146,6 +13157,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
if (get_class($filterobj) == 'Societe') {
$tmp .= '</a>';
}
if (get_class($filterobj) == 'User') {
$tmp .= '</a>';
}
$out .= getTitleFieldOfList($tmp);
}

View file

@ -1116,7 +1116,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
// Check if Extrafields is totalizable
if (!empty($extrafields->attributes['projet_task']['totalizable'])) {
foreach ($extrafields->attributes['projet_task']['totalizable'] as $key => $value) {
if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['ef.'.$key]['checked'] == 1) {
if (!empty($arrayfields['efpt.'.$key]['checked']) && $arrayfields['efpt.'.$key]['checked'] == 1) {
print '<td class="right">';
if ($value == 1) {
print empty($totalarray['totalizable'][$key]['total']) ? '' : $totalarray['totalizable'][$key]['total'];

View file

@ -94,6 +94,10 @@ class modExternalSite extends DolibarrModules
$this->rights_class = 'externalsite'; // Permission key
$this->rights = array(); // Permission array used by this module
$this->module_parts = array(
'moduleforexternal' => 1 // allow access to external users
);
// Menus
//------
$r = 0;
@ -110,7 +114,7 @@ class modExternalSite extends DolibarrModules
'perms'=>'',
'enabled'=>'$conf->externalsite->enabled',
'target'=>'',
'user'=>0
'user'=>2
);
$r++;
}

View file

@ -692,6 +692,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') {
jQuery("#price_ttc").val('');
jQuery("#multicurrency_subprice").val('');
jQuery("#multicurrency_price_ht").val('');
}
});
jQuery("#price_ttc").keyup(function(event) {
@ -699,11 +700,19 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) {
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
jQuery("#price_ht").val('');
jQuery("#multicurrency_subprice").val('');
jQuery("#multicurrency_price_ht").val('');
}
});
jQuery("#multicurrency_subprice").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') {
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_subprice").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}
});
jQuery("#multicurrency_price_ht").keyup(function(event) {
// console.log(event.which); // discard event tag and arrows
if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#multicurrency_price_ht").val() != '') {
jQuery("#price_ht").val('');
jQuery("#price_ttc").val('');
}

View file

@ -301,8 +301,9 @@ if (!$found) {
// There is no subdir that compose the main url root or autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
$tmp = $dolibarr_main_url_root;
} else {
$tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
$tmp = 'http'.((!isHTTPS() && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
}
//print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
if (!empty($dolibarr_main_force_https)) {
$tmp = preg_replace('/^http:/i', 'https:', $tmp);

View file

@ -1791,7 +1791,7 @@ if (empty($reshook)) {
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings
}
$price_base_type = 'HT';
$pu_devise = price2num($price_devise, 'CU');
$pu_devise = price2num($price_ht_devise, 'CU');
$result = $object->addline($product_desc, $pu_ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $date_start, $date_end, 0, $tva_npr, $price_base_type, $type, -1, 0, $array_options, $fk_unit, 0, $pu_devise, $ref_supplier);
}

View file

@ -9,26 +9,26 @@ DIRECTION=ltr
# cid0kr is for Korean
# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages
# freemono is for ru_RU or uk_UA, uz_UZ
# freeserif is for Tamil
FONTFORPDF=ሄልቬቲካ
# freeserif is for Tamil and Ethiopian
FONTFORPDF=freeserif
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=,
FormatDateShort=%m/%d/%Y
FormatDateShortInput=%m/%d/%Y
FormatDateShortJava=ወወ/ቀን/ዓዓ
FormatDateShortJavaInput=ወወ/ቀን/ዓዓ
FormatDateShortJQuery=ሚሜ/ቀን/ዓ
FormatDateShortJQueryInput=ሚሜ/ቀን/ዓ
FormatDateShortJava=MM/dd/yyyy
FormatDateShortJavaInput=MM/dd/yyyy
FormatDateShortJQuery=mm/dd/yy
FormatDateShortJQueryInput=mm/dd/yy
FormatHourShortJQuery=HH:MI
FormatHourShort=%I:%M %p
FormatHourShortDuration=%H፡%M
FormatDateTextShort=%b %d፣ %Y
FormatDateText=%B %d፣ %Y
FormatHourShortDuration=%H:%M
FormatDateTextShort=%b %d, %Y
FormatDateText=%B %d, %Y
FormatDateHourShort=%m/%d/%Y %I:%M %p
FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p
FormatDateHourTextShort=%b %d፣ %Y፣ %I:%M %p
FormatDateHourText=%B %d፣ %Y፣ %I:%M %p
FormatDateHourTextShort=%b %d, %Y, %I:%M %p
FormatDateHourText=%B %d, %Y, %I:%M %p
DatabaseConnection=የውሂብ ጎታ ግንኙነት
NoTemplateDefined=ለዚህ ኢሜይል አይነት ምንም አብነት የለም።
AvailableVariables=የሚገኙ ተለዋዋጮች

View file

@ -10,16 +10,16 @@ DIRECTION=ltr
# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages
# freemono is for ru_RU or uk_UA, uz_UZ
# freeserif is for Tamil
FONTFORPDF=helvetica
FONTFORPDF=DejaVuSans
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=,
FormatDateShort=%m/%d/%Y
FormatDateShortInput=%m/%d/%Y
FormatDateShortJava=AA/gg/yyyy
FormatDateShortJavaInput=AA/gg/yyyy
FormatDateShortJQuery=mm/gg/yy
FormatDateShortJQueryInput=mm/gg/yy
FormatDateShortJava=MM/dd/yyyy
FormatDateShortJavaInput=MM/dd/yyyy
FormatDateShortJQuery=MM/dd/yy
FormatDateShortJQueryInput=MM/dd/yy
FormatHourShortJQuery=HH:MI
FormatHourShort=%I:%M %p
FormatHourShortDuration=%H:%M

View file

@ -1,5 +1,5 @@
# Dolibarr language file - Source file is en_US - main
DIRECTION=লিটার
DIRECTION=ltr
# Default for FONTFORPDF=helvetica
# Note for Chinese:
# msungstdlight or cid0ct are for traditional Chinese zh_TW (traditional does not render with Ubuntu pdf reader)
@ -10,7 +10,7 @@ DIRECTION=লিটার
# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages
# freemono is for ru_RU or uk_UA, uz_UZ
# freeserif is for Tamil
FONTFORPDF=হেলভেটিকা
FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=.
SeparatorThousand=,

View file

@ -9,7 +9,7 @@ DIRECTION=ltr
# cid0kr is for Korean
# DejaVuSans is for some Eastern languages, some Asian languages and some Arabic languages
# freemono is for ru_RU or uk_UA, uz_UZ
# freeserif is for Tamil
# freeserif is for Tamil or Ethiopian
FONTFORPDF=helvetica
FONTSIZEFORPDF=10
SeparatorDecimal=.

View file

@ -456,7 +456,7 @@ if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->bro
// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && !defined('NOHTTPSREDIRECT')) {
if (!empty($conf->file->main_force_https) && isHTTPS() && !defined('NOHTTPSREDIRECT')) {
$newurl = '';
if (is_numeric($conf->file->main_force_https)) {
if ($conf->file->main_force_https == '1' && !empty($_SERVER["SCRIPT_URI"])) { // If SCRIPT_URI supported by server
@ -2213,17 +2213,18 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead
if (isset($_POST) && is_array($_POST)) {
foreach ($_POST as $key => $value) {
$key = preg_replace('/[^a-z0-9_\.\-\[\]]/i', '', $key);
if (in_array($key, array('action', 'massaction', 'password'))) {
continue;
}
if (!is_array($value)) {
if ($value !== '') {
$qs .= '&'.$key.'='.urlencode($value);
$qs .= '&'.urlencode($key).'='.urlencode($value);
}
} else {
foreach ($value as $value2) {
if (($value2 !== '') && (!is_array($value2))) {
$qs .= '&'.$key.'[]='.urlencode($value2);
$qs .= '&'.urlencode($key).'[]='.urlencode($value2);
}
}
}

View file

@ -107,6 +107,12 @@ if (!($result > 0)) {
}
$user->getrights();
$hookmanager->initHooks(array('cli'));
/*
* Main
*/
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
if (!isset($argv[1])) { // Check parameters

View file

@ -68,7 +68,7 @@ class FormProduct
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param boolean $sumStock sum total stock of a warehouse, default true
* @param array $exclude warehouses ids to exclude
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
* @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock
* @param string $orderBy [='e.ref'] Order by
* @return int Nb of loaded lines, 0 if already loaded, <0 if KO
* @throws Exception
@ -276,7 +276,7 @@ class FormProduct
* @param string $morecss Add more css classes to HTML select
* @param array $exclude Warehouses ids to exclude
* @param int $showfullpath 1=Show full path of name (parent ref into label), 0=Show only ref of current warehouse
* @param bool|int $stockMin [=false] Value of minimum stock to filter or false not not filter by minimum stock
* @param bool|int $stockMin [=false] Value of minimum stock to filter (only warehouse with stock > stockMin are loaded) or false not not filter by minimum stock
* @param string $orderBy [='e.ref'] Order by
* @param int $multiselect 1=Allow multiselect
* @return string HTML select

View file

@ -5924,7 +5924,6 @@ class Product extends CommonObject
$this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur);
}
$hookmanager->initHooks(array('productdao'));
$parameters = array('id'=>$this->id, 'includedraftpoforvirtual' => $includedraftpoforvirtual);
// Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager->executeHooks('loadvirtualstock', $parameters, $this, $action);

View file

@ -504,8 +504,11 @@ if (empty($reshook)) {
$newobject->fetch_optionals();
$newobject->fetch_thirdparty(); // Load new object
$object = $newobject;
$action = 'edit';
$action = 'view';
$comefromclone = true;
setEventMessages($langs->trans("ProjectCreatedInDolibarr", $newobject->ref), "", 'mesgs');
//var_dump($newobject); exit;
}
}

View file

@ -93,9 +93,9 @@ class SalariesStats extends Stats
/**
* Return the number of salary by month, for a given year
*
* @param string $year Year to scan
* @param int $year Year to scan
* @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
* @return array Array of values
* @return array Array of values by month
*/
public function getNbByMonth($year, $format = 0)
{

View file

@ -45,7 +45,7 @@ class SocieteAccount extends CommonObject
public $table_element = 'societe_account';
/**
* @var array Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 0;

View file

@ -175,15 +175,15 @@ if (empty($reshook)) {
$error = 0;
if (getDolGlobalString('TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT')) {
$bankaccount = GETPOST('accountid', 'int');
$bankaccount = GETPOSTINT('accountid');
} else {
if ($pay == 'LIQ') {
$bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility
$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]); // For backward compatibility
} elseif ($pay == "CHQ") {
$bankaccount = getDolGlobalString('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility
$bankaccount = getDolGlobalInt('CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]); // For backward compatibility
} else {
$accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"];
$bankaccount = getDolGlobalString($accountname);
$bankaccount = getDolGlobalInt($accountname);
}
}
@ -488,7 +488,7 @@ if (empty($reshook)) {
// If we add a line and no invoice yet, we create the invoice
if (($action == "addline" || $action == "freezone") && $placeid == 0 && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
$invoice->socid = getDolGlobalString($constforcompanyid);
$invoice->socid = getDolGlobalInt($constforcompanyid);
$invoice->date = dol_now('tzuserrel'); // We use the local date, only the day will be saved.
$invoice->module_source = 'takepos';
$invoice->pos_source = isset($_SESSION["takeposterminal"]) ? $_SESSION["takeposterminal"] : '' ;

View file

@ -172,7 +172,7 @@ if ((!empty($objUser->id) || !empty($objcon->id)) && $permok) {
$morehtmlright = '';
$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?userid='.$object->id;
$messagingUrl = DOL_URL_ROOT.'/user/messaging.php?userid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$messagingUrl = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);

230
htdocs/user/messaging.php Normal file
View file

@ -0,0 +1,230 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2006-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/societe/messaging.php
* \ingroup societe
* \brief Page of third party events
*/
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
// Load translation files required by the page
$langs->loadLangs(array('agenda', 'bills', 'companies', 'orders', 'propal'));
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'useragenda';
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) {
$actioncode = '0';
}
} else {
$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
}
$search_rowid = GETPOST('search_rowid');
$search_agenda_label = GETPOST('search_agenda_label');
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortfield) {
$sortfield = 'a.datep,a.id';
}
if (!$sortorder) {
$sortorder = 'DESC,DESC';
}
// Initialize technical objects
$object = new User($db);
if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref, '', 1);
$object->getrights();
}
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('agendathirdparty', 'globalcard'));
// Security check
$userid = GETPOST('userid', 'int');
if ($user->id) {
$userId = $user->id;
}
$result = $object->fetch($userid);
if ($result <= 0) {
accessforbidden('User not found');
}
$result = restrictedArea($user, 'user', $userId, '&user');
/*
* Actions
*/
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
if (empty($reshook)) {
// Cancel
if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
header("Location: ".$backtopage);
exit;
}
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
$actioncode = '';
$search_agenda_label = '';
}
}
/*
* View
*/
$form = new Form($db);
$person_name = !empty($object->firstname) ? $object->lastname.", ".$object->firstname : $object->lastname;
$title = $person_name." - ".$langs->trans('Info');
$help_url = '';
llxHeader('', $title, $help_url);
$head = user_prepare_head($object);
$title = $langs->trans("User");
print dol_get_fiche_head($head, 'info', $title, -1, 'user');
$linkback = '';
if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->transnoentitiesnoconv("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref);
$object->info($userid);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
print dol_get_fiche_end();
$objUser = $object;
$objcon = new stdClass();
$out = '';
$permok = $user->hasRight('agenda', 'myactions', 'create');
if ((!empty($objUser->id) || !empty($objcon->id)) && $permok) {
if (is_object($objUser) && get_class($objUser) == 'User') {
$out .= '&amp;originid='.$objUser->id.($objUser->id > 0 ? '&amp;userid='.$objUser->id : '').'&amp;backtopage='.urlencode($_SERVER['PHP_SELF'].($objUser->id > 0 ? '?userid='.$objUser->id : ''));
}
$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '');
$out .= '&amp;datep='.dol_print_date(dol_now(), 'dayhourlog', 'tzuserrel');
}
$morehtmlright = '';
$messagingUrl = DOL_URL_ROOT.'/user/messaging.php?userid='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1);
$messagingUrl = DOL_URL_ROOT.'/user/info.php?id='.$object->id;
$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2);
if (isModEnabled('agenda')) {
if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) {
$morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out);
}
}
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allaactions', 'read'))) {
print '<br>';
$param = '&userid='.urlencode($userid);
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&contextpage='.urlencode($contextpage);
}
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
// Try to know count of actioncomm from cache
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
$cachekey = 'count_events_user_'.$object->id;
$nbEvent = dol_getcache($cachekey);
$titlelist = $langs->trans("ActionsOnCompany").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
if (!empty($conf->dol_optimize_smallscreen)) {
$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
}
print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
// List of all actions
$filters = array();
$filters['search_agenda_label'] = $search_agenda_label;
$filters['search_rowid'] = $search_rowid;
show_actions_messaging($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder);
}
//End of page
llxFooter();
$db->close();

View file

@ -1304,8 +1304,8 @@ class ProductAttribute extends CommonObject
* But for the moment we don't know if it's possible as we keep a method available on overloaded objects.
*
* @param string $action Action code
* @param string $seller Object of seller third party
* @param string $buyer Object of buyer third party
* @param Societe $seller Object of seller third party
* @param Societe $buyer Object of buyer third party
* @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @param string $defaulttpldir Directory where to find the template

View file

@ -56,6 +56,9 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/paymentsocialcontribution
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -48,6 +48,9 @@ $version = DOL_VERSION;
$error = 0;
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -61,6 +61,9 @@ $langs->loadLangs(array('main', 'contracts'));
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -59,6 +59,9 @@ $langs->loadLangs(array('main', 'contracts'));
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -56,6 +56,13 @@ $version = DOL_VERSION;
$error = 0;
$forcecommit = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." - dir=".DOL_DATA_ROOT." *****\n";
dol_syslog($script_file." launched with arg ".join(',', $argv));

View file

@ -25,6 +25,7 @@
* \ingroup mailing
* \brief Script to send a prepared and validated emaling from command line
*/
if (!defined('NOSESSION')) {
define('NOSESSION', '1');
}
@ -78,6 +79,8 @@ if (!isModEnabled('mailing')) {
exit(-1);
}
$hookmanager->initHooks(array('cli'));
/*
* Main

View file

@ -62,6 +62,8 @@ if (!isModEnabled('mailing')) {
exit(-1);
}
$hookmanager->initHooks(array('cli'));
/*
* Main

View file

@ -61,6 +61,9 @@ $langs->load('main');
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -59,6 +59,9 @@ $langs->load('main');
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -52,6 +52,8 @@ $langs->load("main");
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main

View file

@ -49,6 +49,9 @@ $version = constant('DOL_VERSION');
$error = 0;
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -52,6 +52,9 @@ $error = 0;
$forcecommit = 0;
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -54,6 +54,9 @@ require_once DOL_DOCUMENT_ROOT."/adherents/class/adherent_type.class.php";
$version = constant('DOL_VERSION');
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -53,6 +53,9 @@ $error = 0;
$forcecommit = 0;
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -56,6 +56,13 @@ $version = DOL_VERSION;
$error = 0;
$forcecommit = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',', $argv));

View file

@ -56,6 +56,12 @@ $version = DOL_VERSION;
$error = 0;
$forcecommit = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',', $argv));

View file

@ -56,6 +56,13 @@ $version = DOL_VERSION;
$error = 0;
$forcecommit = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/
print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
dol_syslog($script_file." launched with arg ".join(',', $argv));

View file

@ -52,6 +52,9 @@ require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php";
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -53,6 +53,9 @@ $error = 0;
$forcecommit = 0;
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -52,6 +52,9 @@ require_once DOL_DOCUMENT_ROOT."/user/class/user.class.php";
$version = DOL_VERSION;
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -52,6 +52,9 @@ $forcecommit = 0;
$excludeuser = array();
$confirmed = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/

View file

@ -63,6 +63,8 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php';
$hookmanager->initHooks(array('cli'));
/*
* Main

View file

@ -58,6 +58,8 @@ include_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php';
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
include_once DOL_DOCUMENT_ROOT.'/core/lib/website2.lib.php';
$hookmanager->initHooks(array('cli'));
/*
* Main

View file

@ -47,6 +47,9 @@ require_once DOL_DOCUMENT_ROOT."/compta/paiement/class/paiement.class.php";
$version = constant('DOL_VERSION');
$error = 0;
$hookmanager->initHooks(array('cli'));
/*
* Main
*/