Merge branch 'develop' into fix_element_type_part_03
This commit is contained in:
commit
1d77e34daf
202 changed files with 1545 additions and 1189 deletions
|
|
@ -26,6 +26,10 @@ The following changes may create regressions for some external modules, but were
|
|||
* All CLI tools (into /scripts) return a positive value to the shell if error (0 remains success) for a better
|
||||
cross platform compatibility. On linux the exit(-1) was caught as 255, it may be now exit(1) so will be caught as 1.
|
||||
* the parameter $filter of method fetchAll does not accept array of SQL but must be a string of an Universal Search Filter syntax.
|
||||
* Use of dol_eval with parameter $returnvalue=0 is deprecated.
|
||||
* The signature for all ->delete() method has been modified to match the modulebuilder template (so first paramis now always $user), except
|
||||
the delete for thirdparty (still accept the id of thirdparty to delete as first parameter). Will probably be modified into another version.
|
||||
|
||||
|
||||
|
||||
***** ChangeLog for 19.0.1 compared to 19.0.0 *****
|
||||
|
|
|
|||
|
|
@ -23,16 +23,17 @@ the project: `pre-commit-config.yaml`.
|
|||
|
||||
### Installation in your git project
|
||||
|
||||
1. Install `pre-commit` tool.\
|
||||
1. Install pre-commit tool.\
|
||||
If you do not have python installed, install [python](https://www.python.org) first.\
|
||||
If you do not have [`pip`](https://pypi.org/project/pip), install that as well.\\
|
||||
|
||||
Then you can install pre-commit tool: `python -m pip install pre-commit`.
|
||||
Then you can install pre-commit tool:
|
||||
`python3 -m pip install pre-commit`
|
||||
|
||||
2. In your local git clone of the project, run `pre-commit install` to add the hooks.\
|
||||
or copy the file git/hooks/pre-commit manually. (recommended because this file differs
|
||||
from the file installed with pre-commit install as it redirects output to the error
|
||||
channel so your IDE will be able to catch the error.
|
||||
2. In your local git clone of the project, run `pre-commit install` to add the hooks
|
||||
or copy the file *dev/setup/git/hooks/pre-commit* manually into *.git/hooks/pre-commit*
|
||||
(recommended because this file may differ from the file installed with the pre-commit install).
|
||||
The good file redirects output to the error channel so your IDE will be able to catch the error.
|
||||
|
||||
|
||||
### Tips
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ if ($reshook < 0) {
|
|||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == "yes") {
|
||||
$result = $object->delete($id);
|
||||
$result = $object->delete($user);
|
||||
if ($result >= 0) {
|
||||
header("Location: fiscalyear.php");
|
||||
exit();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class AccountingAccount extends CommonObject
|
|||
* Load record in memory
|
||||
*
|
||||
* @param int $rowid Id
|
||||
* @param string $account_number Account number
|
||||
* @param string|null $account_number Account number
|
||||
* @param int|boolean $limittocurrentchart 1 or true=Load record only if it is into current active chart of account
|
||||
* @param string $limittoachartaccount 'ABC'=Load record only if it is into chart account with code 'ABC' (better and faster than previous parameter if you have chart of account code).
|
||||
* @return int Return integer <0 if KO, 0 if not found, Id of record if OK and found
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class AccountingJournal extends CommonObject
|
|||
public $active;
|
||||
|
||||
/**
|
||||
* @var array array of lines
|
||||
* @var AccountingJournal[] array of lines
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
|
|
|
|||
|
|
@ -1231,7 +1231,7 @@ class BookKeeping extends CommonObject
|
|||
} elseif ($key == 't.reconciled_option') {
|
||||
$sqlwhere[] = 't.lettering_code IS NULL';
|
||||
} else {
|
||||
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->escape($this->db->escapeforlike($value))."%'";
|
||||
$sqlwhere[] = $this->db->sanitize($key)." LIKE '%".$this->db->escape($this->db->escapeforlike($value))."%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
$result = $object->delete($id, $user);
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("RecordDeleted"), null, 'errors');
|
||||
if (!empty($backtopage) && !preg_match('/'.preg_quote($_SERVER["PHP_SELF"], '/').'/', $backtopage)) {
|
||||
|
|
|
|||
|
|
@ -1061,21 +1061,18 @@ class Adherent extends CommonObject
|
|||
/**
|
||||
* Fonction to delete a member and its data
|
||||
*
|
||||
* @param int $rowid Id of member to delete
|
||||
* @param User $user User object
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int Return integer <0 if KO, 0=nothing to do, >0 if OK
|
||||
*/
|
||||
public function delete($rowid, $user, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
$result = 0;
|
||||
$error = 0;
|
||||
$errorflag = 0;
|
||||
|
||||
// Check parameters
|
||||
if (empty($rowid)) {
|
||||
$rowid = $this->id;
|
||||
}
|
||||
$rowid = $this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
|
|||
|
|
@ -406,7 +406,7 @@ class Members extends DolibarrApi
|
|||
}
|
||||
|
||||
|
||||
$res = $member->delete($member->id, DolibarrApiAccess::$user);
|
||||
$res = $member->delete(DolibarrApiAccess::$user);
|
||||
if ($res < 0) {
|
||||
throw new RestException(500, "Can't delete, error occurs");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,11 +194,11 @@ foreach ($object->fields as $key => $val) {
|
|||
if (!empty($val['visible'])) {
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields[$tableprefix.'.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>dol_eval($val['enabled'], 1),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
'label' => $val['label'],
|
||||
'checked' =>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position' => $val['position'],
|
||||
'help' => isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ if ($user->hasRight('adherent', 'cotisation', 'creer') && $action == 'edit') {
|
|||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print '<input type="text" class="flat" name="note" value="'.$object->note_private.'"></td></tr>';
|
||||
print '<input type="text" class="flat" name="note" value="'.$object->note_public.'"></td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (isModEnabled("bank") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) {
|
||||
|
|
@ -334,7 +334,7 @@ if ($rowid && $action != 'edit') {
|
|||
print '<tr><td>'.$langs->trans("Amount").'</td><td class="valeur"><span class="amount">'.price($object->amount).'</span></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td class="valeur sensiblehtmlcontent">'.dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_public)).'</td></tr>';
|
||||
|
||||
// Bank line
|
||||
if (isModEnabled("bank") && (getDolGlobalString('ADHERENT_BANK_USE') || $object->fk_bank)) {
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) {
|
|||
}
|
||||
|
||||
//print '-name='.$name.'-color='.$color;
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$res = dolibarr_set_const($db, 'AGENDA_EXT_NAME'.$i, $name, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
|
|
@ -205,10 +206,10 @@ print "<br>\n";
|
|||
|
||||
|
||||
$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT');
|
||||
if ($selectedvalue==1) {
|
||||
$selectedvalue=0;
|
||||
if ($selectedvalue == 1) {
|
||||
$selectedvalue = 0;
|
||||
} else {
|
||||
$selectedvalue=1;
|
||||
$selectedvalue = 1;
|
||||
}
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
|
@ -224,7 +225,7 @@ print '<tr class="oddeven">';
|
|||
print "<td>".$langs->trans("ExtSitesEnableThisTool")."</td>";
|
||||
print '<td class="center">';
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1);
|
||||
print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled' => array(0 => '.hideifnotset')), null, 1);
|
||||
} else {
|
||||
if (!getDolGlobalString('AGENDA_DISABLE_EXT')) {
|
||||
print '<a href="'.$_SERVER['PHP_SELF'].'?save=1&AGENDA_DISABLE_EXT=1">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
|
|
@ -269,7 +270,7 @@ while ($i <= $MAXAGENDA) {
|
|||
$default = 'AGENDA_EXT_ACTIVEBYDEFAULT' . $key;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
// Nb
|
||||
// Nb @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print '<td width="180" class="nowrap">' . $langs->trans("AgendaExtNb", $key) . "</td>";
|
||||
// Name
|
||||
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_NAME' . $key . '" value="' . (GETPOST('AGENDA_EXT_NAME' . $key) ? GETPOST('AGENDA_EXT_NAME' . $key, 'alpha') : getDolGlobalString($name)) . '" size="28"></td>';
|
||||
|
|
@ -286,6 +287,7 @@ while ($i <= $MAXAGENDA) {
|
|||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key);
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
if (getDolGlobalString($default)) {
|
||||
print '<a href="' . $_SERVER['PHP_SELF'] . '?action=del_AGENDA_EXT_ACTIVEBYDEFAULT' . $key . '&token='.newToken().'">' . img_picto($langs->trans("Disabled"), 'off') . '</a>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,8 @@ $rowid = GETPOST('rowid', 'alpha');
|
|||
$entity = GETPOSTINT('entity');
|
||||
$code = GETPOST('code', 'alpha');
|
||||
|
||||
$acts = array(); $actl = array();
|
||||
$acts = array();
|
||||
$actl = array();
|
||||
$acts[0] = "activate";
|
||||
$acts[1] = "disable";
|
||||
$actl[0] = img_picto($langs->trans("Disabled"), 'switch_off', 'class="size15x"');
|
||||
|
|
@ -472,7 +473,7 @@ $tabrowid[27] = "id";
|
|||
$tabrowid[28] = "";
|
||||
$tabrowid[29] = "";
|
||||
$tabrowid[30] = "";
|
||||
$tabrowid[31]= "";
|
||||
$tabrowid[31] = "";
|
||||
$tabrowid[32] = "id";
|
||||
$tabrowid[33] = "rowid";
|
||||
$tabrowid[34] = "rowid";
|
||||
|
|
@ -539,58 +540,58 @@ $tabhelp = array();
|
|||
|
||||
// Table to store complete information (will replace all other table). Key is table name.
|
||||
$tabcomplete = array(
|
||||
'c_forme_juridique'=>array(
|
||||
'picto'=>'company',
|
||||
'help'=>array('code'=>$langs->trans("EnterAnyCode"))
|
||||
'c_forme_juridique' => array(
|
||||
'picto' => 'company',
|
||||
'help' => array('code' => $langs->trans("EnterAnyCode"))
|
||||
),
|
||||
'c_departements'=>array(
|
||||
'picto'=>'state',
|
||||
'help'=>array('code'=>$langs->trans("EnterAnyCode"))
|
||||
'c_departements' => array(
|
||||
'picto' => 'state',
|
||||
'help' => array('code' => $langs->trans("EnterAnyCode"))
|
||||
),
|
||||
'c_regions'=>array(
|
||||
'picto'=>'region',
|
||||
'help'=>array('code'=>$langs->trans("EnterAnyCode"))
|
||||
'c_regions' => array(
|
||||
'picto' => 'region',
|
||||
'help' => array('code' => $langs->trans("EnterAnyCode"))
|
||||
),
|
||||
'c_country'=>array('picto'=>'country', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_civility'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_actioncomm'=>array('picto'=>'action', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'color'=>$langs->trans("ColorFormat"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_chargesociales'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_typent'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_currencies'=>array('picto'=>'multicurrency', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency"))),
|
||||
'c_tva'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc"))),
|
||||
'c_type_contact'=>array('picto'=>'contact', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_payment_term'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")))),
|
||||
'c_paiement'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_ecotaxe'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_paper_format'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_prospectlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_type_fees'=>array('picto'=>'trip', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_shipment_mode'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'tracking'=>$langs->trans("UrlTrackingDesc"))),
|
||||
'c_effectif'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_input_method'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_input_reason'=>array('picto'=>'order', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_availability'=>array('picto'=>'shipment', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_revenuestamp'=>array('picto'=>'bill', 'help'=>array('revenuestamp_type'=>$langs->trans('FixedOrPercent'))),
|
||||
'c_type_resource'=>array('picto'=>'resource', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_type_container'=>array('picto'=>'website', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_stcomm'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
|
||||
'c_holiday_types'=>array('picto'=>'holiday', 'help'=>array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"))),
|
||||
'c_lead_status'=>array('picto'=>'project', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"))),
|
||||
'c_format_cards'=>array('picto'=>'generic', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"))),
|
||||
'c_hrm_public_holiday'=>array('picto'=>'holiday', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'dayrule'=>"Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country'=>$langs->trans("CountryIfSpecificToOneCountry"), 'year'=>$langs->trans("ZeroMeansEveryYear"))),
|
||||
'c_hrm_department'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_hrm_function'=>array('picto'=>'hrm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_exp_tax_cat'=>array('picto'=>'expensereport', 'help'=>array()),
|
||||
'c_exp_tax_range'=>array('picto'=>'expensereport', 'help'=>array('range_ik'=>$langs->trans('PrevRangeToThisRange'))),
|
||||
'c_units'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'))),
|
||||
'c_socialnetworks'=>array('picto'=>'share-alt', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'))),
|
||||
'c_prospectcontactlevel'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_stcommcontact'=>array('picto'=>'company', 'help'=>array('code'=>$langs->trans("EnterAnyCode"), 'picto'=>$langs->trans("PictoHelp"))),
|
||||
'c_transport_mode'=>array('picto'=>'incoterm', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_product_nature'=>array('picto'=>'product', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_productbatch_qcstatus'=>array('picto'=>'lot', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_asset_disposal_type'=>array('picto'=>'asset', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_invoice_subtype'=>array('picto'=>'bill', 'help'=>array('code'=>$langs->trans("EnterAnyCode"))),
|
||||
'c_country' => array('picto' => 'country', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_civility' => array('picto' => 'contact', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_actioncomm' => array('picto' => 'action', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'color' => $langs->trans("ColorFormat"), 'position' => $langs->trans("PositionIntoComboList"))),
|
||||
'c_chargesociales' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_typent' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'position' => $langs->trans("PositionIntoComboList"))),
|
||||
'c_currencies' => array('picto' => 'multicurrency', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'unicode' => $langs->trans("UnicodeCurrency"))),
|
||||
'c_tva' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'taux' => $langs->trans("SellTaxRate"), 'recuperableonly' => $langs->trans("RecuperableOnly"), 'localtax1_type' => $langs->trans("LocalTaxDesc"), 'localtax2_type' => $langs->trans("LocalTaxDesc"))),
|
||||
'c_type_contact' => array('picto' => 'contact', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'position' => $langs->trans("PositionIntoComboList"))),
|
||||
'c_payment_term' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'type_cdr' => $langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset")))),
|
||||
'c_paiement' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_ecotaxe' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_paper_format' => array('picto' => 'generic', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_prospectlevel' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_type_fees' => array('picto' => 'trip', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_shipment_mode' => array('picto' => 'shipment', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'tracking' => $langs->trans("UrlTrackingDesc"))),
|
||||
'c_effectif' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_input_method' => array('picto' => 'order', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_input_reason' => array('picto' => 'order', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'position' => $langs->trans("PositionIntoComboList"))),
|
||||
'c_availability' => array('picto' => 'shipment', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_revenuestamp' => array('picto' => 'bill', 'help' => array('revenuestamp_type' => $langs->trans('FixedOrPercent'))),
|
||||
'c_type_resource' => array('picto' => 'resource', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_type_container' => array('picto' => 'website', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_stcomm' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'picto' => $langs->trans("PictoHelp"))),
|
||||
'c_holiday_types' => array('picto' => 'holiday', 'help' => array('affect' => $langs->trans("FollowedByACounter"), 'delay' => $langs->trans("MinimumNoticePeriod"), 'newbymonth' => $langs->trans("NbAddedAutomatically"))),
|
||||
'c_lead_status' => array('picto' => 'project', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'percent' => $langs->trans("OpportunityPercent"), 'position' => $langs->trans("PositionIntoComboList"))),
|
||||
'c_format_cards' => array('picto' => 'generic', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'name' => $langs->trans("LabelName"), 'paper_size' => $langs->trans("LabelPaperSize"))),
|
||||
'c_hrm_public_holiday' => array('picto' => 'holiday', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'dayrule' => "Keep empty for a date defined with month and day (most common case).<br>Use a keyword like 'easter', 'eastermonday', ... for a date predefined by complex rules.", 'country' => $langs->trans("CountryIfSpecificToOneCountry"), 'year' => $langs->trans("ZeroMeansEveryYear"))),
|
||||
'c_hrm_department' => array('picto' => 'hrm', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_hrm_function' => array('picto' => 'hrm', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_exp_tax_cat' => array('picto' => 'expensereport', 'help' => array()),
|
||||
'c_exp_tax_range' => array('picto' => 'expensereport', 'help' => array('range_ik' => $langs->trans('PrevRangeToThisRange'))),
|
||||
'c_units' => array('picto' => 'product', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('Measuringtype_durationDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'))),
|
||||
'c_socialnetworks' => array('picto' => 'share-alt', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'))),
|
||||
'c_prospectcontactlevel' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_stcommcontact' => array('picto' => 'company', 'help' => array('code' => $langs->trans("EnterAnyCode"), 'picto' => $langs->trans("PictoHelp"))),
|
||||
'c_transport_mode' => array('picto' => 'incoterm', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_product_nature' => array('picto' => 'product', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_productbatch_qcstatus' => array('picto' => 'lot', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_asset_disposal_type' => array('picto' => 'asset', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
'c_invoice_subtype' => array('picto' => 'bill', 'help' => array('code' => $langs->trans("EnterAnyCode"))),
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -622,7 +623,7 @@ foreach ($tabcomplete as $key => $value) {
|
|||
$keytable = '';
|
||||
if ($id > 0) {
|
||||
$arrayofkeys = array_keys($tabcomplete);
|
||||
if (array_key_exists($id -1, $arrayofkeys)) {
|
||||
if (array_key_exists($id - 1, $arrayofkeys)) {
|
||||
$keytable = $arrayofkeys[$id - 1];
|
||||
}
|
||||
}
|
||||
|
|
@ -701,23 +702,23 @@ $localtax_typeList = array(
|
|||
|
||||
$object = new stdClass();
|
||||
$parameters = array(
|
||||
'id' =>$id,
|
||||
'rowid' =>$rowid,
|
||||
'code' =>$code,
|
||||
'confirm' =>$confirm,
|
||||
'entity' =>$entity,
|
||||
'taborder' =>$taborder,
|
||||
'tabname' =>$tabname,
|
||||
'tablib' =>$tablib,
|
||||
'tabsql' =>$tabsql,
|
||||
'tabsqlsort' =>$tabsqlsort,
|
||||
'tabfield' =>$tabfield,
|
||||
'tabfieldvalue' =>$tabfieldvalue,
|
||||
'tabfieldinsert'=>$tabfieldinsert,
|
||||
'tabrowid' =>$tabrowid,
|
||||
'tabcond' =>$tabcond,
|
||||
'tabhelp' =>$tabhelp,
|
||||
'tabcomplete' =>$tabcomplete
|
||||
'id' => $id,
|
||||
'rowid' => $rowid,
|
||||
'code' => $code,
|
||||
'confirm' => $confirm,
|
||||
'entity' => $entity,
|
||||
'taborder' => $taborder,
|
||||
'tabname' => $tabname,
|
||||
'tablib' => $tablib,
|
||||
'tabsql' => $tabsql,
|
||||
'tabsqlsort' => $tabsqlsort,
|
||||
'tabfield' => $tabfield,
|
||||
'tabfieldvalue' => $tabfieldvalue,
|
||||
'tabfieldinsert' => $tabfieldinsert,
|
||||
'tabrowid' => $tabrowid,
|
||||
'tabcond' => $tabcond,
|
||||
'tabhelp' => $tabhelp,
|
||||
'tabcomplete' => $tabcomplete
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
|
|
@ -771,11 +772,11 @@ if (empty($reshook)) {
|
|||
&& (
|
||||
!in_array($value, array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto', 'deposit_percent')) // Fields that are not mandatory
|
||||
&& ($id != 10 || ($value != 'code' && $value != 'note')) // Field code and note is not mandatory for dictionary table 10
|
||||
)
|
||||
) {
|
||||
$ok = 0;
|
||||
$fieldnamekey = $value;
|
||||
// We take translate key of field
|
||||
)
|
||||
) {
|
||||
$ok = 0;
|
||||
$fieldnamekey = $value;
|
||||
// We take translate key of field
|
||||
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) {
|
||||
$fieldnamekey = 'Label';
|
||||
}
|
||||
|
|
@ -828,7 +829,7 @@ if (empty($reshook)) {
|
|||
$fieldnamekey = 'UseByDefault';
|
||||
}
|
||||
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
|
||||
}
|
||||
}
|
||||
// Other special checks
|
||||
|
|
@ -955,7 +956,7 @@ if (empty($reshook)) {
|
|||
if ($id == 10 && GETPOSTINT('country') > 0) {
|
||||
$search_country_id = GETPOSTINT('country');
|
||||
}
|
||||
$_POST = array('id'=>$id);
|
||||
$_POST = array('id' => $id);
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
|
|
@ -1669,7 +1670,7 @@ if ($id > 0) {
|
|||
}
|
||||
|
||||
$tmpaction = 'create';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('createDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
|
@ -2168,7 +2169,7 @@ if ($id > 0) {
|
|||
|
||||
if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
|
@ -2190,7 +2191,7 @@ if ($id > 0) {
|
|||
print '</td>';
|
||||
} else {
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error;
|
||||
|
|
@ -2281,7 +2282,7 @@ if ($id > 0) {
|
|||
$key = $langs->trans("PaymentType".strtoupper($obj->code));
|
||||
$valuetoshow = ($obj->code && $key != "PaymentType".strtoupper($obj->code) ? $key : $obj->$value);
|
||||
} elseif ($value == 'type' && $tabname[$id] == 'c_paiement') {
|
||||
$payment_type_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
$payment_type_list = array(0 => $langs->trans('PaymentTypeCustomer'), 1 => $langs->trans('PaymentTypeSupplier'), 2 => $langs->trans('PaymentTypeBoth'));
|
||||
$valuetoshow = $payment_type_list[$valuetoshow];
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_input_reason') {
|
||||
$key = $langs->trans("DemandReasonType".strtoupper($obj->code));
|
||||
|
|
@ -2378,7 +2379,7 @@ if ($id > 0) {
|
|||
} elseif ($value == 'icon') {
|
||||
$valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value});
|
||||
} elseif ($value == 'type_duration') {
|
||||
$TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes'));
|
||||
$TDurationTypes = array('y' => $langs->trans('Years'), 'm' => $langs->trans('Month'), 'w' => $langs->trans('Weeks'), 'd' => $langs->trans('Days'), 'h' => $langs->trans('Hours'), 'i' => $langs->trans('Minutes'));
|
||||
if (!empty($obj->{$value}) && array_key_exists($obj->{$value}, $TDurationTypes)) {
|
||||
$valuetoshow = $TDurationTypes[$obj->{$value}];
|
||||
}
|
||||
|
|
@ -2634,6 +2635,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
|||
} elseif (in_array($value, array('public', 'use_default'))) {
|
||||
// Fields 0/1 with a combo select Yes/No
|
||||
print '<td class="center">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} : ''), 1);
|
||||
print '</td>';
|
||||
} elseif ($value == 'private') {
|
||||
|
|
@ -2648,7 +2650,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
|||
print '</td>';
|
||||
} elseif ($value == 'type' && $tabname == 'c_paiement') {
|
||||
print '<td>';
|
||||
$select_list = array(0=>$langs->trans('PaymentTypeCustomer'), 1=>$langs->trans('PaymentTypeSupplier'), 2=>$langs->trans('PaymentTypeBoth'));
|
||||
$select_list = array(0 => $langs->trans('PaymentTypeCustomer'), 1 => $langs->trans('PaymentTypeSupplier'), 2 => $langs->trans('PaymentTypeBoth'));
|
||||
print $form->selectarray($value, $select_list, (!empty($obj->{$value}) ? $obj->{$value} : '2'));
|
||||
print '</td>';
|
||||
} elseif ($value == 'recuperableonly' || $value == 'type_cdr' || $value == 'deductible' || $value == 'category_type') {
|
||||
|
|
@ -2658,8 +2660,9 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
|||
print '<td>';
|
||||
}
|
||||
if ($value == 'type_cdr') {
|
||||
print $form->selectarray($value, array(0=>$langs->trans('None'), 1=>$langs->trans('AtEndOfMonth'), 2=>$langs->trans('CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
print $form->selectarray($value, array(0 => $langs->trans('None'), 1 => $langs->trans('AtEndOfMonth'), 2 => $langs->trans('CurrentNext')), (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->selectyesno($value, (!empty($obj->{$value}) ? $obj->{$value} : ''), 1);
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -2709,7 +2712,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
|||
} elseif ($value == 'type_vat') {
|
||||
// VAT type 0: all, 1: sell, 2: purchase
|
||||
print '<td class="center">';
|
||||
print $form->selectarray($value, $type_vatList, (!empty($obj->{$value}) ? $obj->{$value}:''));
|
||||
print $form->selectarray($value, $type_vatList, (!empty($obj->{$value}) ? $obj->{$value} : ''));
|
||||
print '</td>';
|
||||
} elseif ($value == 'localtax1_type' || $value == 'localtax2_type') {
|
||||
// Le type de taxe locale
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langsArray=array("errors", "admin", "mails", "languages");
|
||||
$langsArray = array("errors", "admin", "mails", "languages");
|
||||
|
||||
if (isModEnabled('member')) {
|
||||
$langsArray[]='members';
|
||||
$langsArray[] = 'members';
|
||||
}
|
||||
if (isModEnabled('eventorganization')) {
|
||||
$langsArray[]='eventorganization';
|
||||
$langsArray[] = 'eventorganization';
|
||||
}
|
||||
|
||||
$langs->loadLangs($langsArray);
|
||||
|
|
@ -163,16 +163,16 @@ if (!getDolGlobalString('MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES')) {
|
|||
|
||||
$tabhelp = array();
|
||||
$tabhelp[25] = array(
|
||||
'label'=>$langs->trans('EnterAnyCode'),
|
||||
'type_template'=>$langs->trans("TemplateForElement"),
|
||||
'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"),
|
||||
'position'=>$langs->trans("PositionIntoComboList"),
|
||||
'topic'=>'<span class="small">'.$helpsubstit.'</span>',
|
||||
'email_from'=>$langs->trans('ForceEmailFrom'),
|
||||
'joinfiles'=>$langs->trans('AttachMainDocByDefault'),
|
||||
'defaultfortype'=>$langs->trans("DefaultForTypeDesc"),
|
||||
'content'=>'<span class="small">'.$helpsubstit.'</span>',
|
||||
'content_lines'=>'<span class="small">'.$helpsubstitforlines.'</span>'
|
||||
'label' => $langs->trans('EnterAnyCode'),
|
||||
'type_template' => $langs->trans("TemplateForElement"),
|
||||
'private' => $langs->trans("TemplateIsVisibleByOwnerOnly"),
|
||||
'position' => $langs->trans("PositionIntoComboList"),
|
||||
'topic' => '<span class="small">'.$helpsubstit.'</span>',
|
||||
'email_from' => $langs->trans('ForceEmailFrom'),
|
||||
'joinfiles' => $langs->trans('AttachMainDocByDefault'),
|
||||
'defaultfortype' => $langs->trans("DefaultForTypeDesc"),
|
||||
'content' => '<span class="small">'.$helpsubstit.'</span>',
|
||||
'content_lines' => '<span class="small">'.$helpsubstitforlines.'</span>'
|
||||
);
|
||||
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ if (isModEnabled('partnership') && $user->hasRight('partnership', 'read')) {
|
|||
$elementList['partnership_send'] = img_picto('', 'partnership', 'class="pictofixedwidth"').dol_escape_htmltag($langs->trans('MailToPartnership'));
|
||||
}
|
||||
|
||||
$parameters = array('elementList'=>$elementList);
|
||||
$parameters = array('elementList' => $elementList);
|
||||
$reshook = $hookmanager->executeHooks('emailElementlist', $parameters); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook == 0) {
|
||||
foreach ($hookmanager->resArray as $item => $value) {
|
||||
|
|
@ -418,7 +418,7 @@ if (empty($reshook)) {
|
|||
$result = $db->query($sql);
|
||||
if ($result) { // Add is ok
|
||||
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
|
||||
$_POST = array('id'=>$id); // Clean $_POST array, we keep only id
|
||||
$_POST = array('id' => $id); // Clean $_POST array, we keep only id
|
||||
} else {
|
||||
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
|
||||
|
|
@ -1040,7 +1040,7 @@ foreach ($fieldlist as $field => $value) {
|
|||
}
|
||||
$sortfieldtouse = ($sortable ? $fieldlist[$field] : '');
|
||||
if ($sortfieldtouse == 'type_template') {
|
||||
$sortfieldtouse.= 'type_template,lang,position,label';
|
||||
$sortfieldtouse .= 'type_template,lang,position,label';
|
||||
}
|
||||
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], $sortfieldtouse, ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, $css.' ');
|
||||
}
|
||||
|
|
@ -1065,7 +1065,7 @@ if ($num) {
|
|||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
$tmpaction = 'edit';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
$error = $hookmanager->error;
|
||||
$errors = $hookmanager->errors;
|
||||
|
|
@ -1176,7 +1176,7 @@ if ($num) {
|
|||
continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
|
||||
}
|
||||
// Test on 'enabled'
|
||||
if (!dol_eval($obj->enabled, 1, 1, '1')) {
|
||||
if (! (int) dol_eval($obj->enabled, 1, 1, '1')) {
|
||||
$i++;
|
||||
continue; // Email template not qualified
|
||||
}
|
||||
|
|
@ -1216,7 +1216,7 @@ if ($num) {
|
|||
}
|
||||
|
||||
$tmpaction = 'view';
|
||||
$parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
||||
$parameters = array('fieldlist' => $fieldlist, 'tabname' => $tabname[$id]);
|
||||
$reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
$error = $hookmanager->error;
|
||||
|
|
@ -1461,8 +1461,10 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '')
|
|||
print '<td'.($classtd ? ' class="'.$classtd.'"' : '').'>';
|
||||
if ($value == 'private' && $context != 'preview') {
|
||||
if (empty($user->admin)) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->selectyesno($value, '1', 1);
|
||||
} else {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ if ($action == 'create') {
|
|||
print '<tr><td>'.$langs->trans('Enabled').'</td>';
|
||||
print '<td><input type="text" class="minwidth500" name="enabled" value="'.dol_escape_htmltag($menu->enabled).'"></td><td>'.$langs->trans('DetailEnabled');
|
||||
if (!empty($menu->enabled)) {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn(dol_eval($menu->enabled, 1, 1, '1')).')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->enabled, 1, 1, '1') <= 0 ? 0 : 1).')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -513,7 +513,7 @@ if ($action == 'create') {
|
|||
print '<tr><td>'.$langs->trans('Rights').'</td>';
|
||||
print '<td><input type="text" class="minwidth500" name="perms" value="'.dol_escape_htmltag($menu->perms).'"></td><td>'.$langs->trans('DetailRight');
|
||||
if (!empty($menu->perms)) {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn(dol_eval($menu->perms, 1, 1, '1')).')';
|
||||
print ' <span class="opacitymedium">('.$langs->trans("ConditionIsCurrently").':</span> '.yn((int) dol_eval($menu->perms, 1, 1, '1') <= 0 ? 0 : 1).')';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ if ($result) {
|
|||
if ($user->admin) {
|
||||
print '<td class="right">';
|
||||
$htmltext = $langs->trans("ID").': '.$obj->id;
|
||||
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.$obj->module.'\', \''.$obj->perms.'\''.($obj->subperms ? ', \''.$obj->subperms.'\'' : '').')';
|
||||
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
||||
print $form->textwithpicto('', $htmltext);
|
||||
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ if (!count($listofvars) && !count($listofstatus)) {
|
|||
$arraytest = array();
|
||||
if (preg_match('/mysql/i', $db->type)) {
|
||||
$arraytest = array(
|
||||
'character_set_database'=>array('var'=>'dolibarr_main_db_character_set', 'valifempty'=>'utf8'),
|
||||
'collation_database'=>array('var'=>'dolibarr_main_db_collation', 'valifempty'=>'utf8_unicode_ci')
|
||||
'character_set_database' => array('var' => 'dolibarr_main_db_character_set', 'valifempty' => 'utf8'),
|
||||
'collation_database' => array('var' => 'dolibarr_main_db_collation', 'valifempty' => 'utf8_unicode_ci')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -123,9 +123,11 @@ if (!count($listofvars) && !count($listofstatus)) {
|
|||
print $paramval;
|
||||
}
|
||||
if ($show == 1) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($paramval, $text);
|
||||
}
|
||||
if ($show == 2) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($paramval, $text, 1, 'warning');
|
||||
}
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ $object = new stdClass();
|
|||
|
||||
// Definition of fields for lists
|
||||
$arrayfields = array(
|
||||
'name'=>array('label'=>$langs->trans("Modules"), 'checked'=>1, 'position'=>10),
|
||||
'version'=>array('label'=>$langs->trans("Version"), 'checked'=>1, 'position'=>20),
|
||||
'id'=>array('label'=>$langs->trans("IdModule"), 'checked'=>1, 'position'=>30),
|
||||
'module_position'=>array('label'=>$langs->trans("Position"), 'checked'=>1, 'position'=>35),
|
||||
'permission'=>array('label'=>$langs->trans("IdPermissions"), 'checked'=>1, 'position'=>40)
|
||||
'name' => array('label' => $langs->trans("Modules"), 'checked' => 1, 'position' => 10),
|
||||
'version' => array('label' => $langs->trans("Version"), 'checked' => 1, 'position' => 20),
|
||||
'id' => array('label' => $langs->trans("IdModule"), 'checked' => 1, 'position' => 30),
|
||||
'module_position' => array('label' => $langs->trans("Position"), 'checked' => 1, 'position' => 35),
|
||||
'permission' => array('label' => $langs->trans("IdPermissions"), 'checked' => 1, 'position' => 40)
|
||||
);
|
||||
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
|
@ -143,6 +143,7 @@ foreach ($modules as $key => $module) {
|
|||
|
||||
if (!empty($module->picto)) {
|
||||
if (preg_match('/^\//', $module->picto)) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$newModule->picto = img_picto($alt, $module->picto, 'width="14px"', 1);
|
||||
} else {
|
||||
$newModule->picto = img_object($alt, $module->picto, 'width="14px"');
|
||||
|
|
@ -157,7 +158,7 @@ foreach ($modules as $key => $module) {
|
|||
if (empty($rights[0])) {
|
||||
continue;
|
||||
}
|
||||
$arrayofpermissions[$rights[0]] = array('label'=> 'user->hasRight(\''.$module->rights_class.'\', \''.$rights[4].'\''.(empty($rights[5]) ? '' : ', \''.$rights[5].'\'').')');
|
||||
$arrayofpermissions[$rights[0]] = array('label' => 'user->hasRight(\''.$module->rights_class.'\', \''.$rights[4].'\''.(empty($rights[5]) ? '' : ', \''.$rights[5].'\'').')');
|
||||
$permission[] = $rights[0];
|
||||
|
||||
array_push($rights_ids, $rights[0]);
|
||||
|
|
@ -296,7 +297,7 @@ if ($arrayfields['module_position']['checked']) {
|
|||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
|
|
@ -408,13 +409,13 @@ llxFooter();
|
|||
$db->close();
|
||||
|
||||
|
||||
/**
|
||||
* Compare two modules by their ID for a ascending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
/**
|
||||
* Compare two modules by their ID for a ascending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
function compareIdAsc(stdClass $a, stdClass $b)
|
||||
{
|
||||
if ((int) $a->id == (int) $b->id) {
|
||||
|
|
@ -424,13 +425,13 @@ function compareIdAsc(stdClass $a, stdClass $b)
|
|||
return ((int) $a->id < (int) $b->id) ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two modules by their ID for a descending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
/**
|
||||
* Compare two modules by their ID for a descending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
function compareIdDesc(stdClass $a, stdClass $b)
|
||||
{
|
||||
if ((int) $a->id == (int) $b->id) {
|
||||
|
|
@ -440,13 +441,13 @@ function compareIdDesc(stdClass $a, stdClass $b)
|
|||
return ((int) $b->id < (int) $a->id) ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two modules by their ID for a ascending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
/**
|
||||
* Compare two modules by their ID for a ascending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
function comparePermissionIdsAsc(stdClass $a, stdClass $b)
|
||||
{
|
||||
if (empty($a->permission) && empty($b->permission)) {
|
||||
|
|
@ -467,13 +468,13 @@ function comparePermissionIdsAsc(stdClass $a, stdClass $b)
|
|||
return $a->permission[0] < $b->permission[0] ? -1 : 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two modules by their permissions for a descending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
/**
|
||||
* Compare two modules by their permissions for a descending order
|
||||
*
|
||||
* @param stdClass $a First module
|
||||
* @param stdClass $b Second module
|
||||
* @return int Compare result (-1, 0, 1)
|
||||
*/
|
||||
function comparePermissionIdsDesc(stdClass $a, stdClass $b)
|
||||
{
|
||||
if (empty($a->permission) && empty($b->permission)) {
|
||||
|
|
|
|||
|
|
@ -272,7 +272,7 @@ print '<br>';
|
|||
if (file_exists($installlock)) { // If install not locked, no need to show this.
|
||||
if (file_exists($upgradeunlock)) {
|
||||
print '<strong>'.$langs->trans("DolibarrUpgrade").'</strong>: ';
|
||||
print img_warning().' '.$langs->trans("UpgradeHasBeenUnlocked", $upgradeunlock);
|
||||
print img_warning().' '.$langs->trans("WarningUpgradeHasBeenUnlocked", $upgradeunlock);
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
|
@ -753,10 +753,10 @@ print '<strong>WEBSITE_MAIN_SECURITY_FORCECSP</strong> = '.getDolGlobalString('W
|
|||
print ' <span class="opacitymedium">('.$langs->trans("Example").": \"frame-ancestors 'self'; default-src 'self' 'unsafe-inline'; style-src https://cdnjs.cloudflare.com *.googleapis.com; script-src *.transifex.com *.google-analytics.com *.googletagmanager.com; object-src https://youtube.com; frame-src https://youtube.com; img-src * data:;\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined").' '.$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCERP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCERP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Recommended").': '.$langs->trans("Undefined")."=\"strict-origin\" ".$langs->trans("or")." \"strict-origin-when-cross-origin\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('>WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCESTS</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCESTS', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"max-age=31536000; includeSubDomains\")</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>WEBSITE_MAIN_SECURITY_FORCEPP</strong> = '.getDolGlobalString('WEBSITE_MAIN_SECURITY_FORCEPP', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>').' <span class="opacitymedium">('.$langs->trans("Example").": \"camera: (); microphone: ();\")</span><br>";
|
||||
|
|
|
|||
|
|
@ -617,6 +617,7 @@ if ($mode == 'searchkey') {
|
|||
print '<a class="marginleftonly marginrightonly" href="'.$_SERVER['PHP_SELF'].'?rowid='.$obj->rowid.'&entity='.$conf->entity.'&mode='.urlencode($mode).'&action=delete&token='.newToken().'&mode='.urlencode($mode).'">'.img_delete().'</a>';
|
||||
print ' ';
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$htmltext = $langs->trans("TransKeyWithoutOriginalValue", $key);
|
||||
print $form->textwithpicto('', $htmltext, 1, 'warning');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@ print "<br>\n";
|
|||
|
||||
$interfaces = new Interfaces($db);
|
||||
$triggers = $interfaces->getTriggersList();
|
||||
$param = ''; $align = '';
|
||||
$param = '';
|
||||
$align = '';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder">';
|
||||
|
|
@ -78,6 +79,7 @@ foreach ($triggers as $trigger) {
|
|||
$text = $trigger['info'];
|
||||
$text .= "<br>\n<strong>".$langs->trans("File")."</strong>:<br>\n".$trigger['relpath'];
|
||||
//$text.="\n".$langs->trans("ExternalModule",$trigger['isocreorexternal']);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto('', $text);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ class AssetDepreciationOptions extends CommonObject
|
|||
if ($field_info['notnull'] > 0 && $field_value == '' && !is_null($field_info['default']) && $field_info['default'] == '(PROV)') {
|
||||
$field_value = '(PROV)';
|
||||
} elseif ((!empty($field_info['required']) || $field_info['notnull'] > 0) && $field_value == '' && !empty($field_info['default'])) {
|
||||
$field_value = dol_eval($field_info['default'], 1);
|
||||
$field_value = $field_info['default'];
|
||||
}
|
||||
if ($field_info['notnull'] > 0 && $field_value == '' && is_null($field_info['default'])) {
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
$value = GETPOSTISSET($html_name) ? GETPOST($html_name, $check) : $assetdepreciationoptions->$field_key;
|
||||
} elseif ($field_info['type'] == 'price') {
|
||||
$value = GETPOSTISSET($html_name) ? price2num(GETPOST($html_name)) : ($assetdepreciationoptions->$field_key ? price2num($assetdepreciationoptions->$field_key) : (!empty($field_info['default']) ? dol_eval($field_info['default'], 1) : 0));
|
||||
$value = GETPOSTISSET($html_name) ? price2num(GETPOST($html_name)) : ($assetdepreciationoptions->$field_key ? price2num($assetdepreciationoptions->$field_key) : (!empty($field_info['default']) ? $field_info['default'] : 0));
|
||||
} elseif ($field_key == 'lang') {
|
||||
$value = GETPOSTISSET($html_name) ? GETPOST($html_name, 'aZ09') : $assetdepreciationoptions->lang;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file bookcal/lib/bookcal.lib.php
|
||||
* \file htdocs/bookcal/lib/bookcal.lib.php
|
||||
* \ingroup bookcal
|
||||
* \brief Library files with common functions for BookCal
|
||||
*/
|
||||
|
|
@ -35,13 +36,13 @@ function bookcalAdminPrepareHead()
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/bookcal/admin/setup.php", 1);
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/admin/setup.php';
|
||||
$head[$h][1] = $langs->trans("Settings");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/bookcal/admin/myobject_extrafields.php", 1);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/bookcal/admin/myobject_extrafields.php';
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$head[$h][2] = 'myobject_extrafields';
|
||||
$h++;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2022 Alice Adminson <aadminson@example.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -41,13 +42,13 @@ function availabilitiesPrepareHead($object)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/bookcal/availabilities_card.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if ($showtabofpagecontact) {
|
||||
$head[$h][0] = dol_buildpath("/bookcal/availabilities_contact.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_contact.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Contacts");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
|
@ -62,10 +63,10 @@ function availabilitiesPrepareHead($object)
|
|||
if (!empty($object->note_public)) {
|
||||
$nbNote++;
|
||||
}
|
||||
$head[$h][0] = dol_buildpath('/bookcal/availabilities_note.php', 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_note.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
$head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : '');
|
||||
}
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
|
@ -73,22 +74,22 @@ function availabilitiesPrepareHead($object)
|
|||
}
|
||||
|
||||
if ($showtabofpagedocument) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->bookcal->dir_output."/availabilities/".dol_sanitizeFileName($object->ref);
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$upload_dir = $conf->bookcal->dir_output . "/availabilities/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = dol_buildpath("/bookcal/availabilities_document.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_document.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($showtabofpageagenda) {
|
||||
$head[$h][0] = dol_buildpath("/bookcal/availabilities_agenda.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/availabilities_agenda.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Events");
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) 2023 Alice Adminson <aadminson@example.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -41,13 +42,13 @@ function calendarPrepareHead($object)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/bookcal/calendar_card.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_card.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Calendar");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if ($object->status == Calendar::STATUS_VALIDATED) {
|
||||
$head[$h][0] = dol_buildpath("/bookcal/booking_list.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/booking_list.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Bookings");
|
||||
$head[$h][2] = 'booking';
|
||||
$h++;
|
||||
|
|
@ -55,7 +56,7 @@ function calendarPrepareHead($object)
|
|||
|
||||
|
||||
if ($showtabofpagecontact) {
|
||||
$head[$h][0] = dol_buildpath("/bookcal/calendar_contact.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_contact.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Contacts");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
|
@ -70,10 +71,10 @@ function calendarPrepareHead($object)
|
|||
if (!empty($object->note_public)) {
|
||||
$nbNote++;
|
||||
}
|
||||
$head[$h][0] = dol_buildpath('/bookcal/calendar_note.php', 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_note.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans('Notes');
|
||||
if ($nbNote > 0) {
|
||||
$head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
|
||||
$head[$h][1] .= (!getDolGlobalInt('MAIN_OPTIMIZEFORTEXTBROWSER') ? '<span class="badge marginleftonlyshort">' . $nbNote . '</span>' : '');
|
||||
}
|
||||
$head[$h][2] = 'note';
|
||||
$h++;
|
||||
|
|
@ -81,22 +82,22 @@ function calendarPrepareHead($object)
|
|||
}
|
||||
|
||||
if ($showtabofpagedocument) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->bookcal->dir_output."/calendar/".dol_sanitizeFileName($object->ref);
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$upload_dir = $conf->bookcal->dir_output . "/calendar/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = dol_buildpath("/bookcal/calendar_document.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_document.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
}
|
||||
|
||||
if ($showtabofpageagenda) {
|
||||
$head[$h][0] = dol_buildpath("/bookcal/calendar_agenda.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/bookcal/calendar_agenda.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("Events");
|
||||
$head[$h][2] = 'agenda';
|
||||
$h++;
|
||||
|
|
|
|||
|
|
@ -1051,7 +1051,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes
|
|||
|
||||
if ($user->hasRight('agenda', 'myactions', 'delete')
|
||||
|| $user->hasRight('agenda', 'allactions', 'delete')) {
|
||||
$result = $object->delete();
|
||||
$result = $object->delete($user);
|
||||
|
||||
if ($result >= 0) {
|
||||
header("Location: index.php");
|
||||
|
|
|
|||
|
|
@ -1022,15 +1022,13 @@ class ActionComm extends CommonObject
|
|||
|
||||
/**
|
||||
* Delete event from database
|
||||
* @TODO Add User $user as first param
|
||||
*
|
||||
* @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
|
||||
*/
|
||||
public function delete($notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class ICal
|
|||
$this->cal = array(); // new empty array
|
||||
|
||||
$this->event_count = -1;
|
||||
$this->file_text = null;
|
||||
$this->file_text = '';
|
||||
|
||||
// Save file into a cache
|
||||
if ($usecachefile) {
|
||||
|
|
@ -168,10 +168,10 @@ class ICal
|
|||
}
|
||||
}
|
||||
|
||||
$this->file_text = preg_split("[\n]", $this->file_text);
|
||||
$file_text_array = preg_split("[\n]", $this->file_text);
|
||||
|
||||
// is this text vcalendar standard text ? on line 1 is BEGIN:VCALENDAR
|
||||
if (!stristr($this->file_text[0], 'BEGIN:VCALENDAR')) {
|
||||
if (!stristr($file_text_array[0], 'BEGIN:VCALENDAR')) {
|
||||
return 'error not VCALENDAR';
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ class ICal
|
|||
$tmpkey = '';
|
||||
$tmpvalue = '';
|
||||
$type = '';
|
||||
foreach ($this->file_text as $text) {
|
||||
foreach ($file_text_array as $text) {
|
||||
$text = trim($text); // trim one line
|
||||
if (!empty($text)) {
|
||||
// get Key and Value VCALENDAR:Begin -> Key = VCALENDAR, Value = begin
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ if (!getDolGlobalString('AGENDA_DISABLE_EXT')) {
|
|||
'name' => dol_string_nohtmltag(getDolGlobalString($name)),
|
||||
'offsettz' => (int) getDolGlobalInt($offsettz, 0),
|
||||
'color' => dol_string_nohtmltag(getDolGlobalString($color)),
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
'default' => dol_string_nohtmltag(getDolGlobalString($default)),
|
||||
'buggedfile' => dol_string_nohtmltag(getDolGlobalString('buggedfile', ''))
|
||||
);
|
||||
|
|
@ -301,6 +302,7 @@ if (empty($user->conf->AGENDA_DISABLE_EXT)) {
|
|||
'src' => getDolUserString($source),
|
||||
'name' => dol_string_nohtmltag(getDolUserString($name)),
|
||||
'offsettz' => (int) (empty($user->conf->$offsettz) ? 0 : $user->conf->$offsettz),
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
'color' => dol_string_nohtmltag(getDolUserString($color)),
|
||||
'default' => dol_string_nohtmltag(getDolUserString($default)),
|
||||
'buggedfile' => dol_string_nohtmltag(isset($user->conf->buggedfile) ? $user->conf->buggedfile : '')
|
||||
|
|
@ -1562,6 +1564,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
$style .= ' cal_other_month_right';
|
||||
}
|
||||
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $max_day_in_prev_month + $tmpday, $prev_month, $prev_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||
echo " </td>\n";
|
||||
} elseif ($tmpday <= $max_day_in_month) {
|
||||
|
|
@ -1583,6 +1586,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
}
|
||||
//var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
|
||||
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam, 0, 60, 0, $bookcalcalendars);
|
||||
echo "</td>\n";
|
||||
} else {
|
||||
|
|
@ -1592,6 +1596,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
$style .= ' cal_other_month_right';
|
||||
}
|
||||
echo ' <td class="'.$style.' nowrap tdtop" width="14%">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $tmpday - $max_day_in_month, $next_month, $next_year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
|
||||
echo "</td>\n";
|
||||
}
|
||||
|
|
@ -1656,6 +1661,7 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
}
|
||||
|
||||
echo ' <td class="'.$style.'" width="14%" valign="top">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $tmpday, $tmpmonth, $tmpyear, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
|
||||
echo " </td>\n";
|
||||
}
|
||||
|
|
@ -1746,12 +1752,14 @@ if (empty($mode) || $mode == 'show_month') { // View by month
|
|||
|
||||
echo '</div></div>';
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1, $bookcalcalendars);
|
||||
|
||||
print '</div>';
|
||||
} else {
|
||||
print '<div class="div-table-responsive-no-min borderbottom">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0, $bookcalcalendars);
|
||||
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
|
|
|
|||
|
|
@ -448,6 +448,7 @@ if ($object->fetch($id) >= 0) {
|
|||
$nbemail = ($object->nbemail ? $object->nbemail : '0');
|
||||
if (getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) {
|
||||
$text = $langs->trans('LimitSendingEmailing', getDolGlobalString('MAILING_LIMIT_SENDBYWEB'));
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($nbemail, $text, 1, 'warning');
|
||||
} else {
|
||||
print $nbemail;
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ if ($object->fetch($id) >= 0) {
|
|||
$obj = new $classname($db);
|
||||
|
||||
// Check if qualified
|
||||
$qualified = (is_null($obj->enabled) ? 1 : dol_eval($obj->enabled, 1));
|
||||
$qualified = (is_null($obj->enabled) ? 1 : (int) dol_eval($obj->enabled, 1));
|
||||
|
||||
// Check dependencies
|
||||
foreach ($obj->require_module as $key) {
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ $mode = GETPOST('mode', 'alpha');
|
|||
// Search Fields
|
||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||
$search_user = GETPOSTINT('search_user');
|
||||
if ($search_user==-1) $search_user=0;
|
||||
$search_sale = GETPOSTINT('search_sale');
|
||||
$search_ref = GETPOST('sf_ref') ? GETPOST('sf_ref', 'alpha') : GETPOST('search_ref', 'alpha');
|
||||
$search_refcustomer = GETPOST('search_refcustomer', 'alpha');
|
||||
|
|
@ -268,7 +269,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
@ -587,7 +588,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
|
||||
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
|
||||
$sql .= ' INNER JOIN '.MAIN_DB_PREFIX.'propal as p ON p.fk_soc = s.rowid';
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
}
|
||||
|
|
@ -598,8 +599,10 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as pr ON pr.rowid = p.fk_projet";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_availability as ava on (ava.rowid = p.fk_availability)";
|
||||
if ($search_user > 0) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."element_contact as c";
|
||||
$sql .= " ON c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
$sql .= " ON c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal'";
|
||||
}
|
||||
|
||||
// Add table from hooks
|
||||
|
|
@ -607,8 +610,8 @@ $parameters = array();
|
|||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
|
||||
$sql .= ' WHERE p.fk_soc = s.rowid';
|
||||
$sql .= ' AND p.entity IN ('.getEntity('propal').')';
|
||||
$sql .= ' WHERE';
|
||||
$sql .= ' p.entity IN ('.getEntity('propal').')';
|
||||
if ($search_town) {
|
||||
$sql .= natural_search('s.town', $search_town);
|
||||
}
|
||||
|
|
@ -718,9 +721,6 @@ if ($search_date_delivery_start) {
|
|||
if ($search_date_delivery_end) {
|
||||
$sql .= " AND p.date_livraison <= '".$db->idate($search_date_delivery_end)."'";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".((int) $search_user);
|
||||
}
|
||||
if ($search_date_signature_start) {
|
||||
$sql .= " AND p.date_signature >= '".$db->idate($search_date_signature_start)."'";
|
||||
}
|
||||
|
|
@ -1147,7 +1147,7 @@ if ($search_date_signature_endyear) {
|
|||
if ($user->hasRight('user', 'user', 'lire')) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers((empty($search_user)?-2:0), 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view products
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1009,7 +1009,7 @@ if (empty($reshook)) {
|
|||
$paiement = new Paiement($db);
|
||||
$result = $paiement->fetch(GETPOSTINT('paiement_id'));
|
||||
if ($result > 0) {
|
||||
$result = $paiement->delete(); // If fetch ok and found
|
||||
$result = $paiement->delete($user); // If fetch ok and found
|
||||
if ($result >= 0) {
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?id=".$id);
|
||||
exit;
|
||||
|
|
@ -2093,7 +2093,7 @@ if (empty($reshook)) {
|
|||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef = '';
|
||||
$product_desc =(GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
$product_desc = (GETPOSTISSET('dp_desc') ? GETPOST('dp_desc', 'restricthtml') : '');
|
||||
|
||||
$price_ht = '';
|
||||
$price_ht_devise = '';
|
||||
|
|
@ -2292,8 +2292,8 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
//If text set in desc is the same as product descpription (as now it's preloaded) we add it only one time
|
||||
if ($product_desc==$desc && getDolGlobalString('PRODUIT_AUTOFILL_DESC')) {
|
||||
$product_desc='';
|
||||
if ($product_desc == $desc && getDolGlobalString('PRODUIT_AUTOFILL_DESC')) {
|
||||
$product_desc = '';
|
||||
}
|
||||
|
||||
if (!empty($product_desc) && getDolGlobalString('MAIN_NO_CONCAT_DESCRIPTION')) {
|
||||
|
|
@ -2347,10 +2347,16 @@ if (empty($reshook)) {
|
|||
$type = $prod->type;
|
||||
$fk_unit = $prod->fk_unit;
|
||||
} else {
|
||||
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 = '';
|
||||
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)) {
|
||||
|
|
@ -2822,7 +2828,7 @@ if (empty($reshook)) {
|
|||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
&& $usercanunvalidate
|
||||
) {
|
||||
) {
|
||||
$outingError = 0;
|
||||
$newCycle = $object->newCycle(); // we need to keep the "situation behavior" so we place it on a new situation cycle
|
||||
if ($newCycle > 1) {
|
||||
|
|
@ -2836,7 +2842,7 @@ if (empty($reshook)) {
|
|||
if ($next_invoice->type == Facture::TYPE_CREDIT_NOTE
|
||||
&& $next_invoice->situation_counter == $object->situation_counter
|
||||
&& $next_invoice->fk_facture_source == $object->id
|
||||
) {
|
||||
) {
|
||||
$linkedCreditNotesList[] = $next_invoice->id;
|
||||
}
|
||||
}
|
||||
|
|
@ -3942,7 +3948,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => !empty($objectsrc) ? $objectsrc : 0, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid);
|
||||
$parameters = array('objectsrc' => !empty($objectsrc) ? $objectsrc : 0, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid' => $socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (empty($reshook)) {
|
||||
|
|
@ -4276,7 +4282,7 @@ if ($action == 'create') {
|
|||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
&& $usercanunvalidate
|
||||
) {
|
||||
) {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $label, $text, 'confirm_situationout', $formquestion, "yes", 1);
|
||||
}
|
||||
}
|
||||
|
|
@ -5444,6 +5450,7 @@ if ($action == 'create') {
|
|||
$text .= '<br><br><b>'.$langs->trans("Reason").'</b>:'.$object->close_note;
|
||||
}
|
||||
print '<span class="opacitymedium">';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print $form->textwithpicto($langs->trans("Abandoned"), $text, - 1);
|
||||
print '</span>';
|
||||
print '</td><td class="right"><span class="amount">'.price(price2num($object->total_ttc - $creditnoteamount - $depositamount - $totalpaid, 'MT')).'</span></td><td> </td></tr>';
|
||||
|
|
@ -5479,7 +5486,7 @@ if ($action == 'create') {
|
|||
print '</td>';
|
||||
print '<td class="right'.($resteapayeraffiche ? ' amountremaintopay' : (' '.$cssforamountpaymentcomplete)).'">';
|
||||
//print (empty($object->multicurrency_code) ? $conf->currency : $object->multicurrency_code).' ';
|
||||
print price(price2num($object->multicurrency_tx*$resteapayeraffiche, 'MT'), 1, $langs, 1, -1, -1, (empty($object->multicurrency_code) ? $conf->currency : $object->multicurrency_code)).'</td><td> </td></tr>';
|
||||
print price(price2num($object->multicurrency_tx * $resteapayeraffiche, 'MT'), 1, $langs, 1, -1, -1, (empty($object->multicurrency_code) ? $conf->currency : $object->multicurrency_code)).'</td><td> </td></tr>';
|
||||
}
|
||||
|
||||
// Retained warranty : usually use on construction industry
|
||||
|
|
@ -5827,7 +5834,7 @@ if ($action == 'create') {
|
|||
// For credit note
|
||||
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->status == Facture::STATUS_VALIDATED && $object->paye == 0 && $usercancreate
|
||||
&& (getDolGlobalString('INVOICE_ALLOW_REUSE_OF_CREDIT_WHEN_PARTIALLY_REFUNDED') || $sumofpayment == 0) && $object->total_ht < 0
|
||||
) {
|
||||
) {
|
||||
print '<a class="butAction classfortooltip'.($conf->use_javascript_ajax ? ' reposition' : '').'" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&action=converttoreduc" title="'.dol_escape_htmltag($langs->trans("ConfirmConvertToReduc2")).'">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
// For down payment invoice (deposit)
|
||||
|
|
@ -5890,7 +5897,7 @@ if ($action == 'create') {
|
|||
&& !$objectidnext
|
||||
&& $object->is_last_in_cycle()
|
||||
&& getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE')
|
||||
) {
|
||||
) {
|
||||
if ($usercanunvalidate) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&fac_avoir='.$object->id.'&invoiceAvoirWithLines=1&action=create&type=2'.($object->fk_project > 0 ? '&projectid='.$object->fk_project : '').'">'.$langs->trans("CreateCreditNote").'</a>';
|
||||
} else {
|
||||
|
|
@ -5920,7 +5927,7 @@ if ($action == 'create') {
|
|||
&& $object->situation_counter > 1
|
||||
&& $object->is_last_in_cycle()
|
||||
&& $usercanunvalidate
|
||||
) {
|
||||
) {
|
||||
if (($object->total_ttc - $totalcreditnotes) == 0) {
|
||||
print '<a id="butSituationOut" class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=situationout">'.$langs->trans("RemoveSituationFromCycle").'</a>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields[$newkey] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1, 1, '1')),
|
||||
'position'=>$val['position'],
|
||||
'help' => empty($val['help']) ? '' : $val['help'],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -613,6 +613,7 @@ if ($object->id > 0) {
|
|||
print '<tr><td>'.$langs->trans($title).'</td><td colspan="3">';
|
||||
|
||||
$bac = new CompanyBankAccount($db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$bac->fetch(0, $object->thirdparty->id);
|
||||
|
||||
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ if (empty($reshook)) {
|
|||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('facture', 'paiement')) {
|
||||
$db->begin();
|
||||
|
||||
$result = $object->delete();
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
$db->commit();
|
||||
|
||||
|
|
|
|||
|
|
@ -594,15 +594,13 @@ class Paiement extends CommonObject
|
|||
* Delete a payment and generated links into account
|
||||
* - Si le paiement porte sur un ecriture compte qui est rapprochee, on refuse
|
||||
* - Si le paiement porte sur au moins une facture a "payee", on refuse
|
||||
* @TODO Add first param User $user
|
||||
*
|
||||
* @param User $user User making the deletion
|
||||
* @param int $notrigger No trigger
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $user;
|
||||
|
||||
$error = 0;
|
||||
|
||||
$bank_line_id = $this->bank_line;
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ if ($sourcetype != 'salary') {
|
|||
$pricetowithdraw = $bprev->SommeAPrelever($type, 'salary');
|
||||
}
|
||||
if ($nb < 0) {
|
||||
dol_print_error($bprev->error);
|
||||
dol_print_error($db, $bprev->error);
|
||||
}
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
|
|
@ -479,7 +479,7 @@ if ($resql) {
|
|||
}
|
||||
$title = $langs->trans("InvoiceWaitingWithdraw");
|
||||
$picto = 'bill';
|
||||
if ($type =='bank-transfer') {
|
||||
if ($type == 'bank-transfer') {
|
||||
if ($sourcetype != 'salary') {
|
||||
$title = $langs->trans("InvoiceWaitingPaymentByBankTransfer");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -351,10 +351,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
} else {
|
||||
//var_dump($result);
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1, 1, '1');
|
||||
if (is_nan($r)) {
|
||||
$r = 0;
|
||||
}
|
||||
$r = (float) dol_eval($result, 1, 1, '1');
|
||||
|
||||
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
|
||||
}
|
||||
|
|
@ -378,10 +375,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
$result = str_replace('--', '+', $result);
|
||||
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1, 1, '1');
|
||||
if (is_nan($r)) {
|
||||
$r = 0;
|
||||
}
|
||||
$r = (float) dol_eval($result, 1, 1, '1');
|
||||
|
||||
print '<td class="liste_total right borderright"><span class="amount">'.price($r).'</span></td>';
|
||||
if (empty($sommes[$code]['N'])) {
|
||||
|
|
@ -400,10 +394,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
$result = str_replace('--', '+', $result);
|
||||
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1, 1, '1');
|
||||
if (is_nan($r)) {
|
||||
$r = 0;
|
||||
}
|
||||
$r = (float) dol_eval($result, 1, 1, '1');
|
||||
|
||||
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
|
||||
if (empty($sommes[$code]['M'][$k])) {
|
||||
|
|
@ -423,10 +414,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
$result = str_replace('--', '+', $result);
|
||||
|
||||
//$r = $AccCat->calculate($result);
|
||||
$r = dol_eval($result, 1, 1, '1');
|
||||
if (is_nan($r)) {
|
||||
$r = 0;
|
||||
}
|
||||
$r = (float) dol_eval($result, 1, 1, '1');
|
||||
|
||||
print '<td class="liste_total right"><span class="amount">'.price($r).'</span></td>';
|
||||
if (empty($sommes[$code]['M'][$k])) {
|
||||
|
|
|
|||
|
|
@ -146,6 +146,7 @@ if ($resql) {
|
|||
setEventMessages($db->lasterror, null, 'errors');
|
||||
}
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $num, 'title_accountancy', 0, '', '', $limit);
|
||||
|
||||
if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['p.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1084,13 +1084,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
|||
|
||||
if ($objecttmp->element == 'societe') {
|
||||
/** @var Societe $objecttmp */
|
||||
// TODO Change signature of delete for Societe
|
||||
$result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
} elseif ($objecttmp->element == 'member') {
|
||||
/** @var Adherent $objecttmp */
|
||||
$result = $objecttmp->delete($objecttmp->id, $user, 0);
|
||||
} elseif ($objecttmp->element == 'action') {
|
||||
/** @var ActionComm $objecttmp */
|
||||
$result = $objecttmp->delete(); // TODO Add User $user as first param
|
||||
} else {
|
||||
$result = $objecttmp->delete($user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
|||
while ($i < $num) {
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
if (dol_eval($objp->test, 1, 1, '2')) {
|
||||
if ((int) dol_eval($objp->test, 1, 1, '2')) {
|
||||
$nextrun = $this->db->jdate($objp->datenextrun);
|
||||
if (empty($nextrun)) {
|
||||
$nextrun = $this->db->jdate($objp->datestart);
|
||||
|
|
|
|||
|
|
@ -477,13 +477,13 @@ abstract class CommonObject
|
|||
public $fk_multicurrency;
|
||||
|
||||
/**
|
||||
* @var string|array<int,string> Multicurrency code
|
||||
* @var string|string[] Multicurrency code
|
||||
* Or, just for the Paiement object, an array: invoice ID => currency code for that invoice.
|
||||
*/
|
||||
public $multicurrency_code;
|
||||
|
||||
/**
|
||||
* @var float|array<int,float> Multicurrency rate ("tx" = "taux" in French)
|
||||
* @var float|float[] Multicurrency rate ("tx" = "taux" in French)
|
||||
* Or, just for the Paiement object, an array: invoice ID => currency rate for that invoice.
|
||||
*/
|
||||
public $multicurrency_tx;
|
||||
|
|
@ -921,14 +921,14 @@ abstract class CommonObject
|
|||
}
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2');
|
||||
}
|
||||
if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2');
|
||||
}
|
||||
$perms = 1;
|
||||
if ($perms && isset($extrafields->attributes[$this->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2');
|
||||
$perms = (int) dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2');
|
||||
}
|
||||
if (empty($enabled)) {
|
||||
continue; // 0 = Never visible field
|
||||
|
|
@ -3992,11 +3992,8 @@ abstract class CommonObject
|
|||
$origin = 'order_supplier';
|
||||
}
|
||||
|
||||
// Elements of the core modules which have `$module` property but may to which we don't want to prefix module part to the element name for finding the linked object in llx_element_element.
|
||||
// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
|
||||
$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
|
||||
// Add module part to target type if object has $module property and isn't in core modules.
|
||||
$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
|
||||
// Add module part to target type
|
||||
$targettype = $this->getElementType();
|
||||
|
||||
$parameters = array('targettype' => $targettype);
|
||||
// Hook for explicitly set the targettype if it must be differtent than $this->element
|
||||
|
|
@ -4048,6 +4045,21 @@ abstract class CommonObject
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return element type string formatted like element_element target_type and source_type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getElementType()
|
||||
{
|
||||
// Elements of the core modules having a `$module` property but for which we may not want to prefix the element name with the module name for finding the linked object in llx_element_element.
|
||||
// It's because existing llx_element_element entries inserted prior to this modification (version <=14.2) may already use the element name alone in fk_source or fk_target (without the module name prefix).
|
||||
$coreModule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
|
||||
// Add module part to target type if object has $module property and isn't in core modules.
|
||||
return ((!empty($this->module) && !in_array($this->module, $coreModule)) ? $this->module.'_' : '').$this->element;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into
|
||||
* this->linkedObjectsIds array +
|
||||
|
|
@ -6180,12 +6192,12 @@ abstract class CommonObject
|
|||
|
||||
$enabled = 1;
|
||||
if (isset($this->fields[$key]['enabled'])) {
|
||||
$enabled = dol_eval($this->fields[$key]['enabled'], 1, 1, '1');
|
||||
$enabled = (int) dol_eval($this->fields[$key]['enabled'], 1, 1, '1');
|
||||
}
|
||||
/*$perms = 1;
|
||||
if (isset($this->fields[$key]['perms']))
|
||||
{
|
||||
$perms = dol_eval($this->fields[$key]['perms'], 1, 1, '1');
|
||||
$perms = (int) dol_eval($this->fields[$key]['perms'], 1, 1, '1');
|
||||
}*/
|
||||
if (empty($enabled)) {
|
||||
continue;
|
||||
|
|
@ -8596,7 +8608,7 @@ abstract class CommonObject
|
|||
// Test on 'enabled' ('enabled' is different than 'list' = 'visibility')
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($extrafields->attributes[$this->table_element]['enabled'][$key])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$this->table_element]['enabled'][$key], 1, 1, '2');
|
||||
}
|
||||
if (empty($enabled)) {
|
||||
continue;
|
||||
|
|
@ -8604,12 +8616,12 @@ abstract class CommonObject
|
|||
|
||||
$visibility = 1;
|
||||
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key])) {
|
||||
$visibility = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2');
|
||||
$visibility = (int) dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1, 1, '2');
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
if ($perms && isset($extrafields->attributes[$this->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2');
|
||||
$perms = (int) dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1, 1, '2');
|
||||
}
|
||||
|
||||
if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,9 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) {
|
||||
for ($j = $i; $j <= ($i + $Pointilles); $j++) {
|
||||
if ($j <= ($x2 - 1)) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$pdf->Line($j, $y1, $j + 1, $y1); // on trace le pointill? du haut, point par point
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$pdf->Line($j, $y2, $j + 1, $y2); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
|
|
@ -198,7 +200,9 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) {
|
||||
for ($j = $i; $j <= ($i + $Pointilles); $j++) {
|
||||
if ($j <= ($y2 - 1)) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$pdf->Line($x1, $j, $x1, $j + 1); // on trace le pointill? du haut, point par point
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$pdf->Line($x2, $j, $x2, $j + 1); // on trace le pointill? du bas, point par point
|
||||
}
|
||||
}
|
||||
|
|
@ -257,8 +261,8 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
{
|
||||
if ($src != $dest) {
|
||||
$tab = array(
|
||||
'in'=>39.37008,
|
||||
'mm'=>1000
|
||||
'in' => 39.37008,
|
||||
'mm' => 1000
|
||||
);
|
||||
return $value * $tab[$dest] / $tab[$src];
|
||||
}
|
||||
|
|
@ -278,7 +282,7 @@ abstract class CommonStickerGenerator extends CommonDocGenerator
|
|||
{
|
||||
// phpcs:enable
|
||||
// Array for link between height of characters and space between lines
|
||||
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
|
||||
$_Table_Hauteur_Chars = array(6 => 2, 7 => 2.5, 8 => 3, 9 => 3.5, 10 => 4, 11 => 6, 12 => 7, 13 => 8, 14 => 9, 15 => 10);
|
||||
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
|
||||
return $_Table_Hauteur_Chars[$pt];
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -966,9 +966,9 @@ class ExtraFields
|
|||
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
|
||||
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
|
||||
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
|
||||
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '2');
|
||||
$perms = (int) dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '2');
|
||||
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
||||
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2');
|
||||
$list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2');
|
||||
$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
|
|
@ -1649,9 +1649,9 @@ class ExtraFields
|
|||
$unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key];
|
||||
$required = $this->attributes[$extrafieldsobjectkey]['required'][$key];
|
||||
$param = $this->attributes[$extrafieldsobjectkey]['param'][$key];
|
||||
$perms = dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '2');
|
||||
$perms = (int) dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '2');
|
||||
$langfile = $this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
||||
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2');
|
||||
$list = (string) dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '2');
|
||||
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
|
||||
|
|
@ -2154,17 +2154,17 @@ class ExtraFields
|
|||
|
||||
$enabled = 1;
|
||||
if (isset($this->attributes[$object->table_element]['enabled'][$key])) { // 'enabled' is often a condition on module enabled or not
|
||||
$enabled = dol_eval($this->attributes[$object->table_element]['enabled'][$key], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($this->attributes[$object->table_element]['enabled'][$key], 1, 1, '2');
|
||||
}
|
||||
|
||||
$visibility = 1;
|
||||
if (isset($this->attributes[$object->table_element]['list'][$key])) { // 'list' is option for visibility
|
||||
$visibility = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '2'));
|
||||
$visibility = (int) dol_eval($this->attributes[$object->table_element]['list'][$key], 1, 1, '2');
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '2');
|
||||
$perms = (int) dol_eval($this->attributes[$object->table_element]['perms'][$key], 1, 1, '2');
|
||||
}
|
||||
if (empty($enabled)
|
||||
|| (
|
||||
|
|
|
|||
|
|
@ -254,16 +254,16 @@ class Fiscalyear extends CommonObject
|
|||
/**
|
||||
* Delete record
|
||||
*
|
||||
* @param int $id Id of record to delete
|
||||
* @param User $user User that delete
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($id)
|
||||
public function delete($user)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."accounting_fiscalyear WHERE rowid = ".((int) $id);
|
||||
$sql = "DELETE FROM ".$this->db->prefix()."accounting_fiscalyear";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
$this->db->commit();
|
||||
|
|
|
|||
|
|
@ -796,12 +796,15 @@ class Form
|
|||
} elseif ($type == 'helpclickable') {
|
||||
$img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt);
|
||||
} elseif ($type == 'superadmin') {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$img = img_picto($alt, 'redstar');
|
||||
} elseif ($type == 'admin') {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$img = img_picto($alt, 'star');
|
||||
} elseif ($type == 'warning') {
|
||||
$img = img_warning($alt);
|
||||
} elseif ($type != 'none') {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$img = img_picto($alt, $type); // $type can be an image path
|
||||
}
|
||||
|
||||
|
|
@ -2222,11 +2225,11 @@ class Form
|
|||
|
||||
$outarray[$userstatic->id] = $userstatic->getFullName($langs, $fullNameMode, -1, $maxlength) . $moreinfo;
|
||||
$outarray2[$userstatic->id] = array(
|
||||
'id'=>$userstatic->id,
|
||||
'label'=>$labeltoshow,
|
||||
'labelhtml'=>$labeltoshowhtml,
|
||||
'color'=>'',
|
||||
'picto'=>''
|
||||
'id' => $userstatic->id,
|
||||
'label' => $labeltoshow,
|
||||
'labelhtml' => $labeltoshowhtml,
|
||||
'color' => '',
|
||||
'picto' => ''
|
||||
);
|
||||
|
||||
$i++;
|
||||
|
|
@ -3370,7 +3373,7 @@ class Form
|
|||
}
|
||||
}
|
||||
|
||||
$parameters = array('objp'=>$objp);
|
||||
$parameters = array('objp' => $objp);
|
||||
$reshook = $hookmanager->executeHooks('constructProductListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
$opt .= $hookmanager->resPrint;
|
||||
|
|
@ -5375,11 +5378,11 @@ class Form
|
|||
}
|
||||
$more .= $this->selectDate($input['value'], $input['name'], $h, $m, 0, '', 1, $addnowlink);
|
||||
$more .= '</div></div>'."\n";
|
||||
$formquestion[] = array('name'=>$input['name'].'day');
|
||||
$formquestion[] = array('name'=>$input['name'].'month');
|
||||
$formquestion[] = array('name'=>$input['name'].'year');
|
||||
$formquestion[] = array('name'=>$input['name'].'hour');
|
||||
$formquestion[] = array('name'=>$input['name'].'min');
|
||||
$formquestion[] = array('name' => $input['name'].'day');
|
||||
$formquestion[] = array('name' => $input['name'].'month');
|
||||
$formquestion[] = array('name' => $input['name'].'year');
|
||||
$formquestion[] = array('name' => $input['name'].'hour');
|
||||
$formquestion[] = array('name' => $input['name'].'min');
|
||||
} elseif ($input['type'] == 'other') { // can be 1 column or 2 depending if label is set or not
|
||||
$more .= '<div class="tagtr"><div class="tagtd'.(empty($input['tdclass']) ? '' : (' '.$input['tdclass'])).'">';
|
||||
if (!empty($input['label'])) {
|
||||
|
|
@ -7202,7 +7205,7 @@ class Form
|
|||
// Add a link to set data
|
||||
if ($conf->use_javascript_ajax && !empty($adddateof)) {
|
||||
if (!is_array($adddateof)) {
|
||||
$arrayofdateof = array(array('adddateof'=>$adddateof, 'labeladddateof'=>$labeladddateof));
|
||||
$arrayofdateof = array(array('adddateof' => $adddateof, 'labeladddateof' => $labeladddateof));
|
||||
} else {
|
||||
$arrayofdateof = $adddateof;
|
||||
}
|
||||
|
|
@ -8050,22 +8053,22 @@ class Form
|
|||
* Can use autocomplete with ajax after x key pressed or a full combo, depending on setup.
|
||||
* This is the generic method that will replace all specific existing methods.
|
||||
*
|
||||
* @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield instead of $objectdesc.
|
||||
* @param string $htmlname Name of HTML select component
|
||||
* @param int $preselectedvalue Preselected value (ID of element)
|
||||
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
||||
* @param string $searchkey Search criteria
|
||||
* @param string $placeholder Place holder
|
||||
* @param string $morecss More CSS
|
||||
* @param string $moreparams More params provided to ajax call
|
||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||
* @param int $disabled 1=Html component is disabled
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param string $objectfield Object:Field that contains the definition (in table $fields or $extrafields). Example: 'Object:xxx' or 'Module_Object:xxx' or 'Object:options_xxx' or 'Module_Object:options_xxx'
|
||||
* @param string $objectdesc 'ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]'. For hard coded custom needs. Try to prefer method using $objectfield instead of $objectdesc.
|
||||
* @param string $htmlname Name of HTML select component
|
||||
* @param int $preSelectedValue Preselected value (ID of element)
|
||||
* @param string $showempty ''=empty values not allowed, 'string'=value show if we allow empty values (for example 'All', ...)
|
||||
* @param string $searchkey Search criteria
|
||||
* @param string $placeholder Place holder
|
||||
* @param string $morecss More CSS
|
||||
* @param string $moreparams More params provided to ajax call
|
||||
* @param int $forcecombo Force to load all values and output a standard combobox (with no beautification)
|
||||
* @param int $disabled 1=Html component is disabled
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param string $objectfield Object:Field that contains the definition (in table $fields or $extrafields). Example: 'Object:xxx' or 'Module_Object:xxx' or 'Object:options_xxx' or 'Module_Object:options_xxx'
|
||||
* @return string Return HTML string
|
||||
* @see selectForFormsList(), select_thirdparty_list()
|
||||
*/
|
||||
public function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '', $objectfield = '')
|
||||
public function selectForForms($objectdesc, $htmlname, $preSelectedValue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $disabled = 0, $selected_input_value = '', $objectfield = '')
|
||||
{
|
||||
global $conf, $extrafields, $user;
|
||||
|
||||
|
|
@ -8164,10 +8167,25 @@ class Form
|
|||
if (!empty($conf->use_javascript_ajax) && getDolGlobalString($confkeyforautocompletemode) && !$forcecombo) {
|
||||
// No immediate load of all database
|
||||
$placeholder = '';
|
||||
if ($preselectedvalue && empty($selected_input_value)) {
|
||||
$objecttmp->fetch($preselectedvalue);
|
||||
|
||||
if ($preSelectedValue && empty($selected_input_value)) {
|
||||
$objecttmp->fetch($preSelectedValue);
|
||||
$selected_input_value = ($prefixforautocompletemode == 'company' ? $objecttmp->name : $objecttmp->ref);
|
||||
//unset($objecttmp);
|
||||
|
||||
$oldValueForShowOnCombobox = 0;
|
||||
foreach ($objecttmp->fields as $fieldK => $fielV) {
|
||||
if (!$fielV['showoncombobox'] || empty($objecttmp->$fieldK)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$oldValueForShowOnCombobox) {
|
||||
$selected_input_value = '';
|
||||
}
|
||||
|
||||
$selected_input_value .= $oldValueForShowOnCombobox ? ' - ' : '';
|
||||
$selected_input_value .= $objecttmp->$fieldK;
|
||||
$oldValueForShowOnCombobox = empty($fielV['showoncombobox']) ? 0 : $fielV['showoncombobox'];
|
||||
}
|
||||
}
|
||||
|
||||
// Set url and param to call to get json of the search results
|
||||
|
|
@ -8175,12 +8193,12 @@ class Form
|
|||
$urloption = 'htmlname=' . urlencode($htmlname) . '&outjson=1&objectdesc=' . urlencode($objectdescorig) . '&objectfield='.urlencode($objectfield) . ($sortfield ? '&sortfield=' . urlencode($sortfield) : '');
|
||||
|
||||
// Activate the auto complete using ajax call.
|
||||
$out .= ajax_autocompleter($preselectedvalue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0, array());
|
||||
$out .= ajax_autocompleter($preSelectedValue, $htmlname, $urlforajaxcall, $urloption, getDolGlobalString($confkeyforautocompletemode), 0);
|
||||
$out .= '<!-- force css to be higher than dialog popup --><style type="text/css">.ui-autocomplete { z-index: 1010; }</style>';
|
||||
$out .= '<input type="text" class="' . $morecss . '"' . ($disabled ? ' disabled="disabled"' : '') . ' name="search_' . $htmlname . '" id="search_' . $htmlname . '" value="' . $selected_input_value . '"' . ($placeholder ? ' placeholder="' . dol_escape_htmltag($placeholder) . '"' : '') . ' />';
|
||||
} else {
|
||||
// Immediate load of table record.
|
||||
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
|
||||
$out .= $this->selectForFormsList($objecttmp, $htmlname, $preSelectedValue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled, $sortfield, $filter);
|
||||
}
|
||||
|
||||
return $out;
|
||||
|
|
@ -8222,7 +8240,7 @@ class Form
|
|||
if (!empty($objecttmp->fields)) { // For object that declare it, it is better to use declared fields (like societe, contact, ...)
|
||||
$tmpfieldstoshow = '';
|
||||
foreach ($objecttmp->fields as $key => $val) {
|
||||
if (!dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
if (! (int) dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
continue;
|
||||
}
|
||||
if (!empty($val['showoncombobox'])) {
|
||||
|
|
@ -10710,8 +10728,8 @@ class Form
|
|||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$searchtags = removeGlobalParenthesis($searchtags);
|
||||
|
||||
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey+1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';
|
||||
$ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey+1).'">x</span> ';
|
||||
$ret .= '<span class="marginleftonlyshort valignmiddle tagsearch" data-ufilterid="'.($tmpkey + 1).'" data-ufilter="'.dol_escape_htmltag($tmpval).'">';
|
||||
$ret .= '<span class="tagsearchdelete select2-selection__choice__remove" data-ufilterid="'.($tmpkey + 1).'">x</span> ';
|
||||
$ret .= dol_escape_htmltag($searchtags);
|
||||
$ret .= '</span>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1521,7 +1521,7 @@ class FormMail extends Form
|
|||
'basic' => 'basic',
|
||||
'news' => 'news',
|
||||
'commerce' => 'commerce',
|
||||
'text' => 'text'
|
||||
//'text' => 'text'
|
||||
);
|
||||
|
||||
foreach ($templates as $template => $templateFunction) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -41,6 +41,10 @@ class FormSms
|
|||
public $fromid;
|
||||
public $fromname;
|
||||
public $fromsms;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $fromtype;
|
||||
public $replytoname;
|
||||
public $replytomail;
|
||||
|
|
@ -48,9 +52,25 @@ class FormSms
|
|||
public $tomail;
|
||||
|
||||
public $withsubstit; // Show substitution array
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $withfrom;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $withto;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $withtopic;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $withbody;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ class Menu
|
|||
{
|
||||
$nb = 0;
|
||||
foreach ($this->liste as $val) {
|
||||
//if (dol_eval($val['enabled'], 1, 1, '1')) $nb++;
|
||||
if (!empty($val['enabled'])) {
|
||||
$nb++; // $val['enabled'] is already evaluated to 0 or 1, no need for dol_eval()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ class Menubase
|
|||
$this->title = $obj->title;
|
||||
$this->prefix = $obj->prefix;
|
||||
$this->langs = $obj->langs;
|
||||
$this->perms = $obj->perms;
|
||||
$this->perms = str_replace("\"", "'", $obj->perms);
|
||||
$this->enabled = str_replace("\"", "'", $obj->enabled);
|
||||
$this->user = $obj->user;
|
||||
$this->tms = $this->db->jdate($obj->tms);
|
||||
|
|
@ -665,7 +665,7 @@ class Menubase
|
|||
if (isset($menu['perms'])) {
|
||||
$tmpcond = $menu['perms'];
|
||||
if ($leftmenu == 'all') {
|
||||
$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force the part of condition on leftmenu to true
|
||||
}
|
||||
$perms = verifCond($tmpcond);
|
||||
//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
|
||||
|
|
@ -676,7 +676,7 @@ class Menubase
|
|||
if (isset($menu['enabled'])) {
|
||||
$tmpcond = $menu['enabled'];
|
||||
if ($leftmenu == 'all') {
|
||||
$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force part of condition to true
|
||||
$tmpcond = preg_replace('/\$leftmenu\s*==\s*["\'a-zA-Z_]+/', '1==1', $tmpcond); // Force the part of condition on leftmenu to true
|
||||
}
|
||||
$enabled = verifCond($tmpcond);
|
||||
//var_dump($menu['type'].' - '.$menu['titre'].' - '.$menu['enabled'].' => '.$enabled);
|
||||
|
|
|
|||
|
|
@ -727,7 +727,6 @@ class Translate
|
|||
|
||||
return $str;
|
||||
} else { // Translation is not available
|
||||
//if ($key[0] == '$') { return dol_eval($key, 1, 1, '1'); }
|
||||
return $this->getTradFromKey($key);
|
||||
}
|
||||
}
|
||||
|
|
@ -796,9 +795,6 @@ class Translate
|
|||
|
||||
return $str;
|
||||
} else {
|
||||
/*if ($key[0] == '$') {
|
||||
return dol_eval($key, 1, 1, '1');
|
||||
}*/
|
||||
return $this->getTradFromKey($key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ class Utils
|
|||
}
|
||||
}
|
||||
if (!$alreadyincluded) {
|
||||
$filesarray[] = array('fullname'=>$filelog, 'type'=>'file');
|
||||
$filesarray[] = array('fullname' => $filelog, 'type' => 'file');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -783,7 +783,7 @@ class Utils
|
|||
|
||||
dol_syslog("Utils::executeCLI result=".$result." output=".$output." error=".$error, LOG_DEBUG);
|
||||
|
||||
return array('result'=>$result, 'output'=>$output, 'error'=>$error);
|
||||
return array('result' => $result, 'output' => $output, 'error' => $error);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -909,25 +909,26 @@ class Utils
|
|||
|
||||
//var_dump($phpfileval['fullname']);
|
||||
$arrayreplacement = array(
|
||||
'mymodule'=>strtolower($module),
|
||||
'MyModule'=>$module,
|
||||
'MYMODULE'=>strtoupper($module),
|
||||
'My module'=>$module,
|
||||
'my module'=>$module,
|
||||
'Mon module'=>$module,
|
||||
'mon module'=>$module,
|
||||
'htdocs/modulebuilder/template'=>strtolower($module),
|
||||
'__MYCOMPANY_NAME__'=>$mysoc->name,
|
||||
'__KEYWORDS__'=>$module,
|
||||
'__USER_FULLNAME__'=>$user->getFullName($langs),
|
||||
'__USER_EMAIL__'=>$user->email,
|
||||
'__YYYY-MM-DD__'=>dol_print_date($now, 'dayrfc'),
|
||||
'---Put here your own copyright and developer email---'=>dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : ''),
|
||||
'__DATA_SPECIFICATION__'=>'Not yet available',
|
||||
'__README__'=>dolMd2Asciidoc($contentreadme),
|
||||
'__CHANGELOG__'=>dolMd2Asciidoc($contentchangelog),
|
||||
'mymodule' => strtolower($module),
|
||||
'MyModule' => $module,
|
||||
'MYMODULE' => strtoupper($module),
|
||||
'My module' => $module,
|
||||
'my module' => $module,
|
||||
'Mon module' => $module,
|
||||
'mon module' => $module,
|
||||
'htdocs/modulebuilder/template' => strtolower($module),
|
||||
'__MYCOMPANY_NAME__' => $mysoc->name,
|
||||
'__KEYWORDS__' => $module,
|
||||
'__USER_FULLNAME__' => $user->getFullName($langs),
|
||||
'__USER_EMAIL__' => $user->email,
|
||||
'__YYYY-MM-DD__' => dol_print_date($now, 'dayrfc'),
|
||||
'---Put here your own copyright and developer email---' => dol_print_date($now, 'dayrfc').' '.$user->getFullName($langs).($user->email ? ' <'.$user->email.'>' : ''),
|
||||
'__DATA_SPECIFICATION__' => 'Not yet available',
|
||||
'__README__' => dolMd2Asciidoc($contentreadme),
|
||||
'__CHANGELOG__' => dolMd2Asciidoc($contentchangelog),
|
||||
);
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
dolReplaceInFile($destfile, $arrayreplacement);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ if (isModEnabled('modulebuilder')) {
|
|||
//$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
|
||||
$text .= '<span class="fa fa-bug atoplogin"></span>';
|
||||
$text .= '</a>';
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$toprightmenu .= $form->textwithtooltip('', $langs->trans("ModuleBuilder"), 2, 1, $text, 'login_block_elem', 2);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -628,19 +628,19 @@ function ajax_event($htmlname, $events)
|
|||
/**
|
||||
* On/off button for constant
|
||||
*
|
||||
* @param string $code Name of constant
|
||||
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @param int $entity Entity. Current entity is used if null.
|
||||
* @param int $revertonoff 1=Revert on/off
|
||||
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
||||
* @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin.
|
||||
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
|
||||
* @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it
|
||||
* @param string $suffix Suffix to use on the name of the switch_on picto. Example: '', '_red'
|
||||
* @param string $mode Add parameter &mode= to the href link (Used for href link)
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
* @param string $code Name of constant
|
||||
* @param array $input Array of complementary actions to do if success ("disabled"|"enabled'|'set'|'del') => CSS element to switch, 'alert' => message to show, ... Example: array('disabled'=>array(0=>'cssid'))
|
||||
* @param int|null $entity Entity. Current entity is used if null.
|
||||
* @param int $revertonoff 1=Revert on/off
|
||||
* @param int $strict Use only "disabled" with delConstant and "enabled" with setConstant
|
||||
* @param int $forcereload Force to reload page if we click/change value (this is supported only when there is no 'alert' option in input)
|
||||
* @param int $marginleftonlyshort 1 = Add a short left margin on picto, 2 = Add a larger left margin on picto, 0 = No left margin.
|
||||
* @param int $forcenoajax 1 = Force to use a ahref link instead of ajax code.
|
||||
* @param int $setzeroinsteadofdel 1 = Set constantto '0' instead of deleting it
|
||||
* @param string $suffix Suffix to use on the name of the switch_on picto. Example: '', '_red'
|
||||
* @param string $mode Add parameter &mode= to the href link (Used for href link)
|
||||
* @param string $morecss More CSS
|
||||
* @return string
|
||||
*/
|
||||
function ajax_constantonoff($code, $input = array(), $entity = null, $revertonoff = 0, $strict = 0, $forcereload = 0, $marginleftonlyshort = 2, $forcenoajax = 0, $setzeroinsteadofdel = 0, $suffix = '', $mode = '', $morecss = 'inline-block')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ function societe_prepare_head(Societe $object)
|
|||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id;
|
||||
$head[$h][1] = $langs->trans("Events");
|
||||
if (isModEnabled('agenda')&& ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
|
||||
if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
|
||||
$nbEvent = 0;
|
||||
// Enable caching of thirdparty count actioncomm
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
|
|
@ -537,7 +537,7 @@ function getCountry($searchkey, $withcode = '', $dbtouse = null, $outputlangs =
|
|||
// Check parameters
|
||||
if (empty($searchkey) && empty($searchlabel)) {
|
||||
if ($withcode === 'all') {
|
||||
return array('id'=>'', 'code'=>'', 'label'=>'');
|
||||
return array('id' => '', 'code' => '', 'label' => '');
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
|
@ -578,7 +578,7 @@ function getCountry($searchkey, $withcode = '', $dbtouse = null, $outputlangs =
|
|||
} elseif ($withcode == 3) {
|
||||
$result = $obj->rowid;
|
||||
} elseif ($withcode === 'all') {
|
||||
$result = array('id'=>$obj->rowid, 'code'=>$obj->code, 'label'=>$label);
|
||||
$result = array('id' => $obj->rowid, 'code' => $obj->code, 'label' => $label);
|
||||
} else {
|
||||
$result = $label;
|
||||
}
|
||||
|
|
@ -651,9 +651,9 @@ function getState($id, $withcode = '', $dbtouse = null, $withregion = 0, $output
|
|||
}
|
||||
} elseif ($withcode === 'all') {
|
||||
if ($withregion == 1) {
|
||||
return array('id'=>$obj->id, 'code'=>$obj->code, 'label'=>$label, 'region_code'=>$obj->region_code, 'region'=>$obj->region_name);
|
||||
return array('id' => $obj->id, 'code' => $obj->code, 'label' => $label, 'region_code' => $obj->region_code, 'region' => $obj->region_name);
|
||||
} else {
|
||||
return array('id'=>$obj->id, 'code'=>$obj->code, 'label'=>$label);
|
||||
return array('id' => $obj->id, 'code' => $obj->code, 'label' => $label);
|
||||
}
|
||||
} else {
|
||||
if ($withregion == 1) {
|
||||
|
|
@ -962,7 +962,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$parameters = array('sql'=>$sql, 'function'=>'show_projects');
|
||||
$parameters = array('sql' => $sql, 'function' => 'show_projects');
|
||||
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
|
|
@ -1062,36 +1062,36 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
$extrafields->fetch_name_optionals_label($contactstatic->table_element);
|
||||
|
||||
$contactstatic->fields = array(
|
||||
'rowid' =>array('type'=>'integer', 'label'=>"TechnicalID", 'enabled'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'visible'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position'=>1),
|
||||
'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1),
|
||||
'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'index'=>1, 'position'=>20),
|
||||
'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>3, 'index'=>1, 'position'=>30),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>(!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible'=>3, 'position'=>35),
|
||||
'role' =>array('type'=>'checkbox', 'label'=>'Role', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>4, 'index'=>1, 'position'=>40),
|
||||
'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'notnull'=> 0, 'position'=>45),
|
||||
'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>50, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0, 1), 1=>$contactstatic->LibStatut(1, 1))),
|
||||
'rowid' => array('type' => 'integer', 'label' => "TechnicalID", 'enabled' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'visible' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position' => 1),
|
||||
'name' => array('type' => 'varchar(128)', 'label' => 'Name', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 1, 'index' => 1, 'position' => 10, 'searchall' => 1),
|
||||
'poste' => array('type' => 'varchar(128)', 'label' => 'PostOrFunction', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 2, 'index' => 1, 'position' => 20),
|
||||
'address' => array('type' => 'varchar(128)', 'label' => 'Address', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 3, 'index' => 1, 'position' => 30),
|
||||
'note_private' => array('type' => 'html', 'label' => 'NotePrivate', 'enabled' => (!getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'visible' => 3, 'position' => 35),
|
||||
'role' => array('type' => 'checkbox', 'label' => 'Role', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'showoncombobox' => 4, 'index' => 1, 'position' => 40),
|
||||
'birthday' => array('type' => 'date', 'label' => 'Birthday', 'enabled' => 1, 'visible' => -1, 'notnull' => 0, 'position' => 45),
|
||||
'statut' => array('type' => 'integer', 'label' => 'Status', 'enabled' => 1, 'visible' => 1, 'notnull' => 1, 'default' => 0, 'index' => 1, 'position' => 50, 'arrayofkeyval' => array(0 => $contactstatic->LibStatut(0, 1), 1 => $contactstatic->LibStatut(1, 1))),
|
||||
);
|
||||
|
||||
// Definition of fields for list
|
||||
$arrayfields = array(
|
||||
't.rowid'=>array('label'=>"TechnicalID", 'checked'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'enabled'=>(getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position'=>1),
|
||||
't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10),
|
||||
't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20),
|
||||
't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30),
|
||||
't.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position'=>35),
|
||||
'sc.role'=>array('label'=>"ContactByDefaultFor", 'checked'=>1, 'position'=>40),
|
||||
't.birthday'=>array('label'=>"Birthday", 'checked'=>0, 'position'=>45),
|
||||
't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>50, 'class'=>'center'),
|
||||
't.rowid' => array('label' => "TechnicalID", 'checked' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'enabled' => (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') ? 1 : 0), 'position' => 1),
|
||||
't.name' => array('label' => "Name", 'checked' => 1, 'position' => 10),
|
||||
't.poste' => array('label' => "PostOrFunction", 'checked' => 1, 'position' => 20),
|
||||
't.address' => array('label' => (empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked' => 1, 'position' => 30),
|
||||
't.note_private' => array('label' => 'NotePrivate', 'checked' => 0, 'position' => 35),
|
||||
'sc.role' => array('label' => "ContactByDefaultFor", 'checked' => 1, 'position' => 40),
|
||||
't.birthday' => array('label' => "Birthday", 'checked' => 0, 'position' => 45),
|
||||
't.statut' => array('label' => "Status", 'checked' => 1, 'position' => 50, 'class' => 'center'),
|
||||
);
|
||||
// Extra fields
|
||||
if (!empty($extrafields->attributes[$contactstatic->table_element]['label']) && is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key],
|
||||
'checked'=>((dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1, 1, '1') < 0) ? 0 : 1),
|
||||
'position'=>1000 + $extrafields->attributes[$contactstatic->table_element]['pos'][$key],
|
||||
'enabled' => (abs((int) dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1)) != 3 && dol_eval($extrafields->attributes[$contactstatic->table_element]['perms'][$key], 1, 1, '1'))
|
||||
'label' => $extrafields->attributes[$contactstatic->table_element]['label'][$key],
|
||||
'checked' => (((int) dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1, 1, '1') < 0) ? 0 : 1),
|
||||
'position' => 1000 + $extrafields->attributes[$contactstatic->table_element]['pos'][$key],
|
||||
'enabled' => (abs((int) dol_eval($extrafields->attributes[$contactstatic->table_element]['list'][$key], 1)) != 3 && (int) dol_eval($extrafields->attributes[$contactstatic->table_element]['perms'][$key], 1, 1, '1'))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1274,7 +1274,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
if (!empty($arrayfields['t.'.$key]['checked']) || !empty($arrayfields['sc.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($align ? ' '.$align : '').'">';
|
||||
if (in_array($key, array('statut'))) {
|
||||
print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
|
||||
print $form->selectarray('search_status', array('-1' => '', '0' => $contactstatic->LibStatut(0, 1), '1' => $contactstatic->LibStatut(1, 1)), $search_status, 0, 0, 0, '', 0, 0, 0, '', 'onrightofpage');
|
||||
} elseif (in_array($key, array('role'))) {
|
||||
print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300');
|
||||
} elseif (in_array($key, array('birthday'))) {
|
||||
|
|
@ -1298,7 +1298,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields);
|
||||
$parameters = array('arrayfields' => $arrayfields);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
|
|
@ -1345,7 +1345,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
$extrafieldsobjectkey = $contactstatic->table_element;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
|
|
@ -1406,7 +1406,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
print '<td class="nowrap center">';
|
||||
|
||||
// Add to agenda
|
||||
if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
if (isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_object($langs->trans("Event"), "action");
|
||||
print '</a> ';
|
||||
|
|
@ -1484,7 +1484,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
|
||||
if ($showuserlogin) {
|
||||
print '<td class="tdoverflowmax125">';
|
||||
$tmpuser= new User($db);
|
||||
$tmpuser = new User($db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$resfetch = $tmpuser->fetch(0, '', '', 0, -1, '', $contactstatic->id);
|
||||
if ($resfetch > 0) {
|
||||
print $tmpuser->getNomUrl(1, '', 0, 0, 24, 1);
|
||||
|
|
@ -1501,7 +1502,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
|
|||
print '<td class="nowrap center">';
|
||||
|
||||
// Add to agenda
|
||||
if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
if (isModEnabled('agenda') && $user->hasRight('agenda', 'myactions', 'create')) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&actioncode=&contactid='.$obj->rowid.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_object($langs->trans("Event"), "action");
|
||||
print '</a> ';
|
||||
|
|
@ -1686,7 +1687,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
|
|||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
$sql.= $hookmanager->resPrint;
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
|
||||
|
|
@ -1708,7 +1709,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
|
|||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
$sql.= $hookmanager->resPrint;
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
|
||||
|
|
@ -1829,7 +1830,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
|
|||
$parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module);
|
||||
$reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (!empty($hookmanager->resPrint)) {
|
||||
$sql.= $hookmanager->resPrint;
|
||||
$sql .= $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if (is_array($actioncode)) {
|
||||
|
|
@ -1893,48 +1894,48 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
|
|||
}
|
||||
|
||||
$histo[$numaction] = array(
|
||||
'type'=>$obj->type,
|
||||
'tododone'=>$tododone,
|
||||
'id'=>$obj->id,
|
||||
'datestart'=>$db->jdate($obj->dp),
|
||||
'dateend'=>$db->jdate($obj->dp2),
|
||||
'note'=>$obj->label,
|
||||
'percent'=>$obj->percent,
|
||||
'type' => $obj->type,
|
||||
'tododone' => $tododone,
|
||||
'id' => $obj->id,
|
||||
'datestart' => $db->jdate($obj->dp),
|
||||
'dateend' => $db->jdate($obj->dp2),
|
||||
'note' => $obj->label,
|
||||
'percent' => $obj->percent,
|
||||
|
||||
'userid'=>$obj->user_id,
|
||||
'login'=>$obj->user_login,
|
||||
'userfirstname'=>$obj->user_firstname,
|
||||
'userlastname'=>$obj->user_lastname,
|
||||
'userphoto'=>$obj->user_photo,
|
||||
'userid' => $obj->user_id,
|
||||
'login' => $obj->user_login,
|
||||
'userfirstname' => $obj->user_firstname,
|
||||
'userlastname' => $obj->user_lastname,
|
||||
'userphoto' => $obj->user_photo,
|
||||
|
||||
'contact_id'=>$obj->fk_contact,
|
||||
'contact_id' => $obj->fk_contact,
|
||||
'socpeopleassigned' => $contactaction->socpeopleassigned,
|
||||
'lastname' => empty($obj->lastname) ? '' : $obj->lastname,
|
||||
'firstname' => empty($obj->firstname) ? '' : $obj->firstname,
|
||||
'fk_element'=>$obj->fk_element,
|
||||
'elementtype'=>$obj->elementtype,
|
||||
'fk_element' => $obj->fk_element,
|
||||
'elementtype' => $obj->elementtype,
|
||||
// Type of event
|
||||
'acode'=>$obj->acode,
|
||||
'alabel'=>$obj->alabel,
|
||||
'libelle'=>$obj->alabel, // deprecated
|
||||
'apicto'=>$obj->apicto
|
||||
'acode' => $obj->acode,
|
||||
'alabel' => $obj->alabel,
|
||||
'libelle' => $obj->alabel, // deprecated
|
||||
'apicto' => $obj->apicto
|
||||
);
|
||||
} else {
|
||||
$histo[$numaction] = array(
|
||||
'type'=>$obj->type,
|
||||
'tododone'=>'done',
|
||||
'id'=>$obj->id,
|
||||
'datestart'=>$db->jdate($obj->dp),
|
||||
'dateend'=>$db->jdate($obj->dp2),
|
||||
'note'=>$obj->label,
|
||||
'percent'=>$obj->percent,
|
||||
'acode'=>$obj->acode,
|
||||
'type' => $obj->type,
|
||||
'tododone' => 'done',
|
||||
'id' => $obj->id,
|
||||
'datestart' => $db->jdate($obj->dp),
|
||||
'dateend' => $db->jdate($obj->dp2),
|
||||
'note' => $obj->label,
|
||||
'percent' => $obj->percent,
|
||||
'acode' => $obj->acode,
|
||||
|
||||
'userid'=>$obj->user_id,
|
||||
'login'=>$obj->user_login,
|
||||
'userfirstname'=>$obj->user_firstname,
|
||||
'userlastname'=>$obj->user_lastname,
|
||||
'userphoto'=>$obj->user_photo
|
||||
'userid' => $obj->user_id,
|
||||
'login' => $obj->user_login,
|
||||
'userfirstname' => $obj->user_firstname,
|
||||
'userlastname' => $obj->user_lastname,
|
||||
'userphoto' => $obj->user_photo
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1946,7 +1947,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = null, $nopr
|
|||
}
|
||||
}
|
||||
|
||||
if (isModEnabled('agenda')|| (isModEnabled('mailing') && !empty($objcon->email))) {
|
||||
if (isModEnabled('agenda') || (isModEnabled('mailing') && !empty($objcon->email))) {
|
||||
$delay_warning = $conf->global->MAIN_DELAY_ACTIONS_TODO * 24 * 60 * 60;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
|||
|
||||
// Add main fields of object
|
||||
foreach ($object->fields as $key => $val) {
|
||||
if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1, 1, '1'))) {
|
||||
if (!empty($val['isameasure']) && (!isset($val['enabled']) || (int) dol_eval($val['enabled'], 1, 1, '1'))) {
|
||||
$position = (empty($val['position']) ? 0 : intval($val['position']));
|
||||
$arrayofmesures[$tablealias.'.'.$key.'-sum'] = array(
|
||||
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($val['label']).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>',
|
||||
|
|
@ -100,7 +100,7 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu
|
|||
// Add extrafields to Measures
|
||||
if (!empty($object->isextrafieldmanaged) && isset($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) {
|
||||
$position = (!empty($val['position']) ? $val['position'] : 0);
|
||||
$arrayofmesures[preg_replace('/^t/', 'te', $tablealias).'.'.$key.'-sum'] = array(
|
||||
'label' => img_picto('', (empty($object->picto) ? 'generic' : $object->picto), 'class="pictofixedwidth"').$labelofobject.': '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' <span class="opacitymedium">('.$langs->trans("Sum").')</span>',
|
||||
|
|
@ -206,10 +206,10 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis,
|
|||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
|
||||
continue;
|
||||
}
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
if (isset($val['enabled']) && ! (int) dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
continue;
|
||||
}
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1, 1, '1')) {
|
||||
if (isset($val['visible']) && ! (int) dol_eval($val['visible'], 1, 1, '1')) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
|
||||
|
|
@ -371,10 +371,10 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup
|
|||
'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) {
|
||||
continue;
|
||||
}
|
||||
if (isset($val['enabled']) && !dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
if (isset($val['enabled']) && ! (int) dol_eval($val['enabled'], 1, 1, '1')) {
|
||||
continue;
|
||||
}
|
||||
if (isset($val['visible']) && !dol_eval($val['visible'], 1, 1, '1')) {
|
||||
if (isset($val['visible']) && ! (int) dol_eval($val['visible'], 1, 1, '1')) {
|
||||
continue;
|
||||
}
|
||||
if (preg_match('/^fk_/', $key) && !preg_match('/^fk_statu/', $key)) {
|
||||
|
|
|
|||
|
|
@ -2332,7 +2332,7 @@ function dol_get_fiche_head($links = array(), $active = '', $title = '', $notab
|
|||
if (empty($tabsname)) {
|
||||
$tabsname = str_replace("@", "", $picto);
|
||||
}
|
||||
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
|
||||
$out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem valignmiddle">';
|
||||
$out .= '<div class="tab valignmiddle"><a href="#" class="tab moretab inline-block tabunactive valignmiddle"><span class="hideonsmartphone">'.$langs->trans("More").'</span>... ('.$nbintab.')</a></div>'; // Do not use "reposition" class in the "More".
|
||||
$out .= '<div id="moretabsList'.$tabsname.'" style="width: '.$widthofpopup.'px; position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px; z-index:10;">';
|
||||
$out .= $outmore;
|
||||
|
|
@ -6890,7 +6890,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
|
|||
if (($mysoc->country_code == $thirdpartytouse->country_code)
|
||||
|| (in_array($mysoc->country_code, array('FR', 'MC')) && in_array($thirdpartytouse->country_code, array('FR', 'MC')))
|
||||
|| (in_array($mysoc->country_code, array('MQ', 'GP')) && in_array($thirdpartytouse->country_code, array('MQ', 'GP')))
|
||||
) {
|
||||
) {
|
||||
// If country of thirdparty to consider is ours
|
||||
if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object
|
||||
$result = $product->get_buyprice($idprodfournprice, 0, 0, 0);
|
||||
|
|
@ -8274,12 +8274,13 @@ function dol_concatdesc($text1, $text2, $forxml = false, $invert = false)
|
|||
/**
|
||||
* Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user'
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are trunc and html sanitized (to use for help tooltip)
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @param Object $object Object for keys on object
|
||||
* @param array $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @return array Array of substitutions
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys),
|
||||
* 2=Values are trunc and html sanitized (to use for help tooltip)
|
||||
* @param array|null $exclude Array of family keys we want to exclude. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @param Object|null $object Object for keys on object
|
||||
* @param array|null $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @return array Array of substitutions
|
||||
* @see setSubstitFromObject()
|
||||
*/
|
||||
function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $object = null, $include = null)
|
||||
|
|
@ -9756,13 +9757,13 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid =
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a variable with name $var start with $text.
|
||||
* Check if a variable with name $var startx with $text.
|
||||
* Can be used to forge dol_eval() conditions.
|
||||
*
|
||||
* @param $var string Variable
|
||||
* @param $regextext string Text that must be a valid regex string
|
||||
* @param $matchrule int 1=Test if start with, 0=Test if equal
|
||||
* @return boolean|string True or False, text if bad use.
|
||||
* @param string $var Variable
|
||||
* @param string $regextext Text that must be a valid regex string
|
||||
* @param int $matchrule 1=Test if start with, 0=Test if equal
|
||||
* @return boolean|string True or False, text if bad usage.
|
||||
*/
|
||||
function isStringVarMatching($var, $regextext, $matchrule = 1)
|
||||
{
|
||||
|
|
@ -9786,9 +9787,9 @@ function isStringVarMatching($var, $regextext, $matchrule = 1)
|
|||
* Verify if condition in string is ok or not
|
||||
*
|
||||
* @param string $strToEvaluate String with condition to check
|
||||
* @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars,
|
||||
* @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
|
||||
* '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
||||
* '2' (rarely used)=Accept also '[]'
|
||||
* '2' (used for example for the compute property of extrafields)=Accept also '[]'
|
||||
* @return boolean True or False. Note: It returns also True if $strToEvaluate is ''. False if error
|
||||
*/
|
||||
function verifCond($strToEvaluate, $onlysimplestring = '1')
|
||||
|
|
@ -9798,7 +9799,7 @@ function verifCond($strToEvaluate, $onlysimplestring = '1')
|
|||
if (isset($strToEvaluate) && $strToEvaluate !== '') {
|
||||
//var_dump($strToEvaluate);
|
||||
//$rep = dol_eval($strToEvaluate, 1, 0, '1'); // to show the error
|
||||
$rep = dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition
|
||||
$rep = (int) dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition
|
||||
$rights = $rep && (!is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false);
|
||||
//var_dump($rights);
|
||||
}
|
||||
|
|
@ -9810,15 +9811,15 @@ function verifCond($strToEvaluate, $onlysimplestring = '1')
|
|||
* This function is called by verifCond() or trans() and transnoentitiesnoconv().
|
||||
*
|
||||
* @param string $s String to evaluate
|
||||
* @param int $returnvalue 0=No return (used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
|
||||
* @param int $returnvalue 0=No return (deprecated, used to execute eval($a=something)). 1=Value of eval is returned (used to eval($something)).
|
||||
* @param int $hideerrors 1=Hide errors
|
||||
* @param string $onlysimplestring '0' (deprecated, used for computed property of extrafields)=Accept all chars,
|
||||
* @param string $onlysimplestring '0' (deprecated, do not use it anymore)=Accept all chars,
|
||||
* '1' (most common use)=Accept only simple string with char 'a-z0-9\s^$_+-.*>&|=!?():"\',/@';',
|
||||
* '2' (rarely used)=Accept also '[]'
|
||||
* '2' (used for example for the compute property of extrafields)=Accept also '[]'
|
||||
* @return mixed Nothing or return result of eval
|
||||
* @see verifCond()
|
||||
*/
|
||||
function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1')
|
||||
function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1')
|
||||
{
|
||||
// Only this global variables can be read by eval function and returned to caller
|
||||
global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example
|
||||
|
|
@ -9837,10 +9838,14 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
|||
|
||||
try {
|
||||
// Test on dangerous char (used for RCE), we allow only characters to make PHP variable testing
|
||||
if ($onlysimplestring == '1') {
|
||||
// We must accept: '1 && getDolGlobalInt("doesnotexist1") && getDolGlobalString("MAIN_FEATURES_LEVEL")'
|
||||
// We must accept: '$user->hasRight("cabinetmed", "read") && !$object->canvas=="patient@cabinetmed"'
|
||||
if ($onlysimplestring == '1' || $onlysimplestring == '2') {
|
||||
// We must accept with 1: '1 && getDolGlobalInt("doesnotexist1") && getDolGlobalString("MAIN_FEATURES_LEVEL")'
|
||||
// We must accept with 1: '$user->hasRight("cabinetmed", "read") && !$object->canvas=="patient@cabinetmed"'
|
||||
// We must accept with 2: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
|
||||
$specialcharsallowed = '^$_+-.*>&|=!?():"\',/@';
|
||||
if ($onlysimplestring == '2') {
|
||||
$specialcharsallowed .= '[]';
|
||||
}
|
||||
if (getDolGlobalString('MAIN_ALLOW_UNSECURED_SPECIAL_CHARS_IN_DOL_EVAL')) {
|
||||
$specialcharsallowed .= getDolGlobalString('MAIN_ALLOW_UNSECURED_SPECIAL_CHARS_IN_DOL_EVAL');
|
||||
}
|
||||
|
|
@ -9866,50 +9871,15 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
|||
//print 'scheck='.$scheck." : ".strpos($scheck, '(')."<br>\n";
|
||||
if (strpos($scheck, '(') !== false) {
|
||||
if ($returnvalue) {
|
||||
return 'Bad string syntax to evaluate (mode 1, found call of a function or method without using the direct name of the function): '.$s;
|
||||
return 'Bad string syntax to evaluate (mode '.$onlysimplestring.', found call of a function or method without using the direct name of the function): '.$s;
|
||||
} else {
|
||||
dol_syslog('Bad string syntax to evaluate (mode 1, found call of a function or method without using the direct name of the function): '.$s);
|
||||
dol_syslog('Bad string syntax to evaluate (mode '.$onlysimplestring.', found call of a function or method without using the direct name of the function): '.$s);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
// TODO
|
||||
// We can exclude $ char that are not: $db, $langs, $leftmenu, $topmenu, $user, $langs, $objectoffield, $object...,
|
||||
} elseif ($onlysimplestring == '2') {
|
||||
// We must accept: (($reloadedobj = new Task($db)) && ($reloadedobj->fetchNoCompute($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetchNoCompute($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : "Parent project not found"
|
||||
$specialcharsallowed = '^$_+-.*>&|=!?():"\',/@[]';
|
||||
if (getDolGlobalString('MAIN_ALLOW_UNSECURED_SPECIAL_CHARS_IN_DOL_EVAL')) {
|
||||
$specialcharsallowed .= getDolGlobalString('MAIN_ALLOW_UNSECURED_SPECIAL_CHARS_IN_DOL_EVAL');
|
||||
}
|
||||
if (preg_match('/[^a-z0-9\s'.preg_quote($specialcharsallowed, '/').']/i', $s)) {
|
||||
if ($returnvalue) {
|
||||
return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s;
|
||||
} else {
|
||||
dol_syslog('Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
$savescheck = '';
|
||||
$scheck = $s;
|
||||
while ($scheck && $savescheck != $scheck) {
|
||||
$savescheck = $scheck;
|
||||
$scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $scheck); // accept parenthesis in '...->method(...'
|
||||
$scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
|
||||
$scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... ('. Must replace with __PARENTHESIS__ with a space after to allow following substitutions
|
||||
$scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function('
|
||||
$scheck = preg_replace('/\s!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in '... function(' and '... !function('
|
||||
$scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)')
|
||||
}
|
||||
//print 'scheck='.$scheck." : ".strpos($scheck, '(')."<br>\n";
|
||||
if (strpos($scheck, '(') !== false) {
|
||||
if ($returnvalue) {
|
||||
return 'Bad string syntax to evaluate (mode 2, found call of a function or method without using the direct name of the function): '.$s;
|
||||
} else {
|
||||
dol_syslog('Bad string syntax to evaluate (mode 2, found call of a function or method without using the direct name of the function): '.$s);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
// TODO
|
||||
// We can exclude $ char that are not: $db, $leftmenu, $topmenu, $user, $langs, $object...,
|
||||
// We can exclude $ char that are not:
|
||||
// $db, $langs, $leftmenu, $topmenu, $user, $langs, $objectoffield, $object...,
|
||||
}
|
||||
if (is_array($s) || $s === 'Array') {
|
||||
return 'Bad string syntax to evaluate (value is Array) '.var_export($s, true);
|
||||
|
|
@ -9949,6 +9919,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
|||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "require", "include", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("get_defined_functions", "get_defined_vars", "get_defined_constants", "get_declared_classes"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("function", "call_user_func"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include", "require_once", "include_once"));
|
||||
$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities
|
||||
|
||||
$forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function
|
||||
|
|
@ -9978,11 +9949,26 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1'
|
|||
//print $s."<br>\n";
|
||||
if ($returnvalue) {
|
||||
if ($hideerrors) {
|
||||
return @eval('return '.$s.';');
|
||||
ob_start(); // An evaluation has no reason to output data
|
||||
$tmps = @eval('return '.$s.';');
|
||||
$tmpo = ob_get_contents();
|
||||
ob_clean(); // End of interception of data
|
||||
if ($tmpo) {
|
||||
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
|
||||
}
|
||||
return $tmps;
|
||||
} else {
|
||||
return eval('return '.$s.';');
|
||||
ob_start(); // An evaluation has no reason to output data
|
||||
$tmps = eval('return '.$s.';');
|
||||
$tmpo = ob_get_contents();
|
||||
ob_clean(); // End of interception of data
|
||||
if ($tmpo) {
|
||||
print 'Bad string syntax to evaluate. Some data were output when it should not when evaluating: '.$s;
|
||||
}
|
||||
return $tmps;
|
||||
}
|
||||
} else {
|
||||
dol_syslog('Do not use anymore dol_eval with param returnvalue=0', LOG_WARNING);
|
||||
if ($hideerrors) {
|
||||
@eval($s);
|
||||
} else {
|
||||
|
|
@ -13096,7 +13082,7 @@ function getActionCommEcmList($object)
|
|||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param mixed $filterobj Filter on object Adherent|Societe|Project|Product|CommandeFournisseur|Dolresource|Ticket|... to list events linked to an object
|
||||
* @param Contact $objcon Filter on object contact to filter events on a contact
|
||||
* @param Contact|null $objcon Filter on object contact to filter events on a contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param string $actioncode Filter on actioncode
|
||||
* @param string $donetodo Filter on event 'done' or 'todo' or ''=nofilter (all).
|
||||
|
|
@ -13105,7 +13091,7 @@ function getActionCommEcmList($object)
|
|||
* @param string $sortorder Sort order
|
||||
* @return string|void Return html part or void if noprint is 1
|
||||
*/
|
||||
function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC')
|
||||
function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC')
|
||||
{
|
||||
global $user, $conf;
|
||||
global $form;
|
||||
|
|
@ -13120,6 +13106,8 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
}
|
||||
|
||||
$histo = array();
|
||||
'@phan-var-force array<int,array{type:string,tododone:string,id:string,datestart:int|string,dateend:int|string,note:string,message:string,percent:string,userid:string,login:string,userfirstname:string,userlastname:string,userphoto:string,msg_from?:string,contact_id?:string,socpeopleassigned?:int[],lastname?:string,firstname?:string,fk_element?:int,elementtype?:string,acode:string,alabel?:string,libelle?:string,apicto?:string}> $histo';
|
||||
|
||||
$numaction = 0;
|
||||
$now = dol_now();
|
||||
|
||||
|
|
@ -13199,7 +13187,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
}
|
||||
|
||||
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
|
||||
if ($force_filter_contact === false) {
|
||||
if (!$force_filter_contact) {
|
||||
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
|
||||
$sql .= " AND a.fk_soc = ".((int) $filterobj->id);
|
||||
} elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) {
|
||||
|
|
@ -13327,6 +13315,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
|
|||
while ($i < $imaxinloop) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
'@phan-var-force array{apicto:string,contact_id:string,dp:string,dp2:string,firstname:string,label:string,message:string,msg_from:string,ref:string,type:string,user_lastname:string} $obj';
|
||||
if ($obj->type == 'action') {
|
||||
$contactaction = new ActionComm($db);
|
||||
$contactaction->id = $obj->id;
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ function dolGetListOfObjectClasses($destdir)
|
|||
$objects[$fileobj['fullname']] = $objectnameloop;
|
||||
}
|
||||
}
|
||||
if (count($objects)>0) {
|
||||
if (count($objects) > 0) {
|
||||
return $objects;
|
||||
}
|
||||
|
||||
|
|
@ -559,12 +559,12 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $
|
|||
}
|
||||
}
|
||||
} elseif ($action == -2 && !empty($objectname) && !empty($module)) {
|
||||
$key= null;
|
||||
$key = null;
|
||||
$right = null;
|
||||
$objectOfRights = array();
|
||||
//check if object already declared in rights file
|
||||
foreach ($permissions as $right) {
|
||||
$objectOfRights[]= $right[4];
|
||||
$objectOfRights[] = $right[4];
|
||||
}
|
||||
if (in_array(strtolower($objectname), $objectOfRights)) {
|
||||
$error++;
|
||||
|
|
@ -591,7 +591,7 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $
|
|||
if (!$error) {
|
||||
// prepare permissions array
|
||||
$count_perms = count($permissions);
|
||||
for ($i = 0;$i<$count_perms;$i++) {
|
||||
for ($i = 0;$i < $count_perms;$i++) {
|
||||
$permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)";
|
||||
$permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'";
|
||||
$permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'";
|
||||
|
|
@ -611,7 +611,7 @@ function reWriteAllPermissions($file, $permissions, $key, $right, $objectname, $
|
|||
|
||||
|
||||
// parcourir les objects
|
||||
$o=0;
|
||||
$o = 0;
|
||||
foreach ($permissions as &$object) {
|
||||
// récupérer la permission de l'objet
|
||||
$p = 1;
|
||||
|
|
@ -735,7 +735,7 @@ function writePropsInAsciiDoc($file, $objectname, $destfile)
|
|||
foreach ($attributesUnique as $attUnique) {
|
||||
$table .= "|".$attUnique;
|
||||
}
|
||||
$table .="\n";
|
||||
$table .= "\n";
|
||||
$valuesModif = array();
|
||||
foreach ($keys as $string) {
|
||||
$string = trim($string, "'");
|
||||
|
|
@ -783,9 +783,9 @@ function writePropsInAsciiDoc($file, $objectname, $destfile)
|
|||
$table .= "|===\n";
|
||||
$table .= "__ end table for object $objectname\n";
|
||||
|
||||
//write in file
|
||||
//write in file @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$writeInFile = dolReplaceInFile($destfile, array('== DATA SPECIFICATIONS' => $table));
|
||||
if ($writeInFile<0) {
|
||||
if ($writeInFile < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -897,7 +897,7 @@ function writePermsInAsciiDoc($file, $destfile)
|
|||
foreach ($permissions as $key => $element) {
|
||||
$element = str_replace(" '", '', $element);
|
||||
$element = trim($element, "'");
|
||||
$permsN[] = substr($element, strpos($element, "=")+1);
|
||||
$permsN[] = substr($element, strpos($element, "=") + 1);
|
||||
}
|
||||
array_pop($permsN);
|
||||
|
||||
|
|
@ -926,8 +926,9 @@ function writePermsInAsciiDoc($file, $destfile)
|
|||
}
|
||||
// end table
|
||||
$string .= "\n|===\n";
|
||||
$write = dolReplaceInFile($destfile, array('__DATA_PERMISSIONS__'=> $string));
|
||||
if ($write<0) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$write = dolReplaceInFile($destfile, array('__DATA_PERMISSIONS__' => $string));
|
||||
if ($write < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -985,7 +986,7 @@ function addObjectsToApiFile($file, $objects, $modulename)
|
|||
//add methods for each object
|
||||
$allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/');
|
||||
foreach ($objects as $object) {
|
||||
$contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent);
|
||||
$contentReplaced = str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent);
|
||||
dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/'));
|
||||
}
|
||||
dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename)));
|
||||
|
|
@ -1049,7 +1050,7 @@ function removeObjectFromApiFile($file, $objectname, $modulename)
|
|||
*/
|
||||
function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
|
||||
{
|
||||
$errors =0;
|
||||
$errors = 0;
|
||||
$counter = 0;
|
||||
if (!file_exists($file)) {
|
||||
return -1;
|
||||
|
|
@ -1062,7 +1063,7 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
|
|||
array_push($menus, $menuWantTo);
|
||||
} elseif ($action == 2 && !empty($key) && !empty($menuWantTo)) {
|
||||
// update right from permissions array
|
||||
$urlCounter=0;
|
||||
$urlCounter = 0;
|
||||
// check if the values already exists
|
||||
foreach ($menus as $index => $menu) {
|
||||
if ($index !== $key) {
|
||||
|
|
@ -1111,20 +1112,20 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
|
|||
//var_dump(dol_escape_php($menu['perms'], 1)); exit;
|
||||
|
||||
$str_menu .= $start."\n";
|
||||
$str_menu.= "\t\t\$this->menu[\$r++]=array(\n";
|
||||
$str_menu.= "\t\t\t 'fk_menu' => '".dol_escape_php($menu['fk_menu'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'type' => '".dol_escape_php($menu['type'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'titre' => '".dol_escape_php($menu['titre'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'mainmenu' => '".dol_escape_php($menu['mainmenu'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'leftmenu' => '".dol_escape_php($menu['leftmenu'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'url' => '".dol_escape_php($menu['url'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'langs' => '".dol_escape_php($menu['langs'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'position' => ".((int) $menu['position']).",\n";
|
||||
$str_menu.= "\t\t\t 'enabled' => '".dol_escape_php($menu['enabled'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'perms' => '".dol_escape_php($menu['perms'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'target' => '".dol_escape_php($menu['target'], 1)."',\n";
|
||||
$str_menu.= "\t\t\t 'user' => ".((int) $menu['user']).",\n";
|
||||
$str_menu.= "\t\t);\n";
|
||||
$str_menu .= "\t\t\$this->menu[\$r++]=array(\n";
|
||||
$str_menu .= "\t\t\t 'fk_menu' => '".dol_escape_php($menu['fk_menu'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'type' => '".dol_escape_php($menu['type'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'titre' => '".dol_escape_php($menu['titre'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'mainmenu' => '".dol_escape_php($menu['mainmenu'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'leftmenu' => '".dol_escape_php($menu['leftmenu'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'url' => '".dol_escape_php($menu['url'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'langs' => '".dol_escape_php($menu['langs'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'position' => ".((int) $menu['position']).",\n";
|
||||
$str_menu .= "\t\t\t 'enabled' => '".dol_escape_php($menu['enabled'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'perms' => '".dol_escape_php($menu['perms'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'target' => '".dol_escape_php($menu['target'], 1)."',\n";
|
||||
$str_menu .= "\t\t\t 'user' => ".((int) $menu['user']).",\n";
|
||||
$str_menu .= "\t\t);\n";
|
||||
|
||||
if (is_null($next_val) || $val_actuel['leftmenu'] !== $next_val['leftmenu']) {
|
||||
$str_menu .= $end."\n";
|
||||
|
|
@ -1266,7 +1267,7 @@ function createNewDictionnary($modulename, $file, $namedic, $dictionnaires = nul
|
|||
$dictionnaires['tabfieldinsert'][] = (array_key_exists('code', $columns) && array_key_exists('label', $columns) ? 'code,label' : '');
|
||||
$dictionnaires['tabrowid'][] = $primaryKey;
|
||||
$dictionnaires['tabcond'][] = isModEnabled('$modulename');
|
||||
$dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : '');
|
||||
$dictionnaires['tabhelp'][] = (array_key_exists('code', $columns) ? array('code' => $langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip') : '');
|
||||
|
||||
// Build the dictionary string
|
||||
$writeInfile = updateDictionaryInFile($modulename, $file, $dictionnaires);
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali
|
|||
* @param Contact|string|null $targetcontact Target contact object
|
||||
* @param int $usecontact Use contact instead of company
|
||||
* @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url)
|
||||
* @param Object $object Object we want to build document for
|
||||
* @param Object|null $object Object we want to build document for
|
||||
* @return string|int String with full address or -1 if KO
|
||||
*/
|
||||
function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null)
|
||||
|
|
@ -718,7 +718,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t
|
|||
/**
|
||||
* Show header of page for PDF generation
|
||||
*
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param TCPDF $pdf Object PDF
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
* @param int $page_height Height of page
|
||||
* @return void
|
||||
|
|
@ -752,11 +752,11 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height)
|
|||
/**
|
||||
* Return array of possible substitutions for PDF content (without external module substitutions).
|
||||
*
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object $object Object
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip)
|
||||
* @param array $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @param Translate $outputlangs Output language
|
||||
* @param array|null $exclude Array of family keys we want to exclude. For example array('mycompany', 'object', 'date', 'user', ...)
|
||||
* @param Object|null $object Object
|
||||
* @param int $onlykey 1=Do not calculate some heavy values of keys (performance enhancement when we need only the keys), 2=Values are truncated and html sanitized (to use for help tooltip)
|
||||
* @param array|null $include Array of family keys we want to include. For example array('system', 'mycompany', 'object', 'objectamount', 'date', 'user', ...)
|
||||
* @return array Array of substitutions
|
||||
*/
|
||||
function pdf_getSubstitutionArray($outputlangs, $exclude = null, $object = null, $onlykey = 0, $include = null)
|
||||
|
|
@ -2296,11 +2296,11 @@ function pdf_getlineremisepercent($object, $i, $outputlangs, $hidedetails = 0)
|
|||
/**
|
||||
* Return line percent
|
||||
*
|
||||
* @param Object $object Object
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @param HookManager $hookmanager Hook manager instance
|
||||
* @param Object $object Object
|
||||
* @param int $i Current line number
|
||||
* @param Translate $outputlangs Object langs for output
|
||||
* @param int $hidedetails Hide details (0=no, 1=yes, 2=just special lines)
|
||||
* @param HookManager|null $hookmanager Hook manager instance
|
||||
* @return string
|
||||
*/
|
||||
function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookmanager = null)
|
||||
|
|
|
|||
|
|
@ -519,6 +519,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
|||
if ($containeraliasalt) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
$tmpwebsitepage = new WebsitePage($db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$result = $tmpwebsitepage->fetch(0, $website->id, '', $containeraliasalt);
|
||||
if ($result > 0) {
|
||||
$containerref = $tmpwebsitepage->pageurl;
|
||||
|
|
@ -542,6 +543,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri
|
|||
if (!$containeraliasalt) { // If containeraliasalt set, we already did the test
|
||||
include_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
|
||||
$tmpwebsitepage = new WebsitePage($db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$result = $tmpwebsitepage->fetch(0, $website->id, $containerref);
|
||||
unset($tmpwebsitepage);
|
||||
}
|
||||
|
|
@ -1104,7 +1106,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||
global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers.
|
||||
|
||||
$error = 0;
|
||||
$arrayresult = array('code'=>'', 'list'=>array());
|
||||
$arrayresult = array('code' => '', 'list' => array());
|
||||
|
||||
if (!is_object($weblangs)) {
|
||||
$weblangs = $langs;
|
||||
|
|
@ -1212,22 +1214,22 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||
|
||||
$filecontent = file_get_contents($filehtmlheader);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
|
||||
$arrayresult['list'][] = array('type'=>'website_htmlheadercontent');
|
||||
$arrayresult['list'][] = array('type' => 'website_htmlheadercontent');
|
||||
}
|
||||
|
||||
$filecontent = file_get_contents($filecss);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
|
||||
$arrayresult['list'][] = array('type'=>'website_csscontent');
|
||||
$arrayresult['list'][] = array('type' => 'website_csscontent');
|
||||
}
|
||||
|
||||
$filecontent = file_get_contents($filejs);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
|
||||
$arrayresult['list'][] = array('type'=>'website_jscontent');
|
||||
$arrayresult['list'][] = array('type' => 'website_jscontent');
|
||||
}
|
||||
|
||||
$filerobot = file_get_contents($filerobot);
|
||||
if ((empty($max) || ($found < $max)) && preg_match('/'.preg_quote($searchstring, '/').'/', $filecontent)) {
|
||||
$arrayresult['list'][] = array('type'=>'website_robotcontent');
|
||||
$arrayresult['list'][] = array('type' => 'website_robotcontent');
|
||||
}
|
||||
|
||||
$searchdone = 1;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
|
||||
global $action;
|
||||
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
|
@ -775,7 +775,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
if ($posYAfterImage > $posYAfterDescription) {
|
||||
$nexY = $posYAfterImage;
|
||||
|
|
@ -784,10 +784,10 @@ class pdf_crabe extends ModelePDFFactures
|
|||
// Add line
|
||||
if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
$pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY + 1, $this->page_largeur - $this->marge_droite, $nexY + 1);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
$pdf->SetLineStyle(array('dash' => 0));
|
||||
}
|
||||
|
||||
$nexY += 2; // Add space between lines
|
||||
|
|
@ -872,7 +872,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
|
||||
// Add pdfgeneration hook
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
|
||||
global $action;
|
||||
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
|
|
@ -882,7 +882,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
|
||||
dolChmod($file);
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
$this->result = array('fullpath' => $file);
|
||||
|
||||
return 1; // No error
|
||||
} else {
|
||||
|
|
@ -1204,8 +1204,9 @@ class pdf_crabe extends ModelePDFFactures
|
|||
if ($object->mode_reglement_code == "PRE") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$bac->fetch(0, $object->thirdparty->id);
|
||||
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
$iban = $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
$lib_mode_reg .= ' '.$outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
|
||||
}
|
||||
$pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L');
|
||||
|
|
@ -2139,11 +2140,11 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
|
||||
$companystatic = new Societe($this->db);
|
||||
$companystatic->fetch($object->contact->fk_soc);
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_name_shipping = pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $companystatic, $object->contact, $usecontact, 'target', $object);
|
||||
} else {
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
|
||||
$carac_client_name_shipping = pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
|
||||
}
|
||||
if (!empty($carac_client_shipping)) {
|
||||
$posy += $hautcadre;
|
||||
|
|
@ -2162,7 +2163,7 @@ class pdf_crabe extends ModelePDFFactures
|
|||
$posy = $pdf->getY();
|
||||
|
||||
// Show shipping information
|
||||
$pdf->SetXY($posx+2, $posy);
|
||||
$pdf->SetXY($posx + 2, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
|
||||
$top_shift += $hautcadre;
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$hookmanager = new HookManager($this->db);
|
||||
}
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
|
||||
global $action;
|
||||
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
|
|
@ -848,9 +848,9 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$parameters = array(
|
||||
'object' => $object,
|
||||
'i' => $i,
|
||||
'pdf' =>& $pdf,
|
||||
'curY' =>& $curY,
|
||||
'nexY' =>& $nexY,
|
||||
'pdf' => & $pdf,
|
||||
'curY' => & $curY,
|
||||
'nexY' => & $nexY,
|
||||
'outputlangs' => $outputlangs,
|
||||
'hidedetails' => $hidedetails
|
||||
);
|
||||
|
|
@ -900,7 +900,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
// Retrieve type from database for backward compatibility with old records
|
||||
if ((!isset($localtax1_type) || $localtax1_type == '' || !isset($localtax2_type) || $localtax2_type == '') // if tax type not defined
|
||||
&& (!empty($localtax1_rate) || !empty($localtax2_rate))) { // and there is local tax
|
||||
$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
|
||||
$localtaxtmp_array = getLocalTaxesFromRate($vatrate, 0, $object->thirdparty, $mysoc);
|
||||
$localtax1_type = isset($localtaxtmp_array[0]) ? $localtaxtmp_array[0] : '';
|
||||
$localtax2_type = isset($localtaxtmp_array[2]) ? $localtaxtmp_array[2] : '';
|
||||
}
|
||||
|
|
@ -934,17 +934,17 @@ class pdf_sponge extends ModelePDFFactures
|
|||
if (empty($this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'])) {
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] = 0;
|
||||
}
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate'=>$vatrate, 'vatcode'=>$vatcode, 'amount'=> $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
$this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')] = array('vatrate' => $vatrate, 'vatcode' => $vatcode, 'amount' => $this->tva_array[$vatrate.($vatcode ? ' ('.$vatcode.')' : '')]['amount'] + $tvaligne);
|
||||
|
||||
$nexY = max($nexY, $posYAfterImage);
|
||||
|
||||
// Add line
|
||||
if (getDolGlobalString('MAIN_PDF_DASH_BETWEEN_LINES') && $i < ($nblines - 1)) {
|
||||
$pdf->setPage($pageposafter);
|
||||
$pdf->SetLineStyle(array('dash'=>'1,1', 'color'=>array(80, 80, 80)));
|
||||
$pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(80, 80, 80)));
|
||||
//$pdf->SetDrawColor(190,190,200);
|
||||
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur - $this->marge_droite, $nexY);
|
||||
$pdf->SetLineStyle(array('dash'=>0));
|
||||
$pdf->SetLineStyle(array('dash' => 0));
|
||||
}
|
||||
|
||||
// Detect if some page were added automatically and output _tableau for past pages
|
||||
|
|
@ -1024,7 +1024,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
|
||||
// Add pdfgeneration hook
|
||||
$hookmanager->initHooks(array('pdfgeneration'));
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs);
|
||||
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
|
||||
global $action;
|
||||
$reshook = $hookmanager->executeHooks('afterPDFCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
|
|
@ -1034,7 +1034,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
|
||||
dolChmod($file);
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
$this->result = array('fullpath' => $file);
|
||||
|
||||
return 1; // No error
|
||||
} else {
|
||||
|
|
@ -1298,8 +1298,9 @@ class pdf_sponge extends ModelePDFFactures
|
|||
if ($object->mode_reglement_code == "PRE") {
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$bac = new CompanyBankAccount($this->db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$bac->fetch(0, $object->thirdparty->id);
|
||||
$iban= $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
$iban = $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
|
||||
$lib_mode_reg .= ' '.$outputlangs->trans("PaymentTypePREdetails", dol_trunc($iban, 6, 'right', 'UTF-8', 1));
|
||||
}
|
||||
|
||||
|
|
@ -2390,11 +2391,11 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$contactshipping = $object->fetch_Contact($idaddressshipping[0]);
|
||||
$companystatic = new Societe($this->db);
|
||||
$companystatic->fetch($object->contact->fk_soc);
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_name_shipping = pdfBuildThirdpartyName($object->contact, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $companystatic, $object->contact, $usecontact, 'target', $object);
|
||||
} else {
|
||||
$carac_client_name_shipping=pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping=pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
|
||||
$carac_client_name_shipping = pdfBuildThirdpartyName($object->thirdparty, $outputlangs);
|
||||
$carac_client_shipping = pdf_build_address($outputlangs, $this->emetteur, $object->thirdparty, '', 0, 'target', $object);
|
||||
}
|
||||
if (!empty($carac_client_shipping)) {
|
||||
$posy += $hautcadre;
|
||||
|
|
@ -2413,7 +2414,7 @@ class pdf_sponge extends ModelePDFFactures
|
|||
$posy = $pdf->getY();
|
||||
|
||||
// Show shipping information
|
||||
$pdf->SetXY($posx+2, $posy);
|
||||
$pdf->SetXY($posx + 2, $posy);
|
||||
$pdf->SetFont('', '', $default_font_size - 1);
|
||||
$pdf->MultiCell($widthrecbox - 2, 2, $carac_client_shipping, '', 'L');
|
||||
$shipp_shift += $hautcadre;
|
||||
|
|
|
|||
|
|
@ -393,6 +393,7 @@ class ImportCsv extends ModeleImports
|
|||
|
||||
// Is it a required field ?
|
||||
if (preg_match('/\*/', $objimport->array_import_fields[0][$val]) && ((string) $newval == '')) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorMissingMandatoryValue', $key);
|
||||
$this->errors[$error]['type'] = 'NOTNULL';
|
||||
$errorforthistable++;
|
||||
|
|
@ -405,7 +406,7 @@ class ImportCsv extends ModeleImports
|
|||
if ($objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeid'
|
||||
|| $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromref'
|
||||
|| $objimport->array_import_convertvalue[0][$val]['rule'] == 'fetchidfromcodeorlabel'
|
||||
) {
|
||||
) {
|
||||
// New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess.
|
||||
$isidorref = 'id';
|
||||
if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) {
|
||||
|
|
@ -854,7 +855,7 @@ class ImportCsv extends ModeleImports
|
|||
$fname = 'rowid';
|
||||
if (strpos($tablename, '_categorie_') !== false) {
|
||||
$is_table_category_link = true;
|
||||
$fname='*';
|
||||
$fname = '*';
|
||||
}
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
|
|
|
|||
|
|
@ -516,6 +516,7 @@ class ImportXlsx extends ModeleImports
|
|||
$newval = $classinstance->id;
|
||||
} elseif (! $error) {
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
} elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) {
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element']));
|
||||
|
|
@ -558,6 +559,7 @@ class ImportXlsx extends ModeleImports
|
|||
$newval = $classinstance->id;
|
||||
} else {
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
} else {
|
||||
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||
|
|
@ -595,6 +597,7 @@ class ImportXlsx extends ModeleImports
|
|||
$newval = $scaleorid ? $scaleorid : 0;
|
||||
} else {
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
} else {
|
||||
$this->errors[$error]['lib'] = 'ErrorFieldValueNotIn';
|
||||
|
|
@ -753,6 +756,7 @@ class ImportXlsx extends ModeleImports
|
|||
if (!empty($filter)) {
|
||||
$tableforerror .= ':' . $filter;
|
||||
}
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorFieldValueNotIn', $key, $newval, $field, $tableforerror);
|
||||
$this->errors[$error]['type'] = 'FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
|
|
@ -761,6 +765,7 @@ class ImportXlsx extends ModeleImports
|
|||
} elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) {
|
||||
// If test is just a static regex
|
||||
//if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."<br>";
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]);
|
||||
$this->errors[$error]['type'] = 'REGEX';
|
||||
$errorforthistable++;
|
||||
|
|
@ -771,6 +776,7 @@ class ImportXlsx extends ModeleImports
|
|||
// Check HTML injection
|
||||
$inj = testSqlAndScriptInject($newval, 0);
|
||||
if ($inj) {
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorHtmlInjectionForField', $key, dol_trunc($newval, 100));
|
||||
$this->errors[$error]['type'] = 'HTMLINJECTION';
|
||||
$errorforthistable++;
|
||||
|
|
@ -892,7 +898,7 @@ class ImportXlsx extends ModeleImports
|
|||
$fname = 'rowid';
|
||||
if (strpos($tablename, '_categorie_') !== false) {
|
||||
$is_table_category_link = true;
|
||||
$fname='*';
|
||||
$fname = '*';
|
||||
}
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
);
|
||||
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters = array('file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$substitutionarray);
|
||||
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$substitutionarray);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Line of free text
|
||||
|
|
@ -412,9 +412,10 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
|
||||
include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
|
||||
$companybankaccount = new CompanyBankAccount($this->db);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$companybankaccount->fetch(0, $object->thirdparty->id);
|
||||
$array_objet['company_default_bank_iban']=$companybankaccount->iban;
|
||||
$array_objet['company_default_bank_bic']=$companybankaccount->bic;
|
||||
$array_objet['company_default_bank_iban'] = $companybankaccount->iban;
|
||||
$array_objet['company_default_bank_bic'] = $companybankaccount->bic;
|
||||
|
||||
// retrieve contact information for use in object as contact_xxx tags
|
||||
$array_thirdparty_contact = array();
|
||||
|
|
@ -426,7 +427,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||
|
||||
// Call the ODTSubstitution hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
foreach ($tmparray as $key => $value) {
|
||||
|
|
@ -464,7 +465,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
$tmparray = $this->get_substitutionarray_lines($line, $outputlangs, $linenumber);
|
||||
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||
// Call the ODTSubstitutionLine hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray, 'line'=>$line);
|
||||
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray, 'line' => $line);
|
||||
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
foreach ($tmparray as $key => $val) {
|
||||
try {
|
||||
|
|
@ -496,7 +497,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
}
|
||||
|
||||
// Call the beforeODTSave hook
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('beforeODTSave', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
// Write new file
|
||||
|
|
@ -517,14 +518,14 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
|
||||
$parameters = array('odfHandler' => &$odfHandler, 'file' => $file, 'object' => $object, 'outputlangs' => $outputlangs, 'substitutionarray' => &$tmparray);
|
||||
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
|
||||
dolChmod($file);
|
||||
|
||||
$odfHandler = null; // Destroy object
|
||||
|
||||
$this->result = array('fullpath'=>$file);
|
||||
$this->result = array('fullpath' => $file);
|
||||
|
||||
return 1; // Success
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||
* @param Object $object Object to show
|
||||
* @param int|float $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return int
|
||||
* @return int|float
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ class pdf_zenith extends ModelePDFSupplierProposal
|
|||
* @param SupplierProposal $object Object to show
|
||||
* @param int|float $posy Y
|
||||
* @param Translate $outputlangs Langs object
|
||||
* @return integer
|
||||
* @return int|float
|
||||
*/
|
||||
protected function _tableau_info(&$pdf, $object, $posy, $outputlangs)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ print "</tr>\n";
|
|||
|
||||
if (isset($extrafields->attributes[$elementtype]['type']) && is_array($extrafields->attributes[$elementtype]['type']) && count($extrafields->attributes[$elementtype]['type'])) {
|
||||
foreach ($extrafields->attributes[$elementtype]['type'] as $key => $value) {
|
||||
/*if (! dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1, 1, '1')) {
|
||||
/*if (! (int) dol_eval($extrafields->attributes[$elementtype]['enabled'][$key], 1, 1, '1')) {
|
||||
// TODO Uncomment this to exclude extrafields of modules not enabled. Add a link to "Show extrafields disabled"
|
||||
// continue;
|
||||
}*/
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ if ($action == 'presend') {
|
|||
$outputlangs = new Translate('', $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
// Load traductions files required by page
|
||||
$outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'members', 'propal', 'products', 'supplier_proposal', 'interventions', 'receptions', 'sendings'));
|
||||
$outputlangs->loadLangs(array('commercial', 'bills', 'orders', 'contracts', 'main', 'members', 'propal', 'products', 'supplier_proposal', 'interventions', 'receptions', 'sendings'));
|
||||
if (!empty($defaulttopiclang)) {
|
||||
$outputlangs->loadLangs(array($defaulttopiclang));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table
|
|||
$arrayfields[$extrafieldsobjectprefix.$key] = array(
|
||||
'label' => $extrafields->attributes[$extrafieldsobjectkey]['label'][$key],
|
||||
'type' => $extrafields->attributes[$extrafieldsobjectkey]['type'][$key],
|
||||
'checked' => ((dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1),
|
||||
'checked' => (((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1, 1, '1') <= 0) ? 0 : 1),
|
||||
'position' => $extrafields->attributes[$extrafieldsobjectkey]['pos'][$key],
|
||||
'enabled' => (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')),
|
||||
'enabled' => (abs((int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['list'][$key], 1)) != 3 && (int) dol_eval($extrafields->attributes[$extrafieldsobjectkey]['perms'][$key], 1, 1, '1')),
|
||||
'langfile' => $extrafields->attributes[$extrafieldsobjectkey]['langfile'][$key],
|
||||
'help' => $extrafields->attributes[$extrafieldsobjectkey]['help'][$key],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
|
|||
// If field is a computed field, we make computation to get value
|
||||
if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) {
|
||||
$objectoffield = $object; //For compatibility with the computed formula
|
||||
$value = dol_eval($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2');
|
||||
$value = dol_eval((int) $extrafields->attributes[$extrafieldsobjectkey]['computed'][$key], 1, 1, '2');
|
||||
if (is_numeric(price2num($value)) && $extrafields->attributes[$extrafieldsobjectkey]['totalizable'][$key]) {
|
||||
$obj->$tmpkey = price2num($value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,15 +74,15 @@ if (empty($reshook) && !empty($object->table_element) && isset($extrafields->att
|
|||
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['enabled'][$tmpkeyextra], 1, 1, '2');
|
||||
}
|
||||
if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra], 1, 1, '2');
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['list'][$tmpkeyextra], 1, 1, '2');
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$tmpkeyextra])) {
|
||||
$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$tmpkeyextra], 1, 1, '2');
|
||||
$perms = (int) dol_eval($extrafields->attributes[$object->table_element]['perms'][$tmpkeyextra], 1, 1, '2');
|
||||
}
|
||||
//print $tmpkeyextra.'-'.$enabled.'-'.$perms.'<br>'."\n";
|
||||
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ $coldisplay++;
|
|||
<td colspan="<?php echo $coldisplay - (!getDolGlobalString('MAIN_VIEW_LINE_NUMBER') ? 0 : 1) ?>"><?php echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?>
|
||||
<?php
|
||||
$prefillDates = false;
|
||||
if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines)) {
|
||||
if (getDolGlobalString('MAIN_FILL_SERVICE_DATES_FROM_LAST_SERVICE_LINE') && !empty($object->lines) && $i > 0) {
|
||||
for ($j = $i - 1; $j >= 0; $j--) {
|
||||
$lastline = $object->lines[$j];
|
||||
if ($lastline->product_type == Product::TYPE_SERVICE && (!empty($lastline->date_start) || !empty($lastline->date_end))) {
|
||||
|
|
|
|||
|
|
@ -399,11 +399,11 @@ class InterfaceTicketEmail extends DolibarrTriggers
|
|||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $value) {
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
|
||||
$enabled = (int) dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1);
|
||||
}
|
||||
$perms = 1;
|
||||
if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) {
|
||||
$perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
|
||||
$perms = (int) dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1);
|
||||
}
|
||||
|
||||
$qualified = true;
|
||||
|
|
|
|||
|
|
@ -501,11 +501,7 @@ class DataPolicyCron
|
|||
}
|
||||
|
||||
if ($action == 'delete') { // If object to clean is not used
|
||||
if ($object->element == 'adherent') {
|
||||
$result = $object->delete($obj->rowid, $user);
|
||||
} else {
|
||||
$result = $object->delete($user);
|
||||
}
|
||||
$result = $object->delete($user);
|
||||
if ($result < 0) {
|
||||
$errormsg = $object->error;
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -293,6 +293,7 @@ if (empty($reshook)) {
|
|||
// Action validation
|
||||
if ($action == 'valid_promesse') {
|
||||
$object->fetch($id);
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
if ($object->valid_promesse($id, $user->id) >= 0) {
|
||||
setEventMessages($langs->trans("DonationValidated", $object->ref), null);
|
||||
$action = '';
|
||||
|
|
|
|||
|
|
@ -317,6 +317,7 @@ class Donations extends DolibarrApi
|
|||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$result = $this->don->valid_promesse($id, DolibarrApiAccess::$user->id, $notrigger);
|
||||
if ($result == 0) {
|
||||
throw new RestException(304, 'Error nothing done. May be object is already validated');
|
||||
|
|
|
|||
|
|
@ -725,6 +725,7 @@ class Don extends CommonObject
|
|||
*/
|
||||
public function setValid($user, $notrigger = 0)
|
||||
{
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
return $this->valid_promesse($this->id, $user->id, $notrigger);
|
||||
}
|
||||
|
||||
|
|
@ -957,7 +958,7 @@ class Don extends CommonObject
|
|||
$result .= $linkend;
|
||||
global $action;
|
||||
$hookmanager->initHooks(array($this->element . 'dao'));
|
||||
$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
|
||||
$parameters = array('id' => $this->id, 'getnomurl' => &$result);
|
||||
$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook > 0) {
|
||||
$result = $hookmanager->resPrint;
|
||||
|
|
|
|||
|
|
@ -38,13 +38,12 @@ function emailcollectorPrepareHead($object)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/admin/emailcollector_card.php", 1).'?id='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/admin/emailcollector_card.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("EmailCollector");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
/*if (isset($object->fields['note_public']) || isset($object->fields['note_private']))
|
||||
{
|
||||
/*if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
|
||||
$nbNote = 0;
|
||||
if (!empty($object->note_private)) $nbNote++;
|
||||
if (!empty($object->note_public)) $nbNote++;
|
||||
|
|
|
|||
|
|
@ -359,13 +359,14 @@ class ConferenceOrBooth extends ActionComm
|
|||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param int $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
* @param User $user User making the delete
|
||||
* @param int $notrigger false=launch triggers after, true=disable triggers
|
||||
* @return int Return integer <0 if KO, >0 if OK
|
||||
*/
|
||||
public function delete($notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
//TODO delete attendees and subscription
|
||||
return parent::delete($notrigger);
|
||||
return parent::delete($user, $notrigger);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ foreach ($object->fields as $key => $val) {
|
|||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
|
||||
'enabled'=>(abs($visible) != 3 && (int) dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=> isset($val['help']) ? $val['help'] : ''
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php
|
||||
/* Copyright (C) ---Put here your own copyright and developer email---
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file lib/eventorganization_conferenceorbooth.lib.php
|
||||
* \file htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php
|
||||
* \ingroup eventorganization
|
||||
* \brief Library files with common functions for ConferenceOrBooth
|
||||
*/
|
||||
|
|
@ -37,18 +38,18 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$withProjectUrl='';
|
||||
if ($with_project>0) {
|
||||
$withProjectUrl = '';
|
||||
if ($with_project > 0) {
|
||||
$withProjectUrl = "&withproject=1";
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_card.php?id='.$object->id.$withProjectUrl;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_card.php?id=' . $object->id . $withProjectUrl;
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
if (getDolGlobalString('MAIN_FEATURES_LEVEL') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
|
||||
$head[$h][0] = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_contact.php?id='.$object->id.$withProjectUrl;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_contact.php?id=' . $object->id . $withProjectUrl;
|
||||
$head[$h][1] = $langs->trans("ContactsAddresses");
|
||||
$head[$h][2] = 'contact';
|
||||
$h++;
|
||||
|
|
@ -82,15 +83,15 @@ function conferenceorboothPrepareHead($object, $with_project = 0)
|
|||
$h++;
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->eventorganization->dir_output."/conferenceorbooth/".dol_sanitizeFileName($object->ref);
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
|
||||
$upload_dir = $conf->eventorganization->dir_output . "/conferenceorbooth/" . dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_document.php", 1).'?id='.$object->id.$withProjectUrl;
|
||||
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorbooth_document.php?id=' . $object->id . $withProjectUrl;
|
||||
$head[$h][1] = $langs->trans('Documents');
|
||||
if (($nbFiles + $nbLinks) > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'document';
|
||||
$h++;
|
||||
|
|
@ -125,22 +126,22 @@ function conferenceorboothProjectPrepareHead($object)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_list.php", 1).'?projectid='.$object->id;
|
||||
$head[$h][0] = DOL_URL_ROOT . 'eventorganization/conferenceorbooth_list.php?projectid=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("ConferenceOrBooth");
|
||||
$head[$h][2] = 'conferenceorbooth';
|
||||
// Enable caching of conf or booth count attendees
|
||||
$nbAttendees = 0;
|
||||
$nbConferenceOrBooth= 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_conferenceorbooth_project_'.$object->id;
|
||||
$nbConferenceOrBooth = 0;
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_conferenceorbooth_project_' . $object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbAttendees = $dataretrieved;
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
|
||||
$conforbooth=new ConferenceOrBooth($db);
|
||||
$result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $object->id).')');
|
||||
if (!is_array($result) && $result<0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorbooth.class.php';
|
||||
$conforbooth = new ConferenceOrBooth($db);
|
||||
$result = $conforbooth->fetchAll('', '', 0, 0, '(t.fk_project:=:' . ((int) $object->id) . ')');
|
||||
if (!is_array($result) && $result < 0) {
|
||||
setEventMessages($conforbooth->error, $conforbooth->errors, 'errors');
|
||||
} else {
|
||||
$nbConferenceOrBooth = count($result);
|
||||
|
|
@ -148,25 +149,25 @@ function conferenceorboothProjectPrepareHead($object)
|
|||
dol_setcache($cachekey, $nbConferenceOrBooth, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
if ($nbConferenceOrBooth > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbConferenceOrBooth.'</span>';
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbConferenceOrBooth . '</span>';
|
||||
}
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorboothattendee_list.php", 1).'?fk_project='.$object->id.'&withproject=1';
|
||||
$head[$h][0] = DOL_URL_ROOT . '/eventorganization/conferenceorboothattendee_list.php?fk_project=' . $object->id . '&withproject=1';
|
||||
$head[$h][1] = $langs->trans("Attendees");
|
||||
$head[$h][2] = 'attendees';
|
||||
// Enable caching of conf or booth count attendees
|
||||
$nbAttendees = 0;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_attendees_conferenceorbooth_project_'.$object->id;
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
|
||||
$cachekey = 'count_attendees_conferenceorbooth_project_' . $object->id;
|
||||
$dataretrieved = dol_getcache($cachekey);
|
||||
if (!is_null($dataretrieved)) {
|
||||
$nbAttendees = $dataretrieved;
|
||||
} else {
|
||||
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorboothattendee.class.php';
|
||||
$attendees=new ConferenceOrBoothAttendee($db);
|
||||
$result = $attendees->fetchAll('', '', 0, 0, '(t.fk_project:=:'.((int) $object->id).')');
|
||||
if (!is_array($result) && $result<0) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/eventorganization/class/conferenceorboothattendee.class.php';
|
||||
$attendees = new ConferenceOrBoothAttendee($db);
|
||||
$result = $attendees->fetchAll('', '', 0, 0, '(t.fk_project:=:' . ((int) $object->id) . ')');
|
||||
if (!is_array($result) && $result < 0) {
|
||||
setEventMessages($attendees->error, $attendees->errors, 'errors');
|
||||
} else {
|
||||
$nbAttendees = count($result);
|
||||
|
|
@ -174,7 +175,7 @@ function conferenceorboothProjectPrepareHead($object)
|
|||
dol_setcache($cachekey, $nbAttendees, 120); // If setting cache fails, this is not a problem, so we do not test result.
|
||||
}
|
||||
if ($nbAttendees > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbAttendees.'</span>';
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbAttendees . '</span>';
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'conferenceorboothproject@eventorganization');
|
||||
|
|
@ -200,7 +201,7 @@ function conferenceorboothAttendeePrepareHead($object)
|
|||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/eventorganization/conferenceorboothattendee_card.php?id=".((int) $object->id).($object->fk_actioncomm > 0 ? '&conforboothid='.((int) $object->fk_actioncomm) : '').($object->fk_project > 0 ? '&withproject=1&fk_project='.((int) $object->fk_project) : '');
|
||||
$head[$h][0] = DOL_URL_ROOT . "/eventorganization/conferenceorboothattendee_card.php?id=" . ((int) $object->id) . ($object->fk_actioncomm > 0 ? '&conforboothid=' . ((int) $object->fk_actioncomm) : '') . ($object->fk_project > 0 ? '&withproject=1&fk_project=' . ((int) $object->fk_project) : '');
|
||||
$head[$h][1] = $langs->trans("Card");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
} elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('expedition', 'supprimer')) {
|
||||
$also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0);
|
||||
$result = $object->delete(0, $also_update_stock);
|
||||
$result = $object->delete($user, 0, $also_update_stock);
|
||||
if ($result > 0) {
|
||||
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
|
||||
exit;
|
||||
|
|
@ -2763,7 +2763,7 @@ if ($action == 'create') {
|
|||
|
||||
// Presend form
|
||||
$modelmail = 'shipping_send';
|
||||
$defaulttopic = $langs->trans('SendShippingRef');
|
||||
$defaulttopic = 'SendShippingRef';
|
||||
$diroutput = $conf->expedition->dir_output.'/sending';
|
||||
$trackid = 'shi'.$object->id;
|
||||
|
||||
|
|
|
|||
|
|
@ -1242,7 +1242,7 @@ class Expedition extends CommonObject
|
|||
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
// we do not log origin because it will be deleted
|
||||
$mouvS->origin = null;
|
||||
$mouvS->origin = '';
|
||||
// get lot/serial
|
||||
$lotArray = null;
|
||||
if (isModEnabled('productbatch')) {
|
||||
|
|
@ -1376,13 +1376,18 @@ class Expedition extends CommonObject
|
|||
* Delete shipment.
|
||||
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
|
||||
*
|
||||
* @param int $notrigger Disable triggers
|
||||
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||
* @param User $user User making the deletion
|
||||
* @param int $notrigger Disable triggers
|
||||
* @param bool $also_update_stock true if the stock should be increased back (false by default)
|
||||
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
|
||||
*/
|
||||
public function delete($notrigger = 0, $also_update_stock = false)
|
||||
public function delete($user = null, $notrigger = 0, $also_update_stock = false)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
global $conf, $langs;
|
||||
|
||||
if (empty($user)) {
|
||||
global $user;
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
|
@ -1435,7 +1440,7 @@ class Expedition extends CommonObject
|
|||
|
||||
$mouvS = new MouvementStock($this->db);
|
||||
// we do not log origin because it will be deleted
|
||||
$mouvS->origin = null;
|
||||
$mouvS->origin = '';
|
||||
// get lot/serial
|
||||
$lotArray = $shipmentlinebatch->fetchAll($obj->expeditiondet_id);
|
||||
if (!is_array($lotArray)) {
|
||||
|
|
|
|||
|
|
@ -764,7 +764,7 @@ class Export
|
|||
// Export of compute field does not work. $obj contains $obj->alias_field and formula may contains $obj->field
|
||||
// Also the formula may contains objects of class that are not loaded.
|
||||
$computestring = $this->array_export_special[$indice][$key];
|
||||
//$tmp = dol_eval($computestring, 1, 0, '1');
|
||||
//$tmp = (string) dol_eval($computestring, 1, 0, '2');
|
||||
//$obj->$alias = $tmp;
|
||||
|
||||
$this->error = "ERROPNOTSUPPORTED. Operation ".$computestring." not supported. Export of 'computed' extrafields is not yet supported, please remove field.";
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ $entitytoicon = array(
|
|||
'other' => 'generic',
|
||||
'account' => 'account',
|
||||
'product' => 'product',
|
||||
'virtualproduct'=>'product',
|
||||
'virtualproduct' => 'product',
|
||||
'subproduct' => 'product',
|
||||
'product_supplier_ref' => 'product',
|
||||
'stock' => 'stock',
|
||||
|
|
@ -67,11 +67,11 @@ $entitytoicon = array(
|
|||
'stockbatch' => 'stock',
|
||||
'category' => 'category',
|
||||
'shipment' => 'sending',
|
||||
'shipment_line'=> 'sending',
|
||||
'reception'=> 'sending',
|
||||
'reception_line'=> 'sending',
|
||||
'expensereport'=> 'trip',
|
||||
'expensereport_line'=> 'trip',
|
||||
'shipment_line' => 'sending',
|
||||
'reception' => 'sending',
|
||||
'reception_line' => 'sending',
|
||||
'expensereport' => 'trip',
|
||||
'expensereport_line' => 'trip',
|
||||
'holiday' => 'holiday',
|
||||
'contract_line' => 'contract',
|
||||
'translation' => 'generic',
|
||||
|
|
@ -114,16 +114,16 @@ $entitytolang = array(
|
|||
'other' => 'Other',
|
||||
'trip' => 'TripsAndExpenses',
|
||||
'shipment' => 'Shipments',
|
||||
'shipment_line'=> 'ShipmentLine',
|
||||
'shipment_line' => 'ShipmentLine',
|
||||
'project' => 'Projects',
|
||||
'projecttask' => 'Tasks',
|
||||
'task_time' => 'TaskTimeSpent',
|
||||
'action' => 'Event',
|
||||
'expensereport'=> 'ExpenseReport',
|
||||
'expensereport_line'=> 'ExpenseReportLine',
|
||||
'expensereport' => 'ExpenseReport',
|
||||
'expensereport_line' => 'ExpenseReportLine',
|
||||
'holiday' => 'TitreRequestCP',
|
||||
'contract' => 'Contract',
|
||||
'contract_line'=> 'ContractLine',
|
||||
'contract_line' => 'ContractLine',
|
||||
'translation' => 'Translation',
|
||||
'bom' => 'BOM',
|
||||
'bomline' => 'BOMLine',
|
||||
|
|
@ -1020,7 +1020,7 @@ if ($step == 4 && $datatoexport) {
|
|||
print '<tr class="oddeven">';
|
||||
print '<td><input name="export_name" value=""></td>';
|
||||
print '<td>';
|
||||
$arrayvisibility = array('private'=>$langs->trans("Private"), 'all'=>$langs->trans("Everybody"));
|
||||
$arrayvisibility = array('private' => $langs->trans("Private"), 'all' => $langs->trans("Everybody"));
|
||||
print $form->selectarray('visibility', $arrayvisibility, 'private');
|
||||
print '</td>';
|
||||
print '<td class="right">';
|
||||
|
|
@ -1203,6 +1203,7 @@ if ($step == 5 && $datatoexport) {
|
|||
$htmltabloflibs .= '<td>'.img_picto_common($key, $objmodelexport->getPictoForKey($key)).' ';
|
||||
$text = $objmodelexport->getDriverDescForKey($key);
|
||||
$label = $listeall[$key];
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
$htmltabloflibs .= $form->textwithpicto($label, $text).'</td>';
|
||||
$htmltabloflibs .= '<td>'.$objmodelexport->getLibLabelForKey($key).'</td>';
|
||||
$htmltabloflibs .= '<td class="right">'.$objmodelexport->getLibVersionForKey($key).'</td>';
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ foreach ($liste as $key => $val) {
|
|||
print '<td width="16">'.img_picto_common($model->getDriverLabelForKey($key), $model->getPictoForKey($key)).'</td>';
|
||||
$text = $model->getDriverDescForKey($key);
|
||||
$label = $liste[$key];
|
||||
// @phan-suppress-next-line PhanPluginSuspiciousParamPosition
|
||||
print '<td>'.$form->textwithpicto($label, $text).'</td>';
|
||||
print '<td>'.$model->getLibLabelForKey($key).'</td>';
|
||||
print '<td class="nowrap right">'.$model->getLibVersionForKey($key).'</td>';
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue