Merge branch 'develop' into patch-2

This commit is contained in:
Yamil Esteban Garcia 2024-04-02 12:05:03 +02:00 committed by GitHub
commit ee720e61f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 769 additions and 188 deletions

View file

@ -28,7 +28,7 @@ jobs:
# This is faster for a big repo.
- name: Get all changed php files (if PR)
id: changed-php
uses: tj-actions/changed-files@v43
uses: tj-actions/changed-files@v44
if: env.gh_event == 'pull_request'
with:
files: |
@ -66,7 +66,7 @@ jobs:
# The next uses git, which is slow for a bit repo.
# - name: Get all changed php files (if PR)
# id: changed-php
# uses: tj-actions/changed-files@v43
# uses: tj-actions/changed-files@v44
# if: env.gh_event == 'pull_request'
# with:
# files: |
@ -115,7 +115,7 @@ jobs:
ls -l ~/.cache/pre-commit/
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.3.4
uses: mdeweerd/logToCheckStyle@v2024.3.5
if: ${{ failure() }}
with:
in: ${{ env.RAW_LOG }}

View file

@ -157,7 +157,7 @@ jobs:
for /f "tokens=2 delims==" %%A in ('doskey /m:err') do EXIT /B %%A
- name: Convert Raw Log to Annotations
uses: mdeweerd/logToCheckStyle@v2024.3.4
uses: mdeweerd/logToCheckStyle@v2024.3.5
if: ${{ failure() }}
with:
in: ${{ env.PHPUNIT_LOG }}

View file

@ -10,7 +10,8 @@ To: customer@customercompany.fr
Subject: [MyBigCompany - Ticket #TS2008-0040] Nouveau message
Date: Thu, 20 Aug 2020 18:31:37 +0200
Message-ID: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
References: <1597941097.SMTPs-dolibarr-tic58@83b5bc91f83a56e458db71e0adac2b62>
References: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
In-Reply-To: <CALeEO_kij-ogXKzrjV_pTgqVbUB9j=287VkX34iVSWgDHFA8eg@mail.gmail.com>
X-Dolibarr-TRACKID: tic58@83b5bc91f83a56e458db71e0adac2b62
X-RemoteAddr: 127.0.0.1
X-Mailer: Dolibarr version 13.0.0-alpha (using SMTPs Mailer)
@ -25,17 +26,17 @@ Content-Type: multipart/alternative; boundary="mul_872cdd6a64216735955664484832b
--mul_872cdd6a64216735955664484832b075
Content-Type: text/plain; charset=UTF-8
Bonjour
Bonjour
Une nouvelle réponse a été ajoutée à un ticket que vous suivez. Voici
le message :PredefinedMailContentTicket_send
le message :PredefinedMailContentTicket_send
Vous pouvez voir la progression du ticket en cliquant sur le lien
ci-dessus. : fr5uw2yospypn2rz
Cordialement,
ci-dessus. : fr5uw2yospypn2rz
Cordialement,
--
--mul_872cdd6a64216735955664484832b075
Content-Type: text/html; charset=UTF-8

View file

@ -349,7 +349,12 @@ class Members extends DolibarrApi
$member->context['caller'] = $request_data['caller'];
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$member->array_options[$index] = $val;
}
continue;
}
// Process the status separately because it must be updated using
// the validate(), resiliate() and exclude() methods of the class Adherent.
if ($field == 'statut') {

View file

@ -60,14 +60,14 @@ class ActionComm extends CommonObject
public $picto = 'action';
/**
* @var int 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
* @var int<0,2> 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 1;
/**
* @var integer 0=Default
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* 2=Same than 1 but accept record if fksoc is empty
* @var int<0,2> 0=Default
* 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user
* 2=Same than 1 but accept record if fksoc is empty
*/
public $restrictiononfksoc = 2;
@ -129,7 +129,7 @@ class ActionComm extends CommonObject
* @var string Agenda event label
* @deprecated Use $label
*/
public $libelle;
private $libelle;
/**
* @var integer Date creation record (datec)
@ -197,7 +197,7 @@ class ActionComm extends CommonObject
/**
* @var int -1=Unknown duration
* @deprecated
* @deprecated Use ($datef - $datep)
*/
public $durationp = -1;
@ -212,7 +212,7 @@ class ActionComm extends CommonObject
public $ponctuel;
/**
* @var integer Percentage
* @var int<0,100> Percentage
*/
public $percentage;
@ -232,7 +232,7 @@ class ActionComm extends CommonObject
public $priority;
/**
* @var array<int,array{id:int,transparency:int}> Array of users
* @var array<int,array{id:int,transparency:int<0,1>}> Array of users
*/
public $userassigned = array();
@ -242,7 +242,7 @@ class ActionComm extends CommonObject
public $userownerid;
/**
* @var int[] Array of contact ids
* @var array<int,array{id:int,mandatory:int<0,1>,answer_status:int,transparency:int<0,1>}> Array of contact ids
*/
public $socpeopleassigned = array();
@ -252,7 +252,7 @@ class ActionComm extends CommonObject
public $otherassigned = array();
/**
* @var array Array of reminders
* @var array<int,ActionCommReminder> Array of reminders
*/
public $reminders = array();
@ -268,14 +268,14 @@ class ActionComm extends CommonObject
/**
* @var Societe|null Company linked to action (optional)
* @var ?Societe Company linked to action (optional)
* @deprecated
* @see $socid
*/
public $societe;
/**
* @var Contact|null Contact linked to action (optional)
* @var ?Contact Contact linked to action (optional)
* @deprecated
* @see $contact_id
*/
@ -318,7 +318,7 @@ class ActionComm extends CommonObject
public $extraparams;
/**
* @var array Actions
* @var array<int,array{id:int,type:string,actionparam:string,status:int}> Actions
*/
public $actions = array();
@ -377,12 +377,21 @@ class ActionComm extends CommonObject
public $status;
/**
* @var string IP address
*/
public $ip;
/*
* Properties to manage the recurring events
*/
public $recurid; /* A string YYYYMMDDHHMMSS shared by allevent of same series */
public $recurrule; /* Rule of recurring */
public $recurdateend; /* Repeat until this date */
/** @var string A string YYYYMMDDHHMMSS shared by allevent of same series */
public $recurid;
/** @var string Rule of recurring */
public $recurrule;
/** @var string Repeat until this date */
public $recurdateend;
/** @var int Duration of phone call when the event is a phone call */
public $calling_duration;
@ -405,6 +414,19 @@ class ActionComm extends CommonObject
public $fields = array();
/**
* Provide list of deprecated properties and replacements
*
* @return array<string,string> Old property to new property mapping
*/
protected function deprecatedProperties()
{
return array(
'libelle' => 'label',
) + parent::deprecatedProperties();
}
/**
* Constructor
*
@ -419,9 +441,9 @@ class ActionComm extends CommonObject
* Add an action/event into database.
* $this->type_id OR $this->type_code must be set.
*
* @param User $user Object user making action
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Id of created event, < 0 if KO
* @param User $user Object user making action
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Id of created event, < 0 if KO
*/
public function create(User $user, $notrigger = 0)
{
@ -775,12 +797,12 @@ class ActionComm extends CommonObject
/**
* Load object from database
*
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param int $loadresources 1=Load also resources
* @return int Return integer <0 if KO, >0 if OK
* @param int $id Id of action to get
* @param string $ref Ref of action to get
* @param string $ref_ext Ref ext to get
* @param string $email_msgid Email msgid
* @param int<0,1> $loadresources 1=Load also resources
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function fetch($id, $ref = '', $ref_ext = '', $email_msgid = '', $loadresources = 1)
{
@ -926,7 +948,7 @@ class ActionComm extends CommonObject
/**
* Initialize $this->userassigned & this->socpeopleassigned array with list of id of user and contact assigned to event
*
* @return int Return integer <0 if KO, >0 if OK
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function fetchResources()
{
@ -972,7 +994,7 @@ class ActionComm extends CommonObject
* Initialize this->userassigned array with list of id of user assigned to event
*
* @param bool $override Override $this->userownerid when empty. TODO This should be false by default. True is here to fix corrupted data.
* @return int Return integer <0 if KO, >0 if OK
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function fetch_userassigned($override = true)
{
@ -1017,9 +1039,9 @@ class ActionComm extends CommonObject
/**
* Delete event from database
*
* @param User $user User making the delete
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user User making the delete
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function delete($user, $notrigger = 0)
{
@ -1113,9 +1135,9 @@ class ActionComm extends CommonObject
* Update action into database
* If percentage = 100, on met a jour date 100%
*
* @param User $user Object user making change
* @param int $notrigger 1 = disable triggers, 0 = enable triggers
* @return int Return integer <0 if KO, >0 if OK
* @param User $user Object user making change
* @param int<0,1> $notrigger 1 = disable triggers, 0 = enable triggers
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function update(User $user, $notrigger = 0)
{
@ -1436,6 +1458,7 @@ class ActionComm extends CommonObject
$resql = $this->db->query($sql);
if ($resql) {
$response = null; // Ensure the variable is defined
if (empty($load_state_board)) {
$agenda_static = new ActionComm($this->db);
$response = new WorkboardResponse();
@ -1451,6 +1474,8 @@ class ActionComm extends CommonObject
// This assignment in condition is not a bug. It allows walking the results.
while ($obj = $this->db->fetch_object($resql)) {
if (empty($load_state_board)) {
'@phan-var-force WorkboardResponse $response
@phan-var-force ActionComm $agenda_static';
$response->nbtodo++;
$agenda_static->datep = $this->db->jdate($obj->dp);
if ($agenda_static->hasDelay()) {
@ -1515,8 +1540,8 @@ class ActionComm extends CommonObject
/**
* Return the label of the status
*
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int<0,7> $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int<0,1> $hidenastatus 1=Show nothing if status is "Not applicable"
* @return string String with status
*/
public function getLibStatut($mode, $hidenastatus = 0)
@ -1528,11 +1553,11 @@ class ActionComm extends CommonObject
/**
* Return label of action status
*
* @param int $percent Percent
* @param int $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int|string $datestart Date start of event
* @return string Label
* @param int<0,100> $percent Percent
* @param int<0,7> $mode 0=Long label, 1=Short label, 2=Picto+Short label, 3=Picto, 4=Picto+Short label, 5=Short label+Picto, 6=Picto+Long label, 7=Very short label+Picto
* @param int<0,1> $hidenastatus 1=Show nothing if status is "Not applicable"
* @param int|string $datestart Date start of event
* @return string Label
*/
public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '')
{
@ -1580,9 +1605,9 @@ class ActionComm extends CommonObject
/**
* getTooltipContentArray
* @param array $params params to construct tooltip data
* @param array<string,mixed> $params params to construct tooltip data
* @since v18
* @return array
* @return array{picto:string,ref?:string,title?:string,labeltype?:string,location?:string,transparency?:string,space?:string,mailtopic?:string,mailfrom?:string,mailto?:string,mailcc?:string,description?:string,note?:string,categories?:string}
*/
public function getTooltipContentArray($params)
{
@ -1603,7 +1628,6 @@ class ActionComm extends CommonObject
$labeltype = $langs->trans('ActionAC_MANUAL');
}
}
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans('Action').'</u>';
if (!empty($this->ref)) {
$datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.dol_escape_htmltag($this->ref);
@ -1658,13 +1682,13 @@ class ActionComm extends CommonObject
* Return URL of event
* Use $this->id, $this->type_code, $this->label and $this->type_label
*
* @param int $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
* @param int $maxlength Max number of characters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
* @param int $overwritepicto 1 = Overwrite picto with this one
* @param int $notooltip 1 = Disable tooltip
* @param int $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
* @param int<0,2> $withpicto 0 = No picto, 1 = Include picto into link, 2 = Only picto
* @param int $maxlength Max number of characters into label. If negative, use the ref as label.
* @param string $classname Force style class on a link
* @param string $option '' = Link to action, 'birthday'= Link to contact, 'holiday' = Link to leave
* @param int<0,1> $overwritepicto 1 = Overwrite picto with this one
* @param int<0,1> $notooltip 1 = Disable tooltip
* @param int<-1,1> $save_lastsearch_value -1 = Auto, 0 = No save of lastsearch_values when clicking, 1 = Save lastsearch_values whenclicking
* @return string Chaine avec URL
*/
public function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1)
@ -1690,9 +1714,6 @@ class ActionComm extends CommonObject
}
$label = $this->label;
if (empty($label)) {
$label = $this->libelle; // For backward compatibility
}
$result = '';
@ -1903,7 +1924,7 @@ class ActionComm extends CommonObject
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
* @return int Return integer <0 if KO, >0 if OK
* @return int<-1,1> Return integer <0 if KO, >0 if OK
*/
public function setCategories($categories)
{
@ -1948,9 +1969,9 @@ class ActionComm extends CommonObject
* @param string $type The type of the export 'event' or 'journal'
* @param integer $cachedelay Do not rebuild file if date older than cachedelay seconds
* @param string $filename The name for the exported file.
* @param array $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
* @param integer $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
* @return integer -1 = error on build export file, 0 = export okay
* @param array<string,int|string> $filters Array of filters. Example array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...)
* @param int<0,1> $exportholiday 0 = don't integrate holidays into the export, 1 = integrate holidays into the export
* @return int<-1,1> -1 = error on build export file, 0 = export okay
*/
public function build_exportfile($format, $type, $cachedelay, $filename, $filters, $exportholiday = 0)
{
@ -2124,7 +2145,7 @@ class ActionComm extends CommonObject
$condition = '<>';
}
$userforfilter = new User($this->db);
$result = $userforfilter->fetch('', $logina);
$result = $userforfilter->fetch(0, $logina);
if ($result > 0) {
$sql .= " AND a.fk_user_author ".$condition." ".$userforfilter->id;
} elseif ($result < 0 || $condition == '=') {
@ -2139,7 +2160,7 @@ class ActionComm extends CommonObject
$condition = '<>';
}
$userforfilter = new User($this->db);
$result = $userforfilter->fetch('', $logint);
$result = $userforfilter->fetch(0, $logint);
if ($result > 0) {
$sql .= " AND ar.fk_element = ".((int) $userforfilter->id);
} elseif ($result < 0 || $condition == '=') {
@ -2288,8 +2309,8 @@ class ActionComm extends CommonObject
}
if (getDolGlobalString('AGENDA_EXPORT_FIX_TZ')) {
$timestampStart = $timestampStart - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
$timestampEnd = $timestampEnd - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
$timestampStart -= ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
$timestampEnd -= ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600);
}
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
@ -2395,7 +2416,7 @@ class ActionComm extends CommonObject
* Used to build previews or test instances.
* id must be 0 if object instance is a specimen.
*
* @return int >0 if ok
* @return int<1,1> >0 if ok
*/
public function initAsSpecimen()
{
@ -2486,7 +2507,7 @@ class ActionComm extends CommonObject
* @param string $type Type of reminder 'browser' or 'email'
* @param int $fk_user Id of user
* @param bool $onlypast true = get only past reminder, false = get all reminders linked to this
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
* @return int<-1,max> < if OK, else count of number of reminders
*/
public function loadReminders($type = '', $fk_user = 0, $onlypast = true)
{
@ -2547,7 +2568,7 @@ class ActionComm extends CommonObject
* Send reminders by emails
* CAN BE A CRON TASK
*
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
* @return int<-1,1>|string 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
public function sendEmailsReminder()
{
@ -2589,6 +2610,7 @@ class ActionComm extends CommonObject
if ($resql) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($this->db);
$to = null; // Ensure 'to' is defined for static analysis
while ($obj = $this->db->fetch_object($resql)) {
$res = $actionCommReminder->fetch($obj->id);
@ -2721,10 +2743,10 @@ class ActionComm extends CommonObject
/**
* Update the percent value of a event with the given id
*
* @param int $id The id of the event
* @param int $percent The new percent value for the event
* @param int $usermodid The user who modified the percent
* @return int 1 when update of the event was suscessfull, otherwise -1
* @param int $id The id of the event
* @param int<0,100> $percent The new percent value for the event
* @param int $usermodid The user who modified the percent
* @return int<-1,1> 1 when update of the event was successful, otherwise -1
*/
public function updatePercent($id, $percent, $usermodid = 0)
{

View file

@ -916,7 +916,6 @@ if ($resql) {
$event->type = $obj->type_type;
$event->type_picto = $obj->type_picto;
$event->libelle = $obj->label; // deprecated
$event->label = $obj->label;
$event->percentage = $obj->percent;
@ -2166,17 +2165,15 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// Show title
$titletoshow = $daterange;
$titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label ? $event->label : $event->libelle);
$titletoshow .= ($titletoshow ? ' ' : '').dol_escape_htmltag($event->label);
if ($event->type_code != 'ICALEVENT') {
$savlabel = $event->label ? $event->label : $event->libelle;
$savlabel = $event->label;
$event->label = $titletoshow;
$event->libelle = $titletoshow; // deprecatd
// Note: List of users are inside $event->userassigned. Link may be clickable depending on permissions of user.
$titletoshow = (($event->type_picto || $event->type_code) ? $event->getTypePicto() : '');
$titletoshow .= $event->getNomUrl(0, $maxnbofchar, 'cal_event cal_event_title valignmiddle', '', 0, 0); // do not add 'inline-block' in css here: it makes the title transformed completely into '...'
$event->label = $savlabel;
$event->libelle = $savlabel;
}
// Loop on each assigned user

View file

@ -422,6 +422,8 @@ if (isModEnabled('order') && $user->hasRight('commande', 'lire')) {
*/
if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) {
$supplierorderstatic = new CommandeFournisseur($db);
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@ -639,7 +641,7 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) {
}
$num = $db->num_rows($resql);
startSimpleTable($langs->trans($header, min($max, $num)), "societe/list.php", "type=p,c", 1);
startSimpleTable($langs->trans($header, min($max, $num)), "societe/list.php", "type=p,c&sortfield=s.tms&sortorder=DESC", 1, -1, 'company');
if ($num) {
$i = 0;

View file

@ -697,7 +697,12 @@ class Proposals extends DolibarrApi
$this->propal->context['caller'] = $request_data['caller'];
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->propal->array_options[$index] = $val;
}
continue;
}
$this->propal->$field = $value;
}

View file

@ -652,7 +652,12 @@ class Orders extends DolibarrApi
$this->commande->context['caller'] = $request_data['caller'];
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->commande->array_options[$index] = $val;
}
continue;
}
$this->commande->$field = $value;
}

View file

@ -671,7 +671,12 @@ class Invoices extends DolibarrApi
$this->invoice->context['caller'] = $request_data['caller'];
continue;
}
if ($field == 'array_options' && is_array($value)) {
foreach ($value as $index => $val) {
$this->invoice->array_options[$index] = $val;
}
continue;
}
$this->invoice->$field = $value;
// If cond reglement => update date lim reglement

View file

@ -52,7 +52,7 @@ class CMailFile
public $subject;
public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '<myemail@example.com>' or 'John Doe <myemail@example.com>' or '<myemail+trackingid@example.com>'). Note that with gmail smtps, value here is forced by google to account (but not the reply-to).
// Sender: Who send the email ("Sender" has sent emails on behalf of "From").
// Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Use it when the "From" is an email of a domain that is a SPF protected domain, and the sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain.
// Return-Path: Email where to send bounds.
public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined)
public $errors_to; // Errors-To: Email where to send errors.
@ -114,7 +114,19 @@ class CMailFile
* @var string Message-ID of the email to send (generated)
*/
public $msgid;
/**
* @var string Value to use in In-reply-to when email is set as an answer of another email (The Msg-Id of received email)
*/
public $in_reply_to;
/**
* @var string References to add to the email to send (generated from the email we answer)
*/
public $references;
public $headers;
public $message;
/**
@ -172,10 +184,12 @@ class CMailFile
* @param string $trackid Tracking string (contains type and id of related element)
* @param string $moreinheader More in header. $moreinheader must contains the "\r\n" at end of each line
* @param string $sendcontext 'standard', 'emailing', 'ticket', 'password', ... (used to define which sending mode and parameters to use)
* @param string $replyto Reply-to email (will be set to same value than From by default if not provided)
* @param string $replyto Reply-to email (will be set to the same value than From by default if not provided)
* @param string $upload_dir_tmp Temporary directory (used to convert images embedded as img src=data:image)
* @param string $in_reply_to Message-ID of the message we reply Token
* @param string $references String with list of Message-ID of the thread ('<123> <456> ...')
*/
public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '', $upload_dir_tmp = '')
public function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '', $upload_dir_tmp = '', $in_reply_to = '', $references = '')
{
global $conf, $dolibarr_main_data_root, $user;
@ -428,6 +442,8 @@ class CMailFile
$this->reply_to = dol_sanitizeEmail($replyto);
$this->errors_to = dol_sanitizeEmail($errors_to);
$this->trackid = $trackid;
$this->in_reply_to = $in_reply_to;
$this->references = $references;
// Set arrays with attached files info
$this->filename_list = $filename_list;
$this->mimetype_list = $mimetype_list;
@ -462,7 +478,7 @@ class CMailFile
$text_body = "";
$files_encoded = "";
// Define smtp_headers (this also set ->msgid)
// Define smtp_headers (this also set SMTP headers from ->msgid, ->in_reply_to and ->references)
$smtp_headers = $this->write_smtpheaders();
if (!empty($moreinheader)) {
$smtp_headers .= $moreinheader; // $moreinheader contains the \r\n
@ -516,15 +532,23 @@ class CMailFile
$smtps->setSubject($subjecttouse);
$smtps->setTO($this->getValidAddress($this->addr_to, 0, 1));
$smtps->setFrom($this->getValidAddress($this->addr_from, 0, 1));
$smtps->setTrackId($this->trackid);
$smtps->setReplyTo($this->getValidAddress($this->reply_to, 0, 1));
//X-Dolibarr-TRACKID is generated inside the smtps->getHeader
$smtps->setTrackId($this->trackid);
if (!empty($this->in_reply_to)) {
$smtps->setInReplyTo($this->in_reply_to);
}
if (!empty($this->references)) {
$smtps->setReferences($this->references);
}
if (!empty($moreinheader)) {
$smtps->setMoreInHeader($moreinheader);
}
//X-Dolibarr-TRACKID, In-Reply-To, References and $moreinheader will be added to header inside the smtps->getHeader
if (!empty($this->html)) {
if (!empty($css)) {
$this->css = $css;
@ -592,8 +616,14 @@ class CMailFile
$msgid = $headers->get('Message-ID');
$msgid->setId($headerID);
// Add 'In-Reply-To:' header
if (!empty($this->in_reply_to)) {
$headers->addIdHeader('In-Reply-To', $this->in_reply_to);
}
// Add 'References:' header
//$headers->addIdHeader('References', $headerID);
if (!empty($this->references)) {
$headers->addIdHeader('References', $this->references);
}
if (!empty($moreinheader)) {
$moreinheaderarray = preg_split('/[\r\n]+/', $moreinheader);
@ -1543,16 +1573,23 @@ class CMailFile
$trackid = $this->trackid;
if ($trackid) {
// References is kept in response and Message-ID is returned into In-Reply-To:
$this->msgid = time().'.phpmail-dolibarr-'.$trackid.'@'.$host;
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2; // Uppercase seems replaced by phpmail
//$out .= 'References: <'.$this->msgid.">".$this->eol2;
$out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2;
} else {
$this->msgid = time().'.phpmail@'.$host;
$out .= 'Message-ID: <'.$this->msgid.">".$this->eol2;
}
// Add 'In-Reply-To:' header with the Message-Id we answer
if (!empty($this->in_reply_to)) {
$out .= 'In-Reply-To: <'.$this->in_reply_to.'>'.$this->eol2;
}
// Add 'References:' header with list of all Message-ID in thread history
if (!empty($this->references)) {
$out .= 'References: '.$this->references.$this->eol2;
}
if (!empty($_SERVER['REMOTE_ADDR'])) {
$out .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR'].$this->eol2;
}

View file

@ -10031,8 +10031,8 @@ class Form
$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" title="' . $email . ' Gravatar avatar" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="https://www.gravatar.com/avatar/' . dol_hash(strtolower(trim($email)), 'sha256', 1) . '?s=' . $width . '&d=' . $defaultimg . '">'; // gravatar need md5 hash
} else {
if ($nophoto == 'company') {
$ret .= '<div class="divforspanimg photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
$ret .= '<div class="difforspanimgright"></div>';
$ret .= '<div class="divforspanimg valignmiddle center photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . '>' . img_picto('', 'company') . '</div>';
//$ret .= '<div class="difforspanimgright"></div>';
} else {
$ret .= '<img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="" ' . ($width ? ' width="' . $width . '"' : '') . ($height ? ' height="' . $height . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '">';
}

View file

@ -4,7 +4,7 @@
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2011 Regis Houssin
* Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.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
@ -88,6 +88,16 @@ class SMTPs
*/
private $_msgReplyTo = null;
/**
* List of In-Reply-To
*/
private $_msgInReplyTo = null;
/**
* List of Msg-Id
*/
private $_msgReferences = null;
/**
* Who will the Message be sent to; TO, CC, BCC
* Multi-diminsional array containing addresses the message will
@ -1139,6 +1149,56 @@ class SMTPs
return $_retValue;
}
/**
* Set References in the list of Msg-Id
*
* @param string $_strInReplyTo List of Msg-Id
* @return void
*/
public function setInReplyTo($_strInReplyTo)
{
if ($_strInReplyTo) {
$this->_msgInReplyTo = $_strInReplyTo;
}
}
/**
* Retrieves the InReplyTo from which mail we reply to
*
* @return string Msg-Id of email we reply to
*/
public function getInReplyTo()
{
$_retValue = $this->_msgInReplyTo;
return $_retValue;
}
/**
* Set References in the list of Msg-Id
*
* @param string $_strReferences List of Msg-Id
* @return void
*/
public function setReferences($_strReferences)
{
if ($_strReferences) {
$this->_msgReferences = $_strReferences;
}
}
/**
* Retrieves the References from which mail will be the reply-to
*
* @return string List of Msg-Id
*/
public function getReferences()
{
$_retValue = $this->_msgReferences;
return $_retValue;
}
/**
* Inserts given addresses into structured format.
* This method takes a list of given addresses, via an array or a COMMA delimited string, and inserts them into a highly
@ -1453,8 +1513,6 @@ class SMTPs
if ($trackid) {
$_header .= 'Message-ID: <'.time().'.SMTPs-dolibarr-'.$trackid.'@'.$host.">\r\n";
$_header .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host."\r\n";
// References and In-Reply-To: will be set by caller
//$_header .= 'References: <'.time().'.SMTPs-dolibarr-'.$trackid.'@'.$host.">\r\n";
} else {
$_header .= 'Message-ID: <'.time().'.SMTPs@'.$host.">\r\n";
}
@ -1489,7 +1547,13 @@ class SMTPs
$_header .= 'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART ? 'MAIN_MAIL_USE_MULTI_PART' : 'No MAIN_MAIL_USE_MULTI_PART')."\r\n";
$_header .= 'Mime-Version: 1.0'."\r\n";
// TODO Add also $this->references and In-Reply-To
// Add also $this->references and In-Reply-To
if ($this->getInReplyTo()) {
$_header .= "In-Reply-To: ".$this->getInReplyTo()."\r\n";
}
if ($this->getReferences()) {
$_header .= "References: ".$this->getReferences()."\r\n";
}
return $_header;
}

View file

@ -12604,16 +12604,17 @@ function getNonce()
/**
* Start a table with headers and a optional clickable number (don't forget to use "finishSimpleTable()" after the last table row)
*
* @param string $header The first left header of the table (automatic translated)
* @param string $link (optional) The link to a internal dolibarr page, when click on the number (without the first "/")
* @param string $arguments (optional) Additional arguments for the link (e.g. "search_status=0")
* @param integer $emptyRows (optional) The count of empty rows after the first header
* @param integer $number (optional) The number that is shown right after the first header, when not set the link is shown on the right side of the header as "FullList"
* @param string $header The first left header of the table (automatic translated)
* @param string $link (optional) The link to a internal dolibarr page, when click on the number (without the first "/")
* @param string $arguments (optional) Additional arguments for the link (e.g. "search_status=0")
* @param integer $emptyRows (optional) The count of empty columns after the first column
* @param integer $number (optional) The number that is shown right after the first header, when not set the link is shown on the right side of the header as "FullList"
* @param string $pictofulllist (optional) The picto to use for the full list link
* @return void
*
* @see finishSimpleTable()
*/
function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0, $number = -1)
function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0, $number = -1, $pictofulllist = '')
{
global $langs;
@ -12657,7 +12658,12 @@ function startSimpleTable($header, $link = "", $arguments = "", $emptyRows = 0,
print '<a class="commonlink" href="'.DOL_URL_ROOT.'/'.$link.'">';
}
print $langs->trans("FullList");
if ($pictofulllist) {
print img_picto($langs->trans("FullList"), $pictofulllist);
} else {
print $langs->trans("FullList");
}
print '</a>';
print '</th>';
}

View file

@ -119,7 +119,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("societe") && isModEnabled("categorie")', __HANDLER__, 'left', 671__+MAX_llx_menu__, 'companies', '', 670__+MAX_llx_menu__, '/categories/card.php?mainmenu=companies&amp;action=create&amp;type=4', 'NewCategory', 1, 'categories', '$user->hasRight("categorie","creer")', '', 2, 0, __ENTITY__);
-- Product - Product
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', 'product', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=product', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2801__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/card.php?mainmenu=products&amp;leftmenu=product&amp;action=create&amp;type=0', 'NewProduct', 1, 'products', '$user->rights->produit->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2802__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/list.php?mainmenu=products&amp;leftmenu=product&amp;type=0', 'List', 1, 'products', '$user->rights->produit->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("product")', __HANDLER__, 'left', 2803__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/reassort.php?mainmenu=products&amp;type=0', 'MenuStocks', 1, 'products', '$user->rights->produit->lire && $user->rights->stock->lire', '', 2, 4, __ENTITY__);
@ -131,13 +131,13 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("propal")', __HANDLER__, 'left', 2804__+MAX_llx_menu__, 'products', '', 2800__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&amp;id=all&amp;leftmenu=stats&amp;type=0', 'Statistics', 1, 'main', '$user->rights->produit->lire', '', 2, 8, __ENTITY__);
-- Product - Services
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=service&amp;type=1', 'Services', 0, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2900__+MAX_llx_menu__, 'products', 'service', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=service', 'Services', 0, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2901__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/card.php?mainmenu=products&amp;leftmenu=service&amp;action=create&amp;type=1', 'NewService', 1, 'products', '$user->rights->service->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("service")', __HANDLER__, 'left', 2902__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/list.php?mainmenu=products&amp;leftmenu=service&amp;type=1', 'List', 1, 'products', '$user->hasRight("service","lire")', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("propal")', __HANDLER__, 'left', 2903__+MAX_llx_menu__, 'products', '', 2900__+MAX_llx_menu__, '/product/stats/card.php?mainmenu=products&amp;id=all&amp;leftmenu=stats&amp;type=1', 'Statistics', 1, 'main', '$user->hasRight("service","lire")', '', 2, 5, __ENTITY__);
-- Product - Stocks
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/stock/index.php?mainmenu=products&amp;leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3100__+MAX_llx_menu__, 'products', 'stock', 3__+MAX_llx_menu__, '/product/index.php?mainmenu=products&amp;leftmenu=stock', 'Stock', 0, 'stocks', '$user->rights->stock->lire', '', 2, 3, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3101__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/card.php?mainmenu=products&amp;action=create', 'MenuNewWarehouse', 1, 'stocks', '$user->rights->stock->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3102__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/list.php?mainmenu=products', 'List', 1, 'stocks', '$user->rights->stock->lire', '', 2, 1, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', 'isModEnabled("stock")', __HANDLER__, 'left', 3104__+MAX_llx_menu__, 'products', '', 3100__+MAX_llx_menu__, '/product/stock/movement_list.php?mainmenu=products', 'Movements', 1, 'stocks', '$user->rights->stock->mouvement->lire', '', 2, 3, __ENTITY__);

View file

@ -2069,7 +2069,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
if ($mainmenu == 'products') {
// Products
if (isModEnabled('product')) {
$newmenu->add("/product/index.php?leftmenu=product&amp;type=0", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/index.php?leftmenu=product", $langs->trans("Products"), 0, $user->hasRight('product', 'read'), '', $mainmenu, 'product', 0, '', '', '', img_picto('', 'product', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/card.php?leftmenu=product&amp;action=create&amp;type=0", $langs->trans("NewProduct"), 1, $user->hasRight('product', 'creer'));
$newmenu->add("/product/list.php?leftmenu=product&amp;type=0", $langs->trans("List"), 1, $user->hasRight('product', 'read'));
if (isModEnabled('stock')) {
@ -2097,7 +2097,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
// Services
if (isModEnabled('service')) {
$newmenu->add("/product/index.php?leftmenu=service&amp;type=1", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/index.php?leftmenu=service", $langs->trans("Services"), 0, $user->hasRight('service', 'read'), '', $mainmenu, 'service', 0, '', '', '', img_picto('', 'service', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/card.php?leftmenu=service&amp;action=create&amp;type=1", $langs->trans("NewService"), 1, $user->hasRight('service', 'creer'));
$newmenu->add("/product/list.php?leftmenu=service&amp;type=1", $langs->trans("List"), 1, $user->hasRight('service', 'read'));
@ -2121,7 +2121,7 @@ function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftme
// Warehouse
if (isModEnabled('stock')) {
$langs->load("stocks");
$newmenu->add("/product/stock/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/index.php?leftmenu=stock", $langs->trans("Warehouses"), 0, $user->hasRight('stock', 'lire'), '', $mainmenu, 'stock', 0, '', '', '', img_picto('', 'stock', 'class="paddingright pictofixedwidth"'));
$newmenu->add("/product/stock/card.php?action=create", $langs->trans("MenuNewWarehouse"), 1, $user->hasRight('stock', 'creer'));
$newmenu->add("/product/stock/list.php", $langs->trans("List"), 1, $user->hasRight('stock', 'lire'));
$newmenu->add("/product/stock/movement_list.php", $langs->trans("Movements"), 1, $user->hasRight('stock', 'mouvement', 'lire'));

View file

@ -188,12 +188,21 @@ class modPhpbarcode extends ModeleBarCode
dol_mkdir($conf->barcode->dir_temp);
if (!is_writable($conf->barcode->dir_temp)) {
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
if ($langs instanceof Translate) {
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
} else {
$this->error = "ErrorFailedToWriteInTempDirectory ".$conf->barcode->dir_temp;
}
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}
$file = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
$newcode = $code;
if (!preg_match('/^\w+$/', $code) || dol_strlen($code) > 32) {
$newcode = dol_hash($newcode, 'md5'); // No need for security here, we can use md5
}
$file = $conf->barcode->dir_temp . '/barcode_' . $newcode . '_' . $encoding . '.png';
$filebarcode = $file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode

View file

@ -152,16 +152,33 @@ class modTcpdfbarcode extends ModeleBarCode
*/
public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{
global $conf, $langs, $_GET;
global $conf, $langs;
// Force value of temp directory because we may call this even if module barcode is disabled
if (empty($conf->barcode)) {
$conf->barcode = new stdClass();
}
if (empty($conf->barcode->dir_temp)) {
$conf->barcode->dir_temp = DOL_DATA_ROOT.'/barcode/temp';
}
dol_mkdir($conf->barcode->dir_temp);
if (!is_writable($conf->barcode->dir_temp)) {
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
if ($langs instanceof Translate) {
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
} else {
$this->error = "ErrorFailedToWriteInTempDirectory ".$conf->barcode->dir_temp;
}
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}
$file = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
$newcode = $code;
if (!preg_match('/^\w+$/', $code) || dol_strlen($code) > 32) {
$newcode = dol_hash($newcode, 'md5'); // No need for security here, we can use md5
}
$file = $conf->barcode->dir_temp . '/barcode_' . $newcode . '_' . $encoding . '.png';
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) {
@ -188,7 +205,8 @@ class modTcpdfbarcode extends ModeleBarCode
$barcodeobj = new TCPDFBarcode($code, $tcpdfEncoding);
}
dol_syslog("writeBarCode::TCPDF.getBarcodePngData");
dol_syslog("writeBarCode::TCPDF.getBarcodePngData file=".$file);
if ($imageData = (string) $barcodeobj->getBarcodePngData($width, $height, $color)) {
if (function_exists('imagecreate')) {
$imageData = imagecreatefromstring($imageData);

View file

@ -1,6 +1,7 @@
<?php
/*
* Copyright (C) 2014-2021 Frederic France <frederic.france@netlogic.fr>
* 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
@ -51,7 +52,7 @@ class printing_printipp extends PrintingDriver
public $active = 'PRINTING_PRINTIPP';
/**
* @var array array of setup value
* @var array<int,array<string,int|string>> array of setup values
*/
public $conf = array();
@ -112,11 +113,11 @@ class printing_printipp extends PrintingDriver
$this->port = getDolGlobalString('PRINTIPP_PORT');
$this->user = getDolGlobalString('PRINTIPP_USER');
$this->password = getDolGlobalString('PRINTIPP_PASSWORD');
$this->conf[] = array('varname'=>'PRINTIPP_HOST', 'required'=>1, 'example'=>'localhost', 'type'=>'text');
$this->conf[] = array('varname'=>'PRINTIPP_PORT', 'required'=>1, 'example'=>'631', 'type'=>'text');
$this->conf[] = array('varname'=>'PRINTIPP_USER', 'required'=>0, 'example'=>'', 'type'=>'text', 'moreattributes'=>'autocomplete="off"');
$this->conf[] = array('varname'=>'PRINTIPP_PASSWORD', 'required'=>0, 'example'=>'', 'type'=>'password', 'moreattributes'=>'autocomplete="off"');
$this->conf[] = array('enabled'=>1, 'type'=>'submit');
$this->conf[] = array('varname' => 'PRINTIPP_HOST', 'required' => 1, 'example' => 'localhost', 'type' => 'text');
$this->conf[] = array('varname' => 'PRINTIPP_PORT', 'required' => 1, 'example' => '631', 'type' => 'text');
$this->conf[] = array('varname' => 'PRINTIPP_USER', 'required' => 0, 'example' => '', 'type' => 'text', 'moreattributes' => 'autocomplete="off"');
$this->conf[] = array('varname' => 'PRINTIPP_PASSWORD', 'required' => 0, 'example' => '', 'type' => 'password', 'moreattributes' => 'autocomplete="off"');
$this->conf[] = array('enabled' => 1, 'type' => 'submit');
}
/**
@ -194,6 +195,8 @@ class printing_printipp extends PrintingDriver
* Return list of available printers
*
* @return int 0 if OK, >0 if KO
*
* @phan-suppress PhanTypeExpectedObjectPropAccess
*/
public function listAvailablePrinters()
{
@ -216,6 +219,7 @@ class printing_printipp extends PrintingDriver
$list = $this->getlistAvailablePrinters();
foreach ($list as $value) {
$printer_det = $this->getPrinterDetail($value);
'@phan-var-force stdClass $printer_det';
$html .= '<tr class="oddeven">';
$html .= '<td>'.$value.'</td>';
//$html.= '<td><pre>'.print_r($printer_det,true).'</pre></td>';
@ -245,7 +249,7 @@ class printing_printipp extends PrintingDriver
/**
* Return list of available printers
*
* @return array list of printers
* @return string[] List of printers (URIs)
*/
public function getlistAvailablePrinters()
{
@ -267,7 +271,7 @@ class printing_printipp extends PrintingDriver
* Get printer detail
*
* @param string $uri URI
* @return array List of attributes
* @return stdClass List of attributes
*/
private function getPrinterDetail($uri)
{

View file

@ -66,6 +66,8 @@ if (!$sortfield) {
}
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
/*
* View
@ -190,8 +192,6 @@ print '</div>';
print '</div><div class="fichetwothirdright">';
$max = 10;
$langs->load("boxes");
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.statut as user_status, u.photo, u.email, u.admin,";
@ -223,7 +223,11 @@ if ($result) {
print '<th class="right">'.$langs->trans("AmountHT").'</th>';
print '<th class="right">'.$langs->trans("AmountTTC").'</th>';
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
print '<th>&nbsp;</th>';
print '<th>';
print '<a href="'.DOL_URL_ROOT.'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">';
print img_picto($langs->trans("FullList"), 'expensereport');
print '</a>';
print '</th>';
print '</tr>';
if ($num) {
$total_ttc = $totalam = $total = 0;

View file

@ -223,8 +223,13 @@ if (isModEnabled('holiday') && $user->hasRight('holiday', 'read')) {
print '<th colspan="3">'.$langs->trans("BoxTitleLastLeaveRequests", min($max, $num)).'</th>';
print '<th>'.$langs->trans("from").'</th>';
print '<th>'.$langs->trans("to").'</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
print '<th></th>';
print '<th class="right">';
print '<a href="'.DOL_URL_ROOT.'/holiday/list.php?sortfield=cp.tms&sortorder=DESC">';
print img_picto($langs->trans("FullList"), 'holiday');
print '</th>';
print '</tr>';
if ($num) {
while ($i < $num && $i < $max) {
$obj = $db->fetch_object($result);
@ -300,11 +305,13 @@ if (isModEnabled('expensereport') && $user->hasRight('expensereport', 'read')) {
print '<tr class="liste_titre">';
print '<th colspan="2">'.$langs->trans("BoxTitleLastModifiedExpenses", min($max, $num)).'</th>';
print '<th class="right">'.$langs->trans("TotalTTC").'</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
print '<th></th>';
print '<th class="right"><a href="'.DOL_URL_ROOT.'/expensereport/list.php?sortfield=d.tms&sortorder=DESC">';
print img_picto($langs->trans("FullList"), 'expensereport');
print '</th>';
print '</tr>';
if ($num) {
$total_ttc = $totalam = $total = 0;
if ($num) {
$expensereportstatic = new ExpenseReport($db);
$userstatic = new User($db);
while ($i < $num && $i < $max) {
@ -377,7 +384,11 @@ if (isModEnabled('recruitment') && $user->hasRight('recruitment', 'recruitmentjo
print '<th colspan="3">';
print $langs->trans("BoxTitleLatestModifiedCandidatures", min($max, $num));
print '</th>';
print '<th class="right" colspan="2"><a href="'.DOL_URL_ROOT.'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
print '<th></th>';
print '<th class="right"><a href="'.DOL_URL_ROOT.'/recruitment/recruitmentcandidature_list.php?sortfield=t.tms&sortorder=DESC">';
print img_picto($langs->trans("FullList"), 'recruitmentcandidature');
//print $langs->trans("FullList");
print '</th>';
print '</tr>';
if ($num) {
while ($i < $num) {

View file

@ -290,3 +290,5 @@ ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commande fk_element integer;
ALTER TABLE llx_receptiondet_batch CHANGE COLUMN fk_commandefourndet fk_elementdet integer;
ALTER TABLE llx_supplier_proposaldet MODIFY ref_fourn VARCHAR(128) NULL;
ALTER TABLE llx_projet ADD COLUMN ref_ext varchar(50) after ref;

View file

@ -26,7 +26,8 @@ create table llx_projet
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
dateo date, -- date start project
datee date, -- date end project
ref varchar(50),
ref varchar(50), -- reference number
ref_ext varchar(50), -- reference into an external system (not used by dolibarr)
entity integer DEFAULT 1 NOT NULL, -- multi company id
title varchar(255) NOT NULL,
description text,
@ -37,7 +38,7 @@ create table llx_projet
fk_opp_status integer DEFAULT NULL, -- if project is used to manage opportunities
opp_percent double(5,2),
fk_opp_status_end integer DEFAULT NULL, -- if project is used to manage opportunities (the opportunity status the project has when set to lose)
date_close datetime DEFAULT NULL,
date_close datetime DEFAULT NULL,
fk_user_close integer DEFAULT NULL,
note_private text,
note_public text,

View file

@ -400,7 +400,8 @@ ListSuppliersShort=List of Vendors
ListProspectsShort=List of Prospects
ListCustomersShort=List of Customers
ThirdPartiesArea=Third Parties/Contacts
LastModifiedThirdParties=Latest %s Third Parties which were modified
LastModifiedThirdParties=The latest %s modified Third Parties
LastModifiedContacts=The latest %s modified contacts
UniqueThirdParties=Total number of Third Parties
InActivity=Open
ActivityCeased=Closed

View file

@ -334,3 +334,4 @@ InternalWarehouse=Internal warehouse
ExternalWarehouse=External warehouse
QtyCurrentlyKnownInStock=The quantity the system think you have in stock. As long as the inventory is not closed, this is a realtime value and it may change if you continue to make stock movement during the inventory (not recommended).
QtyInStockWhenInventoryWasValidated=The quantity the system think you had in stock when the inventory was validated (before the stock correction)
LatestModifiedWarehouses=Latest %s modified warehouses

View file

@ -93,7 +93,8 @@ if ($conf->use_javascript_ajax) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder nohover centpercent">';
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("ManufacturingOrder").'</th></tr>'."\n";
print '<tr class="liste_titre"><th colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("ManufacturingOrder").'</th>';
print '</tr>'."\n";
$listofstatus = array(0, 1, 2, 3, 9);
foreach ($listofstatus as $status) {
$dataseries[] = array($staticmo->LibStatut($status, 1), (isset($vals[$status]) ? (int) $vals[$status] : 0));
@ -150,12 +151,11 @@ print '<br>';
print '</div><div class="fichetwothirdright">';
/*
* Last modified BOM
*/
$max = 5;
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status, a.fk_product";
$sql .= " FROM ".MAIN_DB_PREFIX."bom_bom as a";
$sql .= " WHERE a.entity IN (".getEntity('bom').")";
@ -167,7 +167,9 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LatestBOMModified", $max).'</th></tr>';
print '<th colspan="2">'.$langs->trans("LatestBOMModified", $max).'</th>';
print '<th class="right"><a href="'.DOL_URL_ROOT.'/bom/bom_list.php?sortfield=t.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'bom').'</th>';
print '</tr>';
$num = $db->num_rows($resql);
if ($num) {
@ -190,7 +192,7 @@ if ($resql) {
}
} else {
print '<tr class="oddeven">';
print '<td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '</tr>';
}
print "</table></div>";
@ -203,7 +205,6 @@ if ($resql) {
* Last modified MOs
*/
$max = 5;
$sql = "SELECT a.rowid, a.status, a.ref, a.tms as datem, a.status";
$sql .= " FROM ".MAIN_DB_PREFIX."mrp_mo as a";
@ -216,7 +217,9 @@ if ($resql) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<th colspan="4">'.$langs->trans("LatestMOModified", $max).'</th></tr>';
print '<th colspan="2">'.$langs->trans("LatestMOModified", $max).'</th>';
print '<th class="right"><a href="'.DOL_URL_ROOT.'/mrp/mo_list.php?sortfield=t.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'mrp').'</th>';
print '</tr>';
$num = $db->num_rows($resql);
if ($num) {
@ -238,7 +241,7 @@ if ($resql) {
}
} else {
print '<tr class="oddeven">';
print '<td><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '<td colspan="3"><span class="opacitymedium">'.$langs->trans("None").'</span></td>';
print '</tr>';
}
print "</table></div>";

View file

@ -78,11 +78,16 @@ if (GETPOST('addbox')) {
}
}
$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
/*
* View
*/
$producttmp = new Product($db);
$warehouse = new Entrepot($db);
$transAreaType = $langs->trans("ProductsAndServicesArea");
$helpurl = '';
@ -304,15 +309,14 @@ if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_PRODU
* Latest modified products
*/
if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
$max = 15;
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.tosell, p.tobuy, p.tobatch, p.fk_price_expression,";
$sql .= " p.entity,";
$sql .= " p.tms as datem";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE p.entity IN (".getEntity($product_static->element, 1).")";
if ($type != '') {
/*if ($type != '') {
$sql .= " AND p.fk_product_type = ".((int) $type);
}
}*/
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $product_static); // Note that $action and $object may have been modified by hook
@ -330,10 +334,10 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
if ($num > 0) {
$transRecordedType = $langs->trans("LastModifiedProductsAndServices", $max);
if (GETPOSTISSET("type") && GETPOST("type") == '0') {
if (!isModEnabled('service')) {
$transRecordedType = $langs->trans("LastRecordedProducts", $max);
}
if (GETPOSTISSET("type") && GETPOST("type") == '1') {
if (!isModEnabled('product')) {
$transRecordedType = $langs->trans("LastRecordedServices", $max);
}
@ -346,7 +350,15 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
}
$lastmodified .= '<tr class="liste_titre"><th colspan="'.$colnb.'">'.$transRecordedType.'</th>';
$lastmodified .= '<th class="right" colspan="3"><a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC">'.$langs->trans("FullList").'</td>';
$lastmodified .= '<th class="right" colspan="3">';
$lastmodified .= '<a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC&type=0">';
//$lastmodified .= $langs->trans("FullList");
$lastmodified .= img_picto($langs->trans("FullList").' - '.$langs->trans("Products"), 'product');
$lastmodified .= '</a> &nbsp; ';
$lastmodified .= '<a href="'.DOL_URL_ROOT.'/product/list.php?sortfield=p.tms&sortorder=DESC&type=1">';
//$langs->trans("FullList").'</a>';
$lastmodified .= img_picto($langs->trans("FullList").' - '.$langs->trans("Services"), 'service');
$lastmodified .= '</th>';
$lastmodified .= '</tr>';
while ($i < $num) {
@ -435,6 +447,174 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr
}
}
$latestwarehouse = '';
if (isModEnabled('stock')) {
$sql = "SELECT e.rowid, e.ref as label, e.lieu, e.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= " WHERE e.statut in (".Entrepot::STATUS_CLOSED.",".Entrepot::STATUS_OPEN_ALL.")";
$sql .= " AND e.entity IN (".getEntity('stock').")";
$sql .= $db->order('e.tms', 'DESC');
$sql .= $db->plimit($max + 1, 0);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$latestwarehouse .= '<div class="div-table-responsive-no-min">';
$latestwarehouse .= '<table class="noborder centpercent">';
$latestwarehouse .= '<tr class="liste_titre">';
$latestwarehouse .= '<th>';
$latestwarehouse .= $langs->trans("LatestModifiedWarehouses", $max);
//$latestwarehouse .= '<a href="'.DOL_URL_ROOT.'/product/stock/list.php">';
// TODO: "search_status" on "/product/stock/list.php" currently only accept a single integer value
//print '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?search_status='.Entrepot::STATUS_CLOSED.','.Entrepot::STATUS_OPEN_ALL.'">';
//$latestwarehouse .= '<span class="badge">'.$num.'</span>';
$latestwarehouse .= '</th><th class="right">';
$latestwarehouse .= '<a href="'.DOL_URL_ROOT.'/product/stock/list.php?sortfield=p.tms&sortorder=DESC">';
$latestwarehouse .= img_picto($langs->trans("FullList"), 'stock');
$latestwarehouse .= '</a>';
$latestwarehouse .= '</th>';
$latestwarehouse .= '</tr>';
$i = 0;
if ($num) {
while ($i < min($max, $num)) {
$objp = $db->fetch_object($result);
$warehouse->id = $objp->rowid;
$warehouse->statut = $objp->status;
$warehouse->label = $objp->label;
$warehouse->lieu = $objp->lieu;
$latestwarehouse .= '<tr class="oddeven">';
$latestwarehouse .= '<td>';
$latestwarehouse .= $warehouse->getNomUrl(1);
$latestwarehouse .= '</td>'."\n";
$latestwarehouse .= '<td class="right">';
$latestwarehouse .= $warehouse->getLibStatut(5);
$latestwarehouse .= '</td>';
$latestwarehouse .= "</tr>\n";
$i++;
}
$db->free($result);
} else {
$latestwarehouse .= '<tr><td>'.$langs->trans("None").'</td><td></td></tr>';
}
/*if ($num > $max) {
$latestwarehouse .= '<tr><td><span class="opacitymedium">'.$langs->trans("More").'...</span></td><td></td></tr>';
}*/
$latestwarehouse .= "</table>";
$latestwarehouse .= '</div>';
$latestwarehouse .= '<br>';
} else {
dol_print_error($db);
}
}
$latestmovement = '';
if (isModEnabled('product')) {
// Latest movements
$sql = "SELECT p.rowid, p.label as produit, p.tobatch, p.tosell, p.tobuy,";
$sql .= " e.ref as warehouse_ref, e.rowid as warehouse_id, e.ref as warehouse_label, e.lieu, e.statut as warehouse_status,";
$sql .= " m.rowid as mid, m.value as qty, m.datem, m.batch, m.eatby, m.sellby";
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e";
$sql .= ", ".MAIN_DB_PREFIX."stock_mouvement as m";
$sql .= ", ".MAIN_DB_PREFIX."product as p";
$sql .= " WHERE m.fk_product = p.rowid";
$sql .= " AND m.fk_entrepot = e.rowid";
$sql .= " AND e.entity IN (".getEntity('stock').")";
if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
$sql .= " AND p.fk_product_type = ".Product::TYPE_PRODUCT;
}
$sql .= $db->order("datem", "DESC");
$sql .= $db->plimit($max, 0);
dol_syslog("Index:list stock movements", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$latestmovement .= '<div class="div-table-responsive-no-min">';
$latestmovement .= '<table class="noborder centpercent">';
$latestmovement .= '<tr class="liste_titre">';
$latestmovement .= '<th>'.$langs->trans("LastMovements", min($num, $max)).'</th>';
$latestmovement .= '<th>'.$langs->trans("Product").'</th>';
if (isModEnabled('productbatch')) {
$latestmovement .= '<th>'.$langs->trans("Batch").'</th>';
}
$latestmovement .= '<th>'.$langs->trans("Warehouse").'</th>';
$latestmovement .= '<th class="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/product/stock/movement_list.php">';
$latestmovement .= img_picto($langs->trans("FullList"), 'movement');
$latestmovement .= '</a></th>';
$latestmovement .= "</tr>\n";
$tmplotstatic = new Productlot($db);
$i = 0;
while ($i < min($num, $max)) {
$objp = $db->fetch_object($resql);
$producttmp->id = $objp->rowid;
$producttmp->ref = $objp->produit;
$producttmp->status_batch = $objp->tobatch;
$producttmp->status_sell = $objp->tosell;
$producttmp->status_buy = $objp->tobuy;
$warehouse->id = $objp->warehouse_id;
$warehouse->ref = $objp->warehouse_ref;
$warehouse->statut = $objp->warehouse_status;
$warehouse->label = $objp->warehouse_label;
$warehouse->lieu = $objp->lieu;
$tmplotstatic->batch = $objp->batch;
$tmplotstatic->sellby = $objp->sellby;
$tmplotstatic->eatby = $objp->eatby;
$latestmovement .= '<tr class="oddeven">';
$latestmovement .= '<td class="nowraponall">'.img_picto($langs->trans("Ref").' '.$objp->mid, 'movement', 'class="pictofixedwidth"').dol_print_date($db->jdate($objp->datem), 'dayhour').'</td>';
$latestmovement .= '<td class="tdoverflowmax150">';
$latestmovement .= $producttmp->getNomUrl(1);
$latestmovement .= "</td>\n";
if (isModEnabled('productbatch')) {
$latestmovement .= '<td>';
$latestmovement .= $tmplotstatic->getNomUrl(0, 'nolink');
$latestmovement .= '</td>';
/*if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td>'.dol_print_date($db->jdate($objp->sellby), 'day').'</td>';
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td>'.dol_print_date($db->jdate($objp->eatby), 'day').'</td>';
}*/
}
$latestmovement .= '<td class="tdoverflowmax150">';
$latestmovement .= $warehouse->getNomUrl(1);
$latestmovement .= "</td>\n";
$latestmovement .= '<td class="right">';
if ($objp->qty < 0) {
$latestmovement .= '<span class="stockmovementexit">';
}
if ($objp->qty > 0) {
$latestmovement .= '<span class="stockmovemententry">';
$latestmovement .= '+';
}
$latestmovement .= $objp->qty;
$latestmovement .= '</span>';
$latestmovement .= '</td>';
$latestmovement .= "</tr>\n";
$i++;
}
$db->free($resql);
$latestmovement .= "</table>";
$latestmovement .= '</div>';
$latestmovement .= '<br>';
} else {
dol_print_error($db);
}
}
// TODO Move this into a page that should be available into menu "accountancy - report - turnover - per quarter"
// Also method used for counting must provide the 2 possible methods like done by all other reports into menu "accountancy - report - turnover":
@ -468,6 +648,8 @@ $boxlist .= "</div>\n";
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $lastmodified;
$boxlist .= $latestwarehouse;
$boxlist .= $latestmovement;
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>'."\n";

View file

@ -308,7 +308,7 @@ if ($action == 'createmovements' && $user->hasRight('stock', 'mouvement', 'creer
$db->commit();
setEventMessages($langs->trans("StockMovementRecorded"), null, 'mesgs');
header("Location: ".DOL_URL_ROOT.'/product/stock/index.php'); // Redirect to avoid pb when using back
header("Location: ".DOL_URL_ROOT.'/product/stock/list.php'); // Redirect to avoid pb when using back
exit;
} else {
$db->rollback();

View file

@ -64,8 +64,8 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier
$id = GETPOSTINT('id');
$ref = GETPOST('ref', 'alpha');
$msid = GETPOSTINT('msid');
$idproduct = GETPOSTINT('idproduct');
$product_id = GETPOSTINT("product_id");
$idproduct = GETPOST('idproduct', 'intcomma');
$product_id = GETPOST("product_id", 'intcomma');
$show_files = GETPOSTINT('show_files');
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
@ -86,8 +86,8 @@ $search_inventorycode = trim(GETPOST("search_inventorycode"));
$search_user = trim(GETPOST("search_user"));
$search_batch = trim(GETPOST("search_batch"));
$search_qty = trim(GETPOST("search_qty"));
$search_type_mouvement = GETPOSTINT('search_type_mouvement');
$search_fk_project = GETPOSTINT("search_fk_project");
$search_type_mouvement = GETPOST('search_type_mouvement');
$search_fk_project = GETPOST("search_fk_project");
$type = GETPOSTINT("type");

View file

@ -77,7 +77,7 @@ class Projects extends DolibarrApi
$result = $this->project->fetch($id);
if (!$result) {
throw new RestException(404, 'Project not found');
throw new RestException(404, 'Project with supplied id not found');
}
if (!DolibarrApi::_checkAccessToResource('project', $this->project->id)) {
@ -88,7 +88,67 @@ class Projects extends DolibarrApi
return $this->_cleanObjectDatas($this->project);
}
/**
* Get properties of a project object
*
* Return an array with project information
*
* @param string $ref Ref of project
* @return Object Object with cleaned properties
*
* @url GET ref/{ref}
*
* @throws RestException
*/
public function getByRef($ref)
{
if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) {
throw new RestException(403);
}
$result = $this->project->fetch('', $ref);
if (!$result) {
throw new RestException(404, 'Project with supplied ref not found');
}
if (!DolibarrApi::_checkAccessToResource('project', $this->project->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->project->fetchObjectLinked();
return $this->_cleanObjectDatas($this->project);
}
/**
* Get properties of a project object
*
* Return an array with project information
*
* @param string $email_msgid Email msgid of project
* @return Object Object with cleaned properties
*
* @url GET email_msgid/{email_msgid}
*
* @throws RestException
*/
public function getByMsgId($email_msgid)
{
if (!DolibarrApiAccess::$user->hasRight('projet', 'lire')) {
throw new RestException(403);
}
$result = $this->project->fetch('', '', '', $email_msgid);
if (!$result) {
throw new RestException(404, 'Project with supplied email_msgid not found');
}
if (!DolibarrApi::_checkAccessToResource('project', $this->project->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->project->fetchObjectLinked();
return $this->_cleanObjectDatas($this->project);
}
/**
* List projects

View file

@ -30,6 +30,7 @@
// Load Dolibarr environment
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -42,7 +43,6 @@ $hookmanager = new HookManager($db);
$hookmanager->initHooks(array('thirdpartiesindex'));
$socid = GETPOSTINT('socid');
if ($user->socid) {
$socid = $user->socid;
@ -52,6 +52,7 @@ if ($user->socid) {
$result = restrictedArea($user, 'societe', 0, '', '', '', '');
$thirdparty_static = new Societe($db);
$contact_static = new Contact($db);
if (!isset($form) || !is_object($form)) {
$form = new Form($db);
@ -73,6 +74,8 @@ if (GETPOST('addbox')) {
}
}
$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT');
/*
* View
@ -86,9 +89,7 @@ llxHeader("", $langs->trans("ThirdParties"), $helpurl);
print load_fiche_titre($transAreaType, $resultboxes['selectboxlist'], 'companies');
/*
* Statistics area
*/
// Statistics area
$third = array(
'customer' => 0,
@ -276,7 +277,6 @@ if (isModEnabled('category') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_THIRD
/*
* Latest modified third parties
*/
$max = 15;
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
@ -294,6 +294,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
// TODO Replace this
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
@ -333,7 +334,7 @@ if ($result) {
$lastmodified .= '<tr class="liste_titre"><th colspan="2">'.$transRecordedType.'</th>';
$lastmodified .= '<th>&nbsp;</th>';
$lastmodified .= '<th class="right"><a href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC">'.$langs->trans("FullList").'</th>';
$lastmodified .= '<th class="right"><a href="'.DOL_URL_ROOT.'/societe/list.php?sortfield=s.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'company').'</th>';
$lastmodified .= '</tr>'."\n";
while ($i < $num) {
@ -384,7 +385,132 @@ if ($result) {
dol_print_error($db);
}
//print '</div></div></div>';
/*
* Latest modified contacts
*/
$sql = "SELECT s.rowid, s.nom as name, s.email, s.client, s.fournisseur";
$sql .= ", s.code_client";
$sql .= ", s.code_fournisseur";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql .= ", spe.accountancy_code_supplier as code_compta_fournisseur";
$sql .= ", spe.accountancy_code_customer as code_compta";
} else {
$sql .= ", s.code_compta_fournisseur";
$sql .= ", s.code_compta";
}
$sql .= ", s.logo";
$sql .= ", s.entity";
$sql .= ", s.canvas";
$sql .= ", s.tms as date_modification, s.status as status";
$sql .= ", sp.rowid as cid, sp.canvas as ccanvas, sp.email as cemail, sp.firstname, sp.lastname";
$sql .= ", sp.address as caddress, sp.phone as cphone";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as sp";
if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity);
}
// TODO Replace this
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ' WHERE s.entity IN ('.getEntity('societe').') AND sp.fk_soc = s.rowid';
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
if (!$user->hasRight('fournisseur', 'lire')) {
$sql .= " AND (s.fournisseur != 1 OR s.client != 0)";
}
// Add where from hooks
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $thirdparty_static); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
if ($socid > 0) {
$sql .= " AND s.rowid = ".((int) $socid);
}
}
$sql .= $hookmanager->resPrint;
$sql .= $db->order("s.tms", "DESC");
$sql .= $db->plimit($max, 0);
//print $sql;
$lastmodifiedcontact = '';
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0;
if ($num > 0) {
$transRecordedType = $langs->trans("LastModifiedContacts", $max);
$lastmodifiedcontact = "\n<!-- last contacts modified -->\n";
$lastmodifiedcontact .= '<div class="div-table-responsive-no-min">';
$lastmodifiedcontact .= '<table class="noborder centpercent">';
$lastmodifiedcontact .= '<tr class="liste_titre"><th colspan="2">'.$transRecordedType.'</th>';
$lastmodifiedcontact .= '<th>&nbsp;</th>';
$lastmodifiedcontact .= '<th class="right"><a href="'.DOL_URL_ROOT.'/socpeople/list.php?sortfield=s.tms&sortorder=DESC">'.img_picto($langs->trans("FullList"), 'contact').'</th>';
$lastmodifiedcontact .= '</tr>'."\n";
while ($i < $num) {
$objp = $db->fetch_object($result);
$thirdparty_static->id = $objp->rowid;
$thirdparty_static->name = $objp->name;
$thirdparty_static->client = $objp->client;
$thirdparty_static->fournisseur = $objp->fournisseur;
$thirdparty_static->logo = $objp->logo;
$thirdparty_static->date_modification = $db->jdate($objp->date_modification);
$thirdparty_static->status = $objp->status;
$thirdparty_static->code_client = $objp->code_client;
$thirdparty_static->code_fournisseur = $objp->code_fournisseur;
$thirdparty_static->canvas = $objp->canvas;
$thirdparty_static->email = $objp->email;
$thirdparty_static->entity = $objp->entity;
$thirdparty_static->code_compta_fournisseur = $objp->code_compta_fournisseur;
$thirdparty_static->code_compta = $objp->code_compta;
$thirdparty_static->code_compta_client = $objp->code_compta;
$contact_static->id = $objp->cid;
$contact_static->firstname = $objp->firstname;
$contact_static->lastname = $objp->lastname;
$contact_static->email = $objp->cemail;
$contact_static->socid = $objp->rowid;
$contact_static->canvas = $objp->ccanvas;
$contact_static->phone_pro = $objp->cphone;
$contact_static->address = $objp->caddress;
$lastmodifiedcontact .= '<tr class="oddeven">';
// Name
$lastmodifiedcontact .= '<td class="nowrap tdoverflowmax200">';
$lastmodifiedcontact .= $thirdparty_static->getNomUrl(1);
$lastmodifiedcontact .= "</td>\n";
// Contact
$lastmodifiedcontact .= '<td>';
$lastmodifiedcontact .= $contact_static->getNomUrl(1);
$lastmodifiedcontact .= '</td>';
// Last modified date
$lastmodifiedcontact .= '<td class="right tddate" title="'.dol_escape_htmltag($langs->trans("DateModification").' '.dol_print_date($thirdparty_static->date_modification, 'dayhour', 'tzuserrel')).'">';
$lastmodifiedcontact .= dol_print_date($thirdparty_static->date_modification, 'day', 'tzuserrel');
$lastmodifiedcontact .= "</td>";
$lastmodifiedcontact .= '<td class="right nowrap">';
$lastmodifiedcontact .= $thirdparty_static->getLibStatut(3);
$lastmodifiedcontact .= "</td>";
$lastmodifiedcontact .= "</tr>\n";
$i++;
}
$db->free($result);
$lastmodifiedcontact .= "</table>\n";
$lastmodifiedcontact .= '</div>';
$lastmodifiedcontact .= "<!-- End last contacts modified -->\n";
}
} else {
dol_print_error($db);
}
// boxes
print '<div class="clearboth"></div>';
@ -403,6 +529,8 @@ $boxlist .= '</div>'."\n";
$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
$boxlist .= $lastmodified;
$boxlist .= '<br>';
$boxlist .= $lastmodifiedcontact;
$boxlist .= '<br>';
$boxlist .= $resultboxes['boxlistb'];
$boxlist .= '</div>'."\n";

View file

@ -216,6 +216,8 @@ body {
font-weight: 400;
background-color: var(--colorbackbody);
<?php print 'direction: '.$langs->trans("DIRECTION").";\n"; ?>
/*transform: scale(1.2);
transform-origin: 0 0;*/
}
/* Style used to protect html content in output to avoid attack by replacing full page with js content */
@ -3095,11 +3097,8 @@ if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
padding-left: 10px;
width: 14px;
}
.login_table .tdinputlogin input#username, .login_table .tdinputlogin input#password {
font-size: 1em;
}
.login_table .tdinputlogin input#securitycode {
font-size: 1em;
.login_table .tdinputlogin input#username, .login_table .tdinputlogin input#password, .login_table .tdinputlogin input#securitycode {
font-size: 1.1em;
}
/* For the static info message */
.login_main_home {
@ -3280,6 +3279,7 @@ span.userimg div.userphoto {
width: 1.4em;
height: 1.4em;
padding-top: 1px;
display: inline-block;
}
img.userphotosmall { /* size for user photo in lists */
border-radius: 0.6em;

View file

@ -514,7 +514,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
flex-grow : 1;
flex-shrink: 1;
flex-basis: auto;
width: 280px;
width: 290px;
}
.box-flex-item.filler {
height: 0;

View file

@ -216,7 +216,7 @@ $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmpp
if ($tmpval <= 460) {
$colortextbackvmenu = 'FFFFFF';
} else {
$colortextbackvmenu = '000000';
$colortextbackvmenu = '222222';
}
$colortopbordertitle1 = implode(',', colorStringToArray($colortopbordertitle1)); // Normalize value to 'x,y,z'

View file

@ -567,7 +567,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
flex-shrink: 1;
flex-basis: auto;
width: 280px;
width: 290px;
margin: 5px 0px 0px 15px;
}
.box-flex-item.filler{
@ -616,6 +616,3 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) {
max-width: calc(100% - 82px);
}
}

View file

@ -225,7 +225,7 @@ $tmpval = (!empty($tmppart[0]) ? $tmppart[0] : 0) + (!empty($tmppart[1]) ? $tmpp
if ($tmpval <= 460) {
$colortextbackvmenu = 'FFFFFF';
} else {
$colortextbackvmenu = '000000';
$colortextbackvmenu = '222222';
}
$colortopbordertitle1 = implode(',', colorStringToArray($colortopbordertitle1)); // Normalize value to 'x,y,z'
@ -2655,7 +2655,7 @@ img.hideonsmartphone.pictoactionview {
.pictofixedwidth {
text-align: <?php echo $left; ?>;
width: 20px;
width: 21px;
/* padding-right: 0; */
}
@ -3355,6 +3355,14 @@ img.userphoto { /* size for user photo in lists */
background-size: contain;
vertical-align: middle;
}
span.userimg div.userphoto {
background-color: #eee;
border-radius: 0.72em;
width: 1.4em;
height: 1.4em;
padding-top: 1px;
display: inline-block;
}
img.userphotosmall { /* size for user photo in lists */
border-radius: 0.6em;
width: 1.2em;

View file

@ -3020,20 +3020,22 @@ class Ticket extends CommonObject
if (!empty($this->email_msgid)) {
// We must also add 1 entry In-Reply-To: <$this->email_msgid> with Message-ID we respond from (See RFC5322).
$moreinheader .= 'In-Reply-To: <'.$this->email_msgid.'>'."\r\n";
// TODO We should now be able to give the in_reply_to as a dedicated parameter of new CMailFile() instead of into $moreinheader.
}
// We should add here also a header 'References:'
// According to RFC5322, we should add here all the References fields of the initial message concatenated with
// the Message-ID of the message we respond from (but each ID must be once).
$references = '';
if (empty($this->origin_references)) {
// TODO If No References is set, use the In-Reply-To for $references .= (empty($references) ? '' : ' ').Source In-reply-To
} else {
if (!empty($this->origin_references)) { // $this->origin_references should be '<'.$this->origin_references.'>'
$references .= (empty($references) ? '' : ' ').$this->origin_references;
}
$references .= (empty($references) ? '' : ' ').'<'.$this->email_msgid.'>';
if (!empty($this->email_msgid) && !preg_match('/'.preg_quote($this->email_msgid, '/').'/', $references)) {
$references .= (empty($references) ? '' : ' ').'<'.$this->email_msgid.'>';
}
if ($references) {
$moreinheader .= 'References: '.$references."\r\n";
// TODO We should now be able to give the references as a dedicated parameter of new CMailFile() instead of into $moreinheader.
}
$mailfile = new CMailFile($subject, $receiver, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid, $moreinheader, 'ticket', '', $upload_dir_tmp);

View file

@ -339,6 +339,7 @@ if ($modulepart == 'barcode') {
// Load barcode class
$classname = "mod".ucfirst($generator);
$module = new $classname($db);
if ($module->encodingIsSupported($encoding)) {
$result = $module->buildBarCode($code, $encoding, $readable);