FIX resolve conflicts

This commit is contained in:
lvessiller 2022-04-15 09:25:13 +02:00
commit c8bec685a9
40 changed files with 672 additions and 243 deletions

View File

@ -16,57 +16,57 @@ Voici la liste des codes pays ou systeme :
EN
==
Meaning of the numbers.
Meaning of the numbers:
- 2 digits for the country code or system code
- first 2-3 digits for the country code or system code
- 5 digits for the company identifier
- 5 digits for item identifier
- 1 digit for checksum
This rule has been twisted many times to improve the use of the available numbers.
Here is the list of country codes or system:
Here is the list of country codes or system:
List
====
00 <EFBFBD> 13 UCC (Etats-Unis et Canada)
20 <EFBFBD> 29 Codification interne en magasin
30 <EFBFBD> 37 GENCOD-EAN France
380 BCCI (Bulgarie)
383 SANA (Slovenie)
385 CRO-EAN (Croatie)
387 EAN-BIH (Bosnie-Herzegovine)
400 <20> 440 CCG (Allemagne)
45 + 49 Distribution Code Center <20> DCC (Japon)
460 <20> 469 UNISCAN - EAN Russie (Federation de Russie)
471 CAN (Taiwan)
474 EAN Estonie
475 EAN Lettonie
476 EAN Azerba<62> djan
477 EAN Lituanie
478 EAN Ouzbekistan
479 EAN Sri Lanka
480 PANC (Philippines)
481 EAN Bielorussie
482 EAN Ukraine
484 EAN Moldavie
485 EAN Armenie
486 EAN Georgie
487 EAN Kazakhstan
489 HKANA (Hong Kong)
50 E Centre UK
00 - 13 UCC (U.S.A / États-Unis & Canada)
20 - 29 Flag for internal numbering / Codification interne en magasin
30 - 37 GENCOD-EAN France
380 BCCI (Bulgaria)
383 SANA (Slovenia)
385 CRO-EAN (Croatia)
387 EAN-BIH (Bosnia-Herzegovina)
400-440 CCG (Allemagne/Germany)
45 + 49 Distribution Code Center - DCC (Japan)
460-469 UNISCAN - EAN Russia (Federation de Russie)
471 CAN Taiwan
474 EAN Estonia
475 EAN Latvia
476 EAN Azerbaijan
477 EAN Lithuania
478 EAN Uzbekistan
479 EAN Sri Lanka
480 PANC Philippines
481 EAN Belarus
482 EAN Ukraine
484 EAN Moldova
485 EAN Armenia
486 EAN Georgia
487 EAN Kazakhstan
489 HKANA Hong Kong
50 E Centre UK - United Kingdom
520 HELLCAN-EAN HELLAS (Grece)
528 EAN Liban
529 EAN Chypre
531 EAN-MAC (FYR Mac<EFBFBD>donie)
531 EAN-MAC (FYR Macedonie)
535 EAN Malte
539 EAN Irlande
54 ICODIF/EAN Belgique. Luxembourg
54 ICODIF/EAN Belgique. Luxembourg
560 CODIPOR (Portugal)
569 EAN Islande
57 EAN Danemark
57 EAN Danemark
590 EAN Pologne
594 EAN Roumanie
599 H.A.P.M.H. (Hongrie)

View File

@ -482,7 +482,7 @@ if (GETPOSTISSET("search_status")) {
$titre = $langs->trans("MembersListToValid");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == '') {
$titre = $langs->trans("MembersValidated");
$titre = $langs->trans("MenuMembersValidated");
}
if ($search_status == Adherent::STATUS_VALIDATED && $filter == 'withoutsubscription') {
$titre = $langs->trans("MembersWithSubscriptionToReceive");

View File

@ -309,7 +309,7 @@ print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Par
// Show sender name
/* Set option as hidden because no need of this for 99.99% of users.
/* Set option as hidden because no need of this for 99.99% of users. Having it as hidden feature is enough.
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_PDF_HIDE_SENDER_NAME").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_HIDE_SENDER_NAME');
@ -321,7 +321,7 @@ print '</td></tr>';
// Hide VAT Intra on address
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").'</td><td>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowVATIntaInAddress").' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_TVAINTRA_NOT_IN_ADDRESS');
} else {
@ -340,7 +340,7 @@ for ($i = 1; $i <= 6; $i++) {
$pid = img_warning().' <span class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).'</span>';
}
if ($pid) {
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.'</td><td>';
print '<tr class="oddeven"><td>'.$langs->trans("ShowProfIdInAddress").' - '.$pid.' - <span class="opacitymedium">'.$langs->trans("ThirdPartyAddress").'</span></td><td>';
$keyforconstant = 'MAIN_PROFID'.$i.'_IN_ADDRESS';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff($keyforconstant);

View File

@ -458,6 +458,20 @@ class Documents extends DolibarrApi
}
$upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref);
} elseif ($modulepart == 'knowledgemanagement') {
require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php';
if (!DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read && !DolibarrApiAccess::$user->rights->knowledgemanagement->knowledgerecord->read) {
throw new RestException(401);
}
$object = new KnowledgeRecord($this->db);
$result = $object->fetch($id, $ref);
if (!$result) {
throw new RestException(404, 'KM article not found');
}
$upload_dir = $conf->knowledgemanagement->dir_output.'/knowledgerecord/'.dol_sanitizeFileName($object->ref);
} elseif ($modulepart == 'categorie' || $modulepart == 'category') {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';

View File

@ -1921,7 +1921,7 @@ if ($action == 'create') {
$formquestion = array(
// 'text' => $langs->trans("ConfirmClone"),
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')),
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300')),
array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans('PuttingPricesUpToDate'), 'value' => (!empty($conf->global->PROPOSAL_CLONE_UPDATE_PRICES) ? 1 : 0)),
);
if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) {

View File

@ -123,6 +123,15 @@ $search_fk_input_reason = GETPOST("search_fk_input_reason", 'int');
$search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int');
$search_btn = GETPOST('button_search', 'alpha');
$search_remove_btn = GETPOST('button_removefilter', 'alpha');
$search_date_signature_startday = GETPOST('search_date_signature_startday', 'int');
$search_date_signature_startmonth = GETPOST('search_date_signature_startmonth', 'int');
$search_date_signature_startyear = GETPOST('search_date_signature_startyear', 'int');
$search_date_signature_endday = GETPOST('search_date_signature_endday', 'int');
$search_date_signature_endmonth = GETPOST('search_date_signature_endmonth', 'int');
$search_date_signature_endyear = GETPOST('search_date_signature_endyear', 'int');
$search_date_signature_start = dol_mktime(0, 0, 0, $search_date_signature_startmonth, $search_date_signature_startday, $search_date_signature_startyear);
$search_date_signature_end = dol_mktime(23, 59, 59, $search_date_signature_endmonth, $search_date_signature_endday, $search_date_signature_endyear);
$search_status = GETPOST('search_status', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
@ -207,6 +216,7 @@ $arrayfields = array(
'p.date'=>array('label'=>"DatePropal", 'checked'=>1),
'p.fin_validite'=>array('label'=>"DateEnd", 'checked'=>1),
'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0),
'p.date_signature'=>array('label'=>"DateSigning", 'checked'=>0),
'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0),
'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)),
'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1),
@ -337,6 +347,14 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_fk_shipping_method = '';
$search_fk_input_reason = '';
$search_fk_mode_reglement = '';
$search_date_signature_startday = '';
$search_date_signature_startmonth = '';
$search_date_signature_startyear = '';
$search_date_signature_endday = '';
$search_date_signature_endmonth = '';
$search_date_signature_endyear = '';
$search_date_signature_start = '';
$search_date_signature_end = '';
}
if ($object_statut != '') {
$search_status = $object_statut;
@ -517,6 +535,7 @@ $sql .= " state.code_departement as state_code, state.nom as state_name,";
$sql .= ' p.rowid, p.entity as propal_entity, p.note_private, p.total_ht, p.total_tva, p.total_ttc, p.localtax1, p.localtax2, p.ref, p.ref_client, p.fk_statut as status, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,p.date_livraison as ddelivery,';
$sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,';
$sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,';
$sql .= ' p.date_signature as dsignature,';
$sql .= ' p.note_public, p.note_private,';
$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,';
$sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,";
@ -701,6 +720,12 @@ if ($search_sale > 0) {
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)."'";
}
if ($search_date_signature_end) {
$sql .= " AND p.date_signature <= '".$db->idate($search_date_signature_end)."'";
}
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@ -917,6 +942,24 @@ if ($resql) {
if ($search_country) {
$param .= '&search_country='.urlencode($search_country);
}
if ($search_date_signature_startday) {
$param .= '&search_date_signature_startday='.urlencode($search_date_signature_startday);
}
if ($search_date_signature_startmonth) {
$param .= '&search_date_signature_startmonth='.urlencode($search_date_signature_startmonth);
}
if ($search_date_signature_startyear) {
$param .= '&search_date_signature_startyear='.urlencode($search_date_signature_startyear);
}
if ($search_date_signature_endday) {
$param .= '&search_date_signature_endday='.urlencode($search_date_signature_endday);
}
if ($search_date_signature_endmonth) {
$param .= '&search_date_signature_endmonth='.urlencode($search_date_signature_endmonth);
}
if ($search_date_signature_endyear) {
$param .= '&search_date_signature_endyear='.urlencode($search_date_signature_endyear);
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -1148,6 +1191,17 @@ if ($resql) {
print '</div>';
print '</td>';
}
// Date Signature
if (!empty($arrayfields['p.date_signature']['checked'])) {
print '<td class="liste_titre center">';
print '<div class="nowrap">';
print $form->selectDate($search_date_signature_start ? $search_date_signature_start : -1, 'search_date_signature_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrap">';
print $form->selectDate($search_date_signature_end ? $search_date_signature_end : -1, 'search_date_signature_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '</td>';
}
// Availability
if (!empty($arrayfields['ava.rowid']['checked'])) {
print '<td class="liste_titre maxwidth100onsmartphone center">';
@ -1361,7 +1415,10 @@ if ($resql) {
print_liste_field_titre($arrayfields['p.fin_validite']['label'], $_SERVER["PHP_SELF"], 'dfv', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date_livraison']['checked'])) {
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'ddelivery', '', $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre($arrayfields['p.date_livraison']['label'], $_SERVER["PHP_SELF"], 'p.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['p.date_signature']['checked'])) {
print_liste_field_titre($arrayfields['p.date_signature']['label'], $_SERVER["PHP_SELF"], 'p.date_signature', '', $param, 'align="center"', $sortfield, $sortorder);
}
if (!empty($arrayfields['ava.rowid']['checked'])) {
print_liste_field_titre($arrayfields['ava.rowid']['label'], $_SERVER["PHP_SELF"], 'availability', '', $param, '', $sortfield, $sortorder);
@ -1720,6 +1777,18 @@ if ($resql) {
$totalarray['nbfield']++;
}
}
// Date Signature
if (!empty($arrayfields['p.date_signature']['checked'])) {
if ($obj->dsignature) {
print '<td class="center">'.dol_print_date($db->jdate($obj->dsignature), 'day');
print '</td>';
} else {
print '<td>&nbsp;</td>';
}
if (!$i) {
$totalarray['nbfield']++;
}
}
// Availability
if (!empty($arrayfields['ava.rowid']['checked'])) {
print '<td class="center">';

View File

@ -2043,7 +2043,7 @@ if ($action == 'create' && $usercancreate) {
if ($action == 'clone') {
// Create an array for form
$formquestion = array(
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)'))
array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client = 2 OR s.client=3)', '', 0, 0, null, 0, 'maxwidth300'))
);
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneOrder', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
}

View File

@ -125,6 +125,7 @@ class Tva extends CommonObject
// Insert request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."tva(";
$sql .= "entity,";
$sql .= "datec,";
$sql .= "datep,";
$sql .= "datev,";
@ -136,6 +137,7 @@ class Tva extends CommonObject
$sql .= "fk_user_creat,";
$sql .= "fk_user_modif";
$sql .= ") VALUES (";
$sql .= " ".((int) $conf->entity).", ";
$sql .= " '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datep)."',";
$sql .= " '".$this->db->idate($this->datev)."',";
@ -144,8 +146,8 @@ class Tva extends CommonObject
$sql .= " '".$this->db->escape($this->note)."',";
$sql .= " '".$this->db->escape($this->fk_account)."',";
$sql .= " '".$this->db->escape($this->type_payment)."',";
$sql .= " '".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id)."',";
$sql .= " '".$this->db->escape($this->fk_user_modif)."'";
$sql .= " ".($this->fk_user_creat > 0 ? (int) $this->fk_user_creat : (int) $user->id).",";
$sql .= " ".($this->fk_user_modif > 0 ? (int) $this->fk_user_modif : (int) $user->id);
$sql .= ")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);

View File

@ -1602,6 +1602,44 @@ if (!$error && ($massaction == 'disable' || ($action == 'disable' && $confirm ==
}
}
if (!$error && ($massaction == 'affectcommercial' || ($action == 'affectcommercial' && $confirm == 'yes')) && $permissiontoadd) {
$db->begin();
$objecttmp = new $objectclass($db);
$nbok = 0;
foreach ($toselect as $toselectid) {
$result = $objecttmp->fetch($toselectid);
if ($result>0) {
if (in_array($objecttmp->element, array('societe'))) {
$result = $objecttmp->setSalesRep(GETPOST("commercial", "alpha"));
}
if ($result <= 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
} else {
$nbok++;
}
} else {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
$error++;
break;
}
}
if (!$error) {
if ($nbok > 1) {
setEventMessages($langs->trans("CommercialsAffected", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("CommercialAffected"), null, 'mesgs');
}
$db->commit();
} else {
$db->rollback();
}
}
// Approve for leave only
if (!$error && ($massaction == 'approveleave' || ($action == 'approveleave' && $confirm == 'yes')) && $permissiontoapprove) {
$db->begin();

View File

@ -48,6 +48,10 @@ if (!defined('NOIPCHECK')) {
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
}
include '../../main.inc.php';
$action = GETPOST('action', 'aZ09');

View File

@ -217,7 +217,15 @@ if ($massaction == 'preenable') {
if ($massaction == 'predisable') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1);
}
if ($massaction == 'presetcommercial') {
$formquestion = array();
$userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
$formquestion[] = array('type' => 'other',
'name' => 'affectedcommercial',
'label' => $form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0),
'value' => $form->multiselectarray('commercial', $userlist, null, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1));
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmAllocateCommercial"), $langs->trans("ConfirmAllocateCommercialQuestion", count($toselect)), "affectcommercial", $formquestion, 1, 0, 200, 500, 1);
}
if ($massaction == 'preapproveleave') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1);
}

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010 Pierre Morin <pierre.morin@auguria.net>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -163,6 +164,11 @@ if (!empty($hashp)) {
$modulepart = $moduleparttocheck;
$original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir
}
$entity = $ecmfile->entity;
if ($entity != $conf->entity) {
$conf->entity = $entity;
$conf->setValues($db);
}
} else {
$langs->load("errors");
accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1);

View File

@ -426,7 +426,7 @@ class Fichinter extends CommonObject
$sql .= " f.datec, f.dateo, f.datee, f.datet, f.fk_user_author,";
$sql .= " f.date_valid as datev,";
$sql .= " f.tms as datem,";
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat";
$sql .= " f.duree, f.fk_projet as fk_project, f.note_public, f.note_private, f.model_pdf, f.extraparams, fk_contrat, f.entity as entity";
$sql .= " FROM ".MAIN_DB_PREFIX."fichinter as f";
if ($ref) {
$sql .= " WHERE f.entity IN (".getEntity('intervention').")";
@ -459,6 +459,7 @@ class Fichinter extends CommonObject
$this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; // deprecated
$this->fk_contrat = $obj->fk_contrat;
$this->entity = $obj->entity;
$this->user_creation = $obj->fk_user_author;

View File

@ -136,14 +136,13 @@ $step = (GETPOST('step') ? GETPOST('step') : 1);
$import_name = GETPOST('import_name');
$hexa = GETPOST('hexa');
$importmodelid = GETPOST('importmodelid');
$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 2);
$excludefirstline = (GETPOST('excludefirstline') ? GETPOST('excludefirstline') : 1);
$endatlinenb = (GETPOST('endatlinenb') ? GETPOST('endatlinenb') : '');
$updatekeys = (GETPOST('updatekeys', 'array') ? GETPOST('updatekeys', 'array') : array());
$separator = (GETPOST('separator', 'nohtml') ? GETPOST('separator', 'nohtml') : (!empty($conf->global->IMPORT_CSV_SEPARATOR_TO_USE) ? $conf->global->IMPORT_CSV_SEPARATOR_TO_USE : ','));
$enclosure = (GETPOST('enclosure', 'nohtml') ? GETPOST('enclosure', 'nohtml') : '"');
$separator_used = str_replace('\t', "\t", $separator);
$objimport = new Import($db);
$objimport->load_arrays($user, ($step == 1 ? '' : $datatoimport));
@ -161,7 +160,7 @@ foreach ($fieldsarray as $elem) {
$tabelem = explode('=', $elem, 2);
$key = $tabelem[0];
$val = (isset($tabelem[1]) ? $tabelem[1] : '');
if ($key && $val && ($key > 0 && $step != 4)) {
if ($key && $val) {
$array_match_file_to_database[$key] = $val;
}
}
@ -326,16 +325,13 @@ if ($action == 'saveorder') {
$pos = 0;
foreach ($fieldsarray as $fieldnb) { // For each elem in list. fieldnb start from 1 to ...
// Get name of database fields at position $pos and put it into $namefield
$posbis = 0;
$namefield = '';
$posbis = 0; $namefield = '';
foreach ($fieldstarget as $key => $val) { // key: val:
//dol_syslog('AjaxImport key='.$key.' val='.$val);
if ($posbis < $pos) {
$posbis++;
continue;
}
// We found the key of targets that is at position pos
$namefield = $key;
//dol_syslog('AjaxImport Field name found for file field nb '.$fieldnb.'='.$namefield);
@ -1008,7 +1004,7 @@ if ($step == 4 && $datatoimport) {
$lefti = 1;
foreach ($array_match_file_to_database as $key => $val) {
$var = !$var;
show_elem($fieldssource, $key, $val, $var, 1, '', $listofkeys); // key is field number in source file
show_elem($fieldssource, $key, $val, $var); // key is field number in source file
//print '> '.$lefti.'-'.$key.'-'.$val;
$listofkeys[$key] = 1;
$fieldsplaced[$key] = 1;
@ -1027,7 +1023,7 @@ if ($step == 4 && $datatoimport) {
while ($lefti <= $num) {
$var = !$var;
$newkey = getnewkey($fieldssource, $listofkeys);
show_elem($fieldssource, $newkey, '', $var, 1, '', $listofkeys); // key start after field number in source file
show_elem($fieldssource, $newkey, '', $var); // key start after field number in source file
//print '> '.$lefti.'-'.$newkey;
$listofkeys[$key] = 1;
$lefti++;
@ -1041,14 +1037,11 @@ if ($step == 4 && $datatoimport) {
print '</td><td width="50%">';
// List of target fields
// $height = '24px'; //needs px for css height attribute below
$height = '30px';
$height = '24px'; //needs px for css height attribute below
$i = 0;
$mandatoryfieldshavesource = true;
$fieldselect = 1;
print '<table width="100%" class="nobordernopadding">';
$pos = 1;
print '<table width="100%" class="nobordernopadding">';
foreach ($fieldstarget as $code => $label) {
print '<tr class="oddeven" style="height:'.$height.'">';
@ -1058,7 +1051,7 @@ if ($step == 4 && $datatoimport) {
$tablealias = preg_replace('/(\..*)$/i', '', $code);
$tablename = $objimport->array_import_tables[0][$tablealias];
$entityicon = !empty($entitytoicon[$entity]) ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
$entityicon = $entitytoicon[$entity] ? $entitytoicon[$entity] : $entity; // $entityicon must string name of picto of the field like 'project', 'company', 'contact', 'modulename', ...
$entitylang = $entitytolang[$entity] ? $entitytolang[$entity] : $objimport->array_import_label[0]; // $entitylang must be a translation key to describe object the field is related to, like 'Company', 'Contact', 'MyModyle', ...
print '<td class="nowraponall" style="font-weight: normal">=>'.img_object('', $entityicon).' '.$langs->trans($entitylang).'</td>';
@ -1078,7 +1071,7 @@ if ($step == 4 && $datatoimport) {
print '</td>';
// Info field
print '<td class="nowraponall" style="font-weight:normal; text-align:right">';
$filecolumn = !empty($array_match_database_to_file[$code])?$array_match_database_to_file[$code]:0;
$filecolumn = $array_match_database_to_file[$code];
// Source field info
$htmltext = '<b><u>'.$langs->trans("FieldSource").'</u></b><br>';
if ($filecolumn > count($fieldssource)) {
@ -1098,7 +1091,7 @@ if ($step == 4 && $datatoimport) {
}
// Source required
$htmltext .= $langs->trans("SourceRequired").': <b>'.yn(preg_match('/\*$/', $label)).'</b><br>';
$example = !empty($objimport->array_import_examplevalues[0][$code])?$objimport->array_import_examplevalues[0][$code]:"";
$example = $objimport->array_import_examplevalues[0][$code];
// Example
if (empty($objimport->array_import_convertvalue[0][$code])) { // If source file does not need convertion
if ($example) {
@ -1136,7 +1129,6 @@ if ($step == 4 && $datatoimport) {
print '</td>';
print '</tr>';
$fieldselect++;
}
print '</table>';
@ -1155,7 +1147,7 @@ if ($step == 4 && $datatoimport) {
if (empty($fieldsplaced[$key])) {
//
$nbofnotimportedfields++;
show_elem($fieldssource, $key, '', $var, 0, 'nostyle', $listofkeys);
show_elem($fieldssource, $key, '', $var, 'nostyle');
//print '> '.$lefti.'-'.$key;
$listofkeys[$key] = 1;
$lefti++;
@ -1164,7 +1156,7 @@ if ($step == 4 && $datatoimport) {
// Print one more empty field
$newkey = getnewkey($fieldssource, $listofkeys);
show_elem($fieldssource, $newkey, '', $var, 1, 'nostyle', $listofkeys);
show_elem($fieldssource, $newkey, '', $var, 'nostyle');
//print '> '.$lefti.'-'.$newkey;
$listofkeys[$newkey] = 1;
$nbofnotimportedfields++;
@ -1177,7 +1169,7 @@ if ($step == 4 && $datatoimport) {
$i = 0;
while ($i < $nbofnotimportedfields) {
// Print empty cells
show_elem('', '', 'none', $var, 0, 'nostyle', $listofkeys);
show_elem('', '', 'none', $var, 'nostyle');
$i++;
}
print '</td></tr>';
@ -1188,51 +1180,35 @@ if ($step == 4 && $datatoimport) {
if ($conf->use_javascript_ajax) {
print '<script type="text/javascript">';
// print 'jQuery(function() {
// jQuery("#left, #right").sortable({
// /* placeholder: \'ui-state-highlight\', */
// handle: \'.boxhandle\',
// revert: \'invalid\',
// items: \'.box\',
// containment: \'.fiche\',
// connectWith: \'.connectedSortable\',
// stop: function(event, ui) {
// updateOrder();
// }
// });
// });
// ';
print '$(".import_select").on("change",function(){
updateOrder2();
})';
print 'jQuery(function() {
jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */
handle: \'.boxhandle\',
revert: \'invalid\',
items: \'.box\',
containment: \'.fiche\',
connectWith: \'.connectedSortable\',
stop: function(event, ui) {
updateOrder();
}
});
});
';
print "\n";
// print 'function updateOrder(){'."\n";
// print 'var left_list = cleanSerialize(jQuery("#left").sortable("serialize" ));'."\n";
// //print 'var right_list = cleanSerialize(jQuery("#right").sortable("serialize" ));'."\n";
// print 'var boxorder = \'A:\' + left_list;'."\n";
// //print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'."\n";
// //print 'alert(\'boxorder=\' + boxorder);';
// //print 'var userid = \''.$user->id.'\';'."\n";
// //print 'var datatoimport = "'.$datatoimport.'";'."\n";
// // print 'jQuery.ajax({ url: "ajaximport.php?step=4&boxorder=" + boxorder + "&userid=" + userid + "&datatoimport=" + datatoimport,
// // async: false
// // });'."\n";
// // Now reload page
// print 'var newlocation= \''.$_SERVER["PHP_SELF"].'?step=4'.$param.'&action=saveorder&token='.newToken().'&boxorder=\' + boxorder;'."\n";
// //print 'alert(newlocation);';
// print 'window.location.href=newlocation;'."\n";
// print '}'."\n";
print 'function updateOrder2(){'."\n";
print 'var tmpboxorder = \'A:\''."\n";
print '$(".import_select").each(function(){'."\n";
print 'tmpboxorder = tmpboxorder + $(this).val() + \',\'';
print '});'."\n";
print 'boxorder = tmpboxorder.slice(0,-1)'."\n";
print 'function updateOrder(){'."\n";
print 'var left_list = cleanSerialize(jQuery("#left").sortable("serialize" ));'."\n";
//print 'var right_list = cleanSerialize(jQuery("#right").sortable("serialize" ));'."\n";
print 'var boxorder = \'A:\' + left_list;'."\n";
//print 'var boxorder = \'A:\' + left_list + \'-B:\' + right_list;'."\n";
//print 'alert(\'boxorder=\' + boxorder);';
//print 'var userid = \''.$user->id.'\';'."\n";
//print 'var datatoimport = "'.$datatoimport.'";'."\n";
// print 'jQuery.ajax({ url: "ajaximport.php?step=4&boxorder=" + boxorder + "&userid=" + userid + "&datatoimport=" + datatoimport,
// async: false
// });'."\n";
// Now reload page
print 'var newlocation= \''.$_SERVER["PHP_SELF"].'?step=4'.$param.'&action=saveorder&token='.newToken().'&boxorder=\' + boxorder;'."\n";
//print 'alert(newlocation);';
print 'window.location.href=newlocation;'."\n";
print '}'."\n";
print '</script>'."\n";
@ -1495,20 +1471,6 @@ if ($step == 5 && $datatoimport) {
if ($action == 'launchsimu') {
print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'?step=5'.$param.'">'.$langs->trans("Modify").'</a>';
}
if ($excludefirstline == 2) {
print $form->textwithpicto("", $langs->trans("WarningFirstImportedLine", $excludefirstline), 1, 'warning', "warningexcludefirstline");
print '<script>
$( document ).ready(function() {
$("input[name=\'excludefirstline\']").on("change",function(){
if($(this).val() <= 1){
$(".warningexcludefirstline").hide();
}else{
$(".warningexcludefirstline").show();
}
})
});
</script>';
}
print '</td></tr>';
// Keys for data UPDATE (not INSERT of new data)
@ -2131,21 +2093,18 @@ $db->close();
/**
* Function to put the movable box of a source field
*
* @param array $fieldssource List of source fields
* @param int $pos Pos
* @param string $key Key
* @param boolean $var Line style (odd or not)
* @param boolean $isimportedfield Verify if it's an imported field
* @param int $nostyle Hide style
* @param array $listofkeys List of keys for select boxes
* @param array $fieldssource List of source fields
* @param int $pos Pos
* @param string $key Key
* @param boolean $var Line style (odd or not)
* @param int $nostyle Hide style
* @return void
*/
function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle = '', &$listofkeys = array())
function show_elem($fieldssource, $pos, $key, $var, $nostyle = '')
{
global $langs, $bc;
// $height = '24px';
$height = '30px';
$height = '24px';
if ($key == 'none') {
//stop multiple duplicate ids with no number
@ -2162,7 +2121,7 @@ function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle =
if ($pos && $pos > count($fieldssource)) { // No fields
print '<tr'.($nostyle ? '' : ' '.$bc[$var]).' style="height:'.$height.'">';
print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
//print img_picto(($pos > 0 ? $langs->trans("MoveField", $pos) : ''), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print img_picto(($pos > 0 ? $langs->trans("MoveField", $pos) : ''), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print '</td>';
print '<td style="font-weight: normal">';
print $langs->trans("NoFields");
@ -2177,65 +2136,22 @@ function show_elem($fieldssource, $pos, $key, $var, $isimportedfield, $nostyle =
print '&nbsp;';
print '</td>';
print '</tr>';
} elseif (empty($isimportedfield)) {
$example = !empty($fieldssource[$pos]['example1'])?$fieldssource[$pos]['example1']:"";
if ($example) {
if (!utf8_check($example)) {
$example = utf8_encode($example);
}
print '<tr'.($nostyle ? '' : ' '.$bc[$var]).' style="height:'.$height.'">';
print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
print '&nbsp;';
print '</td>';
print '<td style="font-weight: normal">';
print $langs->trans("EmptyField").':&nbsp;';
print ' (<i>'.$example.'</i>)';
print '</td>';
print '</tr>';
}
} else {
// Print field of source file
print '<tr'.($nostyle ? '' : ' '.$bc[$var]).' style="height:'.$height.'">';
print '<td class="nocellnopadding" width="16" style="font-weight: normal">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
//print img_picto($langs->trans("MoveField", $pos), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print img_picto($langs->trans("MoveField", $pos), 'grip_title', 'class="boxhandle" style="cursor:move;"');
print '</td>';
print '<td class="nowraponall" width="100" style="font-weight: normal">';
$example = !empty($fieldssource[$pos]['example1'])?$fieldssource[$pos]['example1']:"";
if ($example != "") {
print $langs->trans("Field").' '.$pos.':&nbsp;';
} else {
print $langs->trans("EmptyField").':&nbsp;';
}
print '<td class="nowraponall" style="font-weight: normal">';
print $langs->trans("Field").' '.$pos;
$example = $fieldssource[$pos]['example1'];
if ($example) {
if (!utf8_check($example)) {
$example = utf8_encode($example);
}
}
$nameselect = ($pos > 0) ? $pos : (-$pos);
print '<td class="nowraponall" style="font-weight: normal">';
print '<select class="import_select flat" style="width:100%;" autocomplete="off" name="selectfield_'.$nameselect.'">';
$valueemptyoption = ($pos < 0) ? $pos : (-$pos);
print '<option value="'.$valueemptyoption.'">&nbsp;</option>';
if ($example != "") {
print '<option selected value="'.$pos.'">';
print ' (<i>'.$example.'</i>)';
print '</option>';
}
foreach ($fieldssource as $newkey => $val) {
if (empty($listofkeys[$newkey])) {
$example = $fieldssource[$newkey]['example1'];
if ($example) {
if (!utf8_check($example)) {
$example = utf8_encode($example);
}
print '<option value="'.$newkey.'">';
print ' (<i>'.$example.'</i>)';
print '</option>';
}
}
}
print '</td>';
print '</td>';
print '</tr>';
}

View File

@ -539,5 +539,5 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154,
-- Add column to help to fix a very critical bug when transferring into accounting bank record of a bank account into another currency.
-- Idea is to update this column manually in v15 with value in currency of company for bank that are not into the main currency and the transfer
-- into accounting will use it in priority if value is not null.
-- into accounting will use it in priority if value is not null. The script repair.sql contains the sequence to fix datas in llx_bank.
ALTER TABLE llx_bank ADD COLUMN amount_main_currency double(24,8) NULL;

View File

@ -302,6 +302,9 @@ ALTER TABLE llx_propal ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf;
UPDATE llx_c_country SET eec=0 WHERE eec IS NULL;
ALTER TABLE llx_c_country MODIFY COLUMN eec tinyint DEFAULT 0 NOT NULL;
ALTER TABLE llx_inventorydet ADD COLUMN pmp_real double DEFAULT NULL;
ALTER TABLE llx_inventorydet ADD COLUMN pmp_expected double DEFAULT NULL;
ALTER TABLE llx_chargesociales ADD COLUMN note_private text;
@ -325,4 +328,5 @@ ALTER TABLE llx_actioncomm MODIFY COLUMN note mediumtext;
DELETE FROM llx_boxes WHERE box_id IN (select rowid FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php'));
DELETE FROM llx_boxes_def WHERE file IN ('box_bom.php@bom', 'box_bom.php');
ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);
ALTER TABLE llx_inventory ADD COLUMN fk_categories_product VARCHAR(255) DEFAULT NULL AFTER fk_product;

View File

@ -29,6 +29,8 @@ CREATE TABLE llx_inventorydet
qty_stock double DEFAULT NULL, -- Value or real stock we have, when we start the inventory (may be updated during intermediary steps).
qty_view double DEFAULT NULL, -- Quantity found during inventory. It is the targeted value, filled during edition of inventory.
qty_regulated double DEFAULT NULL, -- Never used. Deprecated because we already have the fk_movement now.
pmp_real double DEFAULT NULL,
pmp_expected double DEFAULT NULL,
fk_movement integer NULL -- can contain the id of stock movement we recorded to make the inventory regulation of this line
)
ENGINE=innodb;

View File

@ -0,0 +1,16 @@
-- Copyright (C) 2018 SuperAdmin
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see https://www.gnu.org/licenses/.
ALTER TABLE llx_takepos_floor_tables ADD UNIQUE(entity,label);

View File

@ -19,6 +19,7 @@ ProspectionArea=Prospection area
IdThirdParty=Id third party
IdCompany=Company Id
IdContact=Contact Id
ThirdPartyAddress=Third-party address
ThirdPartyContacts=Third-party contacts
ThirdPartyContact=Third-party contact/address
Company=Company

View File

@ -8,7 +8,7 @@ ImportableDatas=Importable dataset
SelectExportDataSet=Choose dataset you want to export...
SelectImportDataSet=Choose dataset you want to import...
SelectExportFields=Choose the fields you want to export, or select a predefined export profile
SelectImportFields=Choose the source file fields you want to import and their target field in database by choosing the fields with the select box, or select a predefined import profile:
SelectImportFields=Choose the source file fields you want to import and their target field in database by moving them up and down with anchor %s, or select a predefined import profile:
NotImportedFields=Fields of source file not imported
SaveExportModel=Save your selections as an export profile/template (for reuse).
SaveImportModel=Save this import profile (for reuse) ...
@ -135,5 +135,3 @@ NbInsert=Number of inserted lines: %s
NbUpdate=Number of updated lines: %s
MultipleRecordFoundWithTheseFilters=Multiple records have been found with these filters: %s
StocksWithBatch=Stocks and location (warehouse) of products with batch/serial number
WarningFirstImportedLine=The first line(s) will not be imported with the current selection
EmptyField=Empty field

View File

@ -1169,3 +1169,7 @@ CanceledShown=Canceled shown
Terminate=Terminate
Terminated=Terminated
AddLineOnPosition=Add line on position (at the end if empty)
ConfirmAllocateCommercial=Assign sales representative confirmation
ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
CommercialsAffected=Sales representatives affected
CommercialAffected=Sales representative affected

View File

@ -146,4 +146,7 @@ ModuleBuilderNotAllowed=The module builder is available but not allowed to your
ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Set this to 1 if you want to have the method $this->validateField() of object being called to validate the content of the field during insert or upadate. Set 0 if there is no validation required.
WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
LinkToParentMenu=Parent menu (fk_xxxxmenu)
LinkToParentMenu=Parent menu (fk_xxxxmenu)
ListOfTabsEntries=List of tab entries
TabsDefDesc=Define here the tabs provided by your module
TabsDefDescTooltip=The tabs provided by your module/application are defined into the array <strong>$this->tabs</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.

View File

@ -420,3 +420,7 @@ StockMouvementExtraFields= Extra Fields (stock mouvement)
InventoryExtraFields= Extra Fields (inventory)
ScanOrTypeOrCopyPasteYourBarCodes=Scan or type or copy/paste your barcodes
PuttingPricesUpToDate=Update prices with current known prices
PMPExpected=Expected PMP
ExpectedValuation=Expected Valuation
PMPReal=Real PMP
RealValuation=Real Valuation

View File

@ -8,7 +8,7 @@ ImportableDatas=Lot de données importables
SelectExportDataSet=Choisissez un lot prédéfini de données que vous désirez exporter…
SelectImportDataSet=Choisissez un lot prédéfini de données que vous désirez importer…
SelectExportFields=Choisissez les champs à exporter, ou choisissez un profil d'export prédéfini
SelectImportFields=Choisissez les champs du fichier source à importer et leur destination dans la base en utilisant les boîtes de sélection, ou choisissez un profil d'import prédéfini:
SelectImportFields=Choisissez les champs du fichier source à importer et leur destination dans la base en les déplaçant vers le haut ou vers le bas via l'ancre %s, ou choisissez un profil d'import prédéfini:
NotImportedFields=Champs du fichier source non importés
SaveExportModel=Enregistrer ce profil d'export (si vous désirez le réutiliser ultérieurement) …
SaveImportModel=Enregistrer ce profil d'import (si vous désirez le réutiliser ultérieurement) …
@ -135,5 +135,3 @@ NbInsert=Nombre de lignes insérées: %s
NbUpdate=Nombre de lignes mises à jour: %s
MultipleRecordFoundWithTheseFilters=Plusieurs enregistrements ont été trouvés avec ces filtres: %s
StocksWithBatch=Stocks et entrepôts des produits avec numéro de lot/série
WarningFirstImportedLine=Les première(s) ligne(s) ne seront pas importée(s) avec cette selection
EmptyField=Champ vide

View File

@ -280,7 +280,20 @@ if (!empty($_POST["DOL_AUTOSET_COOKIE"])) {
$cookiename = $tmpautoset[0];
$cookievalue = json_encode($cookiearrayvalue);
//var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // keep cookie 1 year and add tag httponly
if (PHP_VERSION_ID < 70300) {
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // keep cookie 1 year and add tag httponly
} else {
// Only available for php >= 7.3
$cookieparams = array(
'expires' => empty($cookievalue) ? 0 : (time() + (86400 * 354)),
'path' => '/',
//'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true),
'httponly' => true,
'samesite' => 'Lax' // None || Lax || Strict
);
setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, $cookieparams);
}
if (empty($cookievalue)) {
unset($_COOKIE[$cookiename]);
}
@ -305,7 +318,20 @@ if (!empty($_COOKIE[$sessiontimeout])) {
// This create lock, released by session_write_close() or end of page.
// We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
if (!defined('NOSESSION')) {
session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
if (PHP_VERSION_ID < 70300) {
session_set_cookie_params(0, '/', null, ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
} else {
// Only available for php >= 7.3
$sessioncookieparams = array(
'lifetime' => 0,
'path' => '/',
//'domain' => '.mywebsite.com', // the dot at the beginning allows compatibility with subdomains
'secure' => ((empty($dolibarr_main_force_https) && isHTTPS() === false) ? false : true),
'httponly' => true,
'samesite' => 'Lax' // None || Lax || Strict
);
session_set_cookie_params($sessioncookieparams);
}
session_name($sessionname);
session_start(); // This call the open and read of session handler
//exit; // this exist generates a call to write and close

View File

@ -2015,6 +2015,11 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'permissions';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=tabs&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Tabs");
$head2[$h][2] = 'tabs';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Menus");
$head2[$h][2] = 'menus';
@ -3299,7 +3304,7 @@ if ($module == 'initmodule') {
print '</td>';
print '<td>';
print $perm[1];
print $langs->trans($perm[1]);
print '</td>';
print '<td>';
@ -4032,6 +4037,129 @@ if ($module == 'initmodule') {
print '</form>';
}
if ($tab == 'tabs') {
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$tabs = $moduleobj->tabs;
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">';
$htmlhelp = $langs->trans("TabsDefDescTooltip", '{s1}');
$htmlhelp = str_replace('{s1}', '<a target="adminbis" class="nofocusvisible" href="'.DOL_URL_ROOT.'/admin/menus/index.php">'.$langs->trans('Setup').' - '.$langs->trans('Tabs').'</a>', $htmlhelp);
print $form->textwithpicto($langs->trans("TabsDefDesc"), $htmlhelp, 1, 'help', '', 0, 2, 'helpondesc').'<br>';
print '</span>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("DescriptorFile").' : <strong>'.$pathtofile.'</strong>';
print ' <a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<br>';
print load_fiche_titre($langs->trans("ListOfTabsEntries"), '', '');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="addproperty">';
print '<input type="hidden" name="tab" value="objects">';
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
print '<input type="hidden" name="tabobj" value="'.dol_escape_htmltag($tabobj).'">';
print '<div class="div-table-responsive">';
print '<table class="noborder small">';
print '<tr class="liste_titre">';
print_liste_field_titre("ObjectType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Tab", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LangFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Condition", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Path", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print "</tr>\n";
if (count($tabs)) {
foreach ($tabs as $tab) {
$parts = explode(':', $tab['data']);
$objectType = $parts[0];
$tabName = $parts[1];
$tabTitle = isset($parts[2]) ? $parts[2] : '';
$langFile = isset($parts[3]) ? $parts[3] : '';
$condition = isset($parts[4]) ? $parts[4] : '';
$path = isset($parts[5]) ? $parts[5] : '';
// If we want to remove the tab, then the format is 'objecttype:tabname:optionalcondition'
// See: https://wiki.dolibarr.org/index.php?title=Tabs_system#To_remove_an_existing_tab
if ($tabName[0] === '-') {
$tabTitle = '';
$condition = isset($parts[2]) ? $parts[2] : '';
}
print '<tr class="oddeven">';
print '<td>';
print dol_escape_htmltag($parts[0]);
print '</td>';
print '<td>';
if ($tabName[0] === "+") {
print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
} else {
print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag($tabName) . '</span>';
}
print '</td>';
print '<td>';
print dol_escape_htmltag($tabTitle);
print '</td>';
print '<td>';
print dol_escape_htmltag($langFile);
print '</td>';
print '<td>';
print dol_escape_htmltag($condition);
print '</td>';
print '<td>';
print dol_escape_htmltag($path);
print '</td>';
print '</tr>';
}
} else {
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
print '</div>';
print '</form>';
} else {
$fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile);
// New module
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="savefile">';
print '<input type="hidden" name="file" value="'.dol_escape_htmltag($file).'">';
print '<input type="hidden" name="tab" value="'.$tab.'">';
print '<input type="hidden" name="module" value="'.$module.'">';
$doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%');
print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html'));
print '<br>';
print '<center>';
print '<input type="submit" class="button buttonforacesave button-save" id="savefile" name="savefile" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print ' &nbsp; ';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '</center>';
print '</form>';
}
}
if ($tab != 'description') {
print dol_get_fiche_end();
}

View File

@ -1701,7 +1701,11 @@ class Product extends CommonObject
$testExit = array('multiprices','multiprices_ttc','multiprices_base_type','multiprices_min','multiprices_min_ttc','multiprices_tva_tx','multiprices_recuperableonly');
foreach ($testExit as $field) {
if (!isset($this->$field[$level])) {
if (!isset($this->$field)) {
return array();
}
$tmparray = $this->$field;
if (!isset($tmparray[$level])) {
return array();
}
}

View File

@ -769,6 +769,8 @@ class InventoryLine extends CommonObjectLine
'qty_stock' => array('type'=>'double', 'label'=>'QtyFound', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'Qty we found/want (to define during draft edition)'),
'qty_view' => array('type'=>'double', 'label'=>'QtyBefore', 'visible'=>1, 'enabled'=>1, 'position'=>33, 'index'=>1, 'help'=>'Qty before (filled once movements are validated)'),
'qty_regulated' => array('type'=>'double', 'label'=>'QtyDelta', 'visible'=>1, 'enabled'=>1, 'position'=>34, 'index'=>1, 'help'=>'Qty aadded or removed (filled once movements are validated)'),
'pmp_real' => array('type'=>'double', 'label'=>'PMPReal', 'visible'=>1, 'enabled'=>1, 'position'=>35),
'pmp_expected' => array('type'=>'double', 'label'=>'PMPExpected', 'visible'=>1, 'enabled'=>1, 'position'=>36),
);
/**
@ -785,6 +787,8 @@ class InventoryLine extends CommonObjectLine
public $qty_stock;
public $qty_view;
public $qty_regulated;
public $pmp_real;
public $pmp_expected;
/**

View File

@ -45,7 +45,8 @@ $fk_warehouse = GETPOST('fk_warehouse', 'int');
$fk_product = GETPOST('fk_product', 'int');
$lineid = GETPOST('lineid', 'int');
$batch = GETPOST('batch', 'alphanohtml');
$totalExpectedValuation = 0;
$totalRealValuation = 0;
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$result = restrictedArea($user, 'stock', $id);
} else {
@ -126,7 +127,7 @@ if (empty($reshook)) {
$db->begin();
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.pmp_real';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
@ -175,14 +176,35 @@ if (empty($reshook)) {
$datemovement = '';
//$inventorycode = 'INV'.$object->id;
$inventorycode = 'INV-'.$object->ref;
$price = 0;
if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real;
$idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, 0, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
$idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch);
if ($idstockmove < 0) {
$error++;
setEventMessages($stockmovment->error, $stockmovment->errors, 'errors');
break;
}
if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
$sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product SET pmp = '.((float) $line->pmp_real).' WHERE rowid = '.((int) $line->fk_product);
$resqlpmp = $db->query($sqlpmp);
if (! $resqlpmp) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) {
$sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity;
$resqlpmp = $db->query($sqlpmp);
if (! $resqlpmp) {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
}
}
}
// Update line with id of stock movement (and the start quantity if it has changed this last recording)
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."inventorydet";
$sqlupdate .= " SET fk_movement = ".((int) $idstockmove);
@ -249,6 +271,8 @@ if (empty($reshook)) {
if ($result > 0) {
$inventoryline->qty_stock = price2num(GETPOST('stock_qty_'.$lineid, 'alpha'), 'MS'); // The new value that was set in as hidden field
$inventoryline->qty_view = $qtytoupdate; // The new value we want
$inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS');
$inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS');
$resultupdate = $inventoryline->update($user);
}
} else {
@ -256,6 +280,8 @@ if (empty($reshook)) {
$result = $inventoryline->fetch($lineid);
if ($result > 0) {
$inventoryline->qty_view = null; // The new value we want
$inventoryline->pmp_real = price2num(GETPOST('realpmp_'.$lineid, 'alpha'), 'MS');
$inventoryline->pmp_expected = price2num(GETPOST('expectedpmp_'.$lineid, 'alpha'), 'MS');
$resultupdate = $inventoryline->update($user);
}
}
@ -593,6 +619,7 @@ if ($object->id > 0) {
var object = $(this)[0];
var objecttofill = $("#"+object.id+"_input")[0];
objecttofill.value = object.innerText;
jQuery(".realqty").trigger("change");
})
console.log("Values filled (after click on fillwithexpected)");
disablebuttonmakemovementandclose();
@ -850,6 +877,7 @@ if ($object->id > 0) {
console.log("Clear all values");
disablebuttonmakemovementandclose();
jQuery(".realqty").val("");
jQuery(".realqty").trigger("change");
return false; /* disable submit */
});
$(".undochangesqty").on("click", function undochangesqty() {
@ -885,6 +913,12 @@ if ($object->id > 0) {
print '<td class="right">';
print $form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp"));
print '</td>';
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
print '<td class="right">'.$langs->trans('PMPExpected').'</td>';
print '<td class="right">'.$langs->trans('ExpectedValuation').'</td>';
print '<td class="right">'.$langs->trans('PMPReal').'</td>';
print '<td class="right">'.$langs->trans('RealValuation').'</td>';
}
if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STATUS_VALIDATED) {
// Actions or link to stock movement
print '<td class="center">';
@ -915,6 +949,16 @@ if ($object->id > 0) {
print '<td class="right">';
print '<input type="text" name="qtytoadd" class="maxwidth75" value="">';
print '</td>';
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
print '<td class="right">';
print '</td>';
print '<td class="right">';
print '</td>';
print '<td class="right">';
print '</td>';
print '<td class="right">';
print '</td>';
}
// Actions
print '<td class="center">';
print '<input type="submit" class="button paddingright" name="addline" value="'.$langs->trans("Add").'">';
@ -924,7 +968,7 @@ if ($object->id > 0) {
// Request to show lines of inventory (prefilled after start/validate step)
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated, id.fk_movement, id.pmp_real, id.pmp_expected';
$sql .= ' FROM '.MAIN_DB_PREFIX.'inventorydet as id';
$sql .= ' WHERE id.fk_inventory = '.((int) $object->id);
@ -1010,6 +1054,34 @@ if ($object->id > 0) {
print '</a>';
print '<input type="text" class="maxwidth75 right realqty" name="id_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input" value="'.$qty_view.'">';
print '</td>';
if (! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
if (! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
else $pmp_expected = $product_static->pmp;
$pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">';
print price($pmp_expected);
print '<input type="hidden" name="expectedpmp_'.$obj->rowid.'" value="'.$pmp_expected.'"/>';
print '</td>';
print '<td class="right">';
print price($pmp_valuation);
print '</td>';
//PMP Real
print '<td class="right">';
if (! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
$pmp_valuation_real = $pmp_real * $qty_view;
print '<input type="text" class="maxwidth75 right realpmp'.$obj->fk_product.'" name="realpmp_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_pmp" value="'.price2num($pmp_real).'">';
print '</td>';
print '<td class="right">';
print '<input type="text" class="maxwidth75 right realvaluation'.$obj->fk_product.'" name="realvaluation_'.$obj->rowid.'" id="id_'.$obj->rowid.'_input_real_valuation" value="'.$pmp_valuation_real.'">';
print '</td>';
$totalExpectedValuation += $pmp_valuation;
$totalRealValuation += $pmp_valuation_real;
}
// Picto delete line
print '<td class="right">';
@ -1021,7 +1093,33 @@ if ($object->id > 0) {
print '<td class="right nowraponall">';
print $obj->qty_view; // qty found
print '</td>';
print '<td class="nowraponall right">';
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
//PMP Expected
if (! empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected;
else $pmp_expected = $product_static->pmp;
$pmp_valuation = $pmp_expected * $valuetoshow;
print '<td class="right">';
print price($pmp_expected);
print '</td>';
print '<td class="right">';
print price($pmp_valuation);
print '</td>';
//PMP Real
print '<td class="right">';
if (! empty($obj->pmp_real)) $pmp_real = $obj->pmp_real;
else $pmp_real = $product_static->pmp;
$pmp_valuation_real = $pmp_real * $obj->qty_view;
print price($pmp_real);
print '</td>';
print '<td class="right">';
print price($pmp_valuation_real);
print '</td>';
print '<td class="nowraponall right">';
$totalExpectedValuation += $pmp_valuation;
$totalRealValuation += $pmp_valuation_real;
}
if ($obj->fk_movement > 0) {
$stockmovment = new MouvementStock($db);
$stockmovment->fetch($obj->fk_movement);
@ -1036,7 +1134,14 @@ if ($object->id > 0) {
} else {
dol_print_error($db);
}
if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
print '<tr class="liste_total">';
print '<td colspan="5">'.$langs->trans("Total").'</td>';
print '<td class="right" colspan="2">'.price($totalExpectedValuation).'</td>';
print '<td class="right" id="totalRealValuation" colspan="2">'.price($totalRealValuation).'</td>';
print '<td></td>';
print '</tr>';
}
print '</table>';
print '</div>';
@ -1059,6 +1164,74 @@ if ($object->id > 0) {
</script>';
}
print '</form>';
if (! empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) {
?>
<script type="text/javascript">
$('.realqty').on('change', function () {
let realqty = $(this).closest('tr').find('.realqty').val();
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
let realpmp = $(inputPmp).val();
if (!isNaN(realqty) && !isNaN(realpmp)) {
let realval = realqty * realpmp;
$(this).closest('tr').find('input[name^=realvaluation]').val(realval.toFixed(2));
}
updateTotalValuation();
});
$('input[class*=realpmp]').on('change', function () {
let inputQtyReal = $(this).closest('tr').find('.realqty');
let realqty = $(inputQtyReal).val();
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
console.log(inputPmp);
let realPmpClassname = $(inputPmp).attr('class').match(/[\w-]*realpmp[\w-]*/g)[0];
let realpmp = $(inputPmp).val();
if (!isNaN(realpmp)) {
$('.'+realPmpClassname).val(realpmp); //For batch case if pmp is changed we change it everywhere it's same product and calc back everything
if (!isNaN(realqty)) {
let realval = realqty * realpmp;
$(this).closest('tr').find('input[name^=realvaluation]').val(realval.toFixed(2));
}
$('.realqty').trigger('change');
updateTotalValuation();
}
});
$('input[name^=realvaluation]').on('change', function () {
let inputQtyReal = $(this).closest('tr').find('.realqty');
let realqty = $(inputQtyReal).val();
let inputPmp = $(this).closest('tr').find('input[class*=realpmp]');
let inputRealValuation = $(this).closest('tr').find('input[name^=realvaluation]');
let realPmpClassname = $(inputPmp).attr('class').match(/[\w-]*realpmp[\w-]*/g)[0];
let realvaluation = $(inputRealValuation).val();
if (!isNaN(realvaluation) && !isNaN(realqty) && realvaluation !== '' && realqty !== '' && realqty !== 0) {
let realpmp = realvaluation / realqty
$('.'+realPmpClassname).val(realpmp); //For batch case if pmp is changed we change it everywhere it's same product and calc back everything
$('.realqty').trigger('change');
updateTotalValuation();
}
});
function updateTotalValuation() {
let total = 0;
$('input[name^=realvaluation]').each(function( index ) {
let val = $(this).val();
if(!isNaN(val)) total += parseFloat($(this).val());
});
let currencyFractionDigits = new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR',
}).resolvedOptions().maximumFractionDigits;
$('#totalRealValuation').html(total.toLocaleString('fr-FR', {
maximumFractionDigits: currencyFractionDigits
}));
}
</script>
<?php
}
}
// End of page

View File

@ -180,7 +180,7 @@ print '</td>';
print '</tr>';
// Extrafield template
include 'extrafields_add.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>';

View File

@ -137,7 +137,7 @@ print '</td>';
print '</tr>';
// Extrafield template
include 'extrafields_add.tpl.php';
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
print '</table>';

View File

@ -95,6 +95,10 @@ if ($year && $month && $day) {
$daytoparse = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday); // xxxofday is value of day after submit action 'addtime'
}
$daytoparsegmt = dol_now('gmt');
if ($yearofday && $monthofday && $dayofday) $daytoparsegmt = dol_mktime(0, 0, 0, $monthofday, $dayofday, $yearofday, 'gmt'); // xxxofday is value of day after submit action 'addtime'
elseif ($year && $month && $day) $daytoparsegmt = dol_mktime(0, 0, 0, $month, $day, $year, 'gmt'); // this are value submited after submit of action 'submitdateselect'
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
$usertoprocess = $user;
$search_usertoprocessid = $usertoprocess->id;
@ -619,6 +623,11 @@ $numendworkingday = 0;
$numstartworkingday = 0;
// Get if user is available or not for each day
$isavailable = array();
// Assume from Monday to Friday if conf empty or badly formed
$numstartworkingday = 1;
$numendworkingday = 5;
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
if (count($tmparray) >= 2) {
@ -631,7 +640,7 @@ $statusofholidaytocheck = Holiday::STATUS_APPROVED;
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholidaytocheck); // $daytoparse is a date with hours = 0
$isavailable[$daytoparse] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
$test = num_public_holiday($daytoparse, $daytoparse + 86400, $mysoc->country_code);
$test = num_public_holiday($daytoparsegmt, $daytoparsegmt + 86400, $mysoc->country_code);
if ($test) {
$isavailable[$daytoparse] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
}

View File

@ -98,7 +98,7 @@ $next_day = $next['day'];
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year);
$lastdaytoshow = dol_time_plus_duree($firstdaytoshow, 7, 'd');
$firstdaytoshowgmt = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'gmt');
if (empty($search_usertoprocessid) || $search_usertoprocessid == $user->id) {
$usertoprocess = $user;
@ -509,6 +509,11 @@ $numendworkingday = 0;
$numstartworkingday = 0;
// Get if user is available or not for each day
$isavailable = array();
// Assume from Monday to Friday if conf empty or badly formed
$numstartworkingday = 1;
$numendworkingday = 5;
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
if (count($tmparray) >= 2) {
@ -519,25 +524,18 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) {
for ($idw = 0; $idw < 7; $idw++) {
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
// Useless because $dayinloopwithouthours should be same than $dayinloopfromfirstdaytoshow
//$tmparray = dol_getdate($dayinloop);
//$dayinloopwithouthours=dol_mktime(0, 0, 0, $tmparray['mon'], $tmparray['mday'], $tmparray['year']);
//print dol_print_date($dayinloop, 'dayhour').' ';
//print dol_print_date($dayinloopwithouthours, 'dayhour').' ';
//print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour').'<br>';
$dayinloopfromfirstdaytoshowgmt = dol_time_plus_duree($firstdaytoshowgmt, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
$statusofholidaytocheck = Holiday::STATUS_APPROVED;
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
$isavailable[$dayinloopfromfirstdaytoshow] = $isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
$test = num_public_holiday($dayinloopfromfirstdaytoshow, $dayinloopfromfirstdaytoshow + 86400, $mysoc->country_code);
$test = num_public_holiday($dayinloopfromfirstdaytoshowgmt, $dayinloopfromfirstdaytoshowgmt + 86400, $mysoc->country_code);
if ($test) {
$isavailable[$dayinloopfromfirstdaytoshow] = array('morning'=>false, 'afternoon'=>false, 'morning_reason'=>'public_holiday', 'afternoon_reason'=>'public_holiday');
}
}
//var_dump($isavailable);
@ -669,13 +667,7 @@ if (!empty($arrayfields['timeconsumed']['checked'])) {
}
for ($idw = 0; $idw < 7; $idw++) {
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
$dayinloop = dol_time_plus_duree($startday, $idw, 'd');
/*print $dayinloopfromfirstdaytoshow;
print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour', 'gmt');
print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour');
print dol_print_date($dayinloopfromfirstdaytoshow, '%a', 'gmt');
print dol_print_date($dayinloopfromfirstdaytoshow, '%a');
print '<br>';*/
$cssweekend = '';
if ((($idw + 1) < $numstartworkingday) || (($idw + 1) > $numendworkingday)) { // This is a day is not inside the setup of working days, so we use a week-end css.
$cssweekend = 'weekend';

View File

@ -193,7 +193,7 @@ $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '<div>' : '').'<div>';
llxHeader($head, $langs->trans("OnlineSignature"), '', '', 0, 0, '', '', '', 'onlinepaymentbody', $replacemainarea, 1);
if ($action == 'refusepropal') {
print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:''), $langs->trans('RefusePropal'), $langs->trans('ConfirmRefusePropal', $object->ref), 'confirm_refusepropal', '', '', 1);
}
// Check link validity for param 'source' to avoid use of the examples as value
@ -431,11 +431,12 @@ if ($action == "dosign" && empty($cancel)) {
"ref" : \''.dol_escape_js($REF).'\',
"securekey" : \''.dol_escape_js($SECUREKEY).'\',
"mode" : \''.dol_escape_htmltag($source).'\',
"entity" : \''.dol_escape_htmltag($entity).'\',
},
success: function(response) {
if(response == "success"){
console.log("Success on saving signature");
window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).'");
window.location.replace("'.$_SERVER["PHP_SELF"].'?ref='.urlencode($ref).'&message=signed&securekey='.urlencode($SECUREKEY).($conf->multicompany->enabled?'&entity='.$entity:'').'");
}else{
console.error(response);
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) - 2013-2015 Jean-François FERRY <jfefe@aternatik.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -224,9 +225,11 @@ class FormResource
$value = ($maxlength ?dol_trunc($arraytypes['label'], $maxlength) : $arraytypes['label']);
} elseif ($format == 3) {
$value = $arraytypes['code'];
} elseif (empty($value)) {
print '&nbsp;';
}
if (empty($value)) {
$value = '&nbsp;';
}
print $value;
print '</option>';
}
}

View File

@ -164,9 +164,9 @@ class PaymentSalary extends CommonObject
$this->db->begin();
if ($totalamount != 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (fk_salary, datec, datep, amount,";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_salary (entity, fk_salary, datec, datep, amount,";
$sql .= " fk_typepayment, num_payment, note, fk_user_author, fk_bank)";
$sql .= " VALUES ($this->chid, '".$this->db->idate($now)."',";
$sql .= " VALUES (".((int) $conf->entity).", ".((int) $this->chid).", '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->datepaye)."',";
$sql .= " ".price2num($totalamount).",";
$sql .= " ".((int) $this->paiementtype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note)."', ".((int) $user->id).",";

View File

@ -2926,18 +2926,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
if (empty($user->socid)) {
if (!empty($object->email) || $at_least_one_email_contact) {
$langs->load("mails");
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
} else {
$langs->load("mails");
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans('SendMail').'</a>'."\n";
}
$langs->load("mails");
$title = '';
if (empty($object->email) && !$at_least_one_email_contact) { $title = $langs->trans('NoEMail'); }
print dolGetButtonAction($title, $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?socid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', 'btn-send-mail', !empty($object->email) || $at_least_one_email_contact);
}
if ($user->rights->societe->creer) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>'."\n";
}
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
if (!empty($conf->adherent->enabled)) {
$adh = new Adherent($db);
@ -2947,16 +2942,16 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
}
if ($user->rights->societe->supprimer) {
print '<a class="butActionDelete" href="card.php?action=merge&socid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MergeThirdparties")).'">'.$langs->trans('Merge').'</a>'."\n";
}
print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontodelete);
if ($user->rights->societe->supprimer) {
$deleteUrl = $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken();
$buttonId = 'action-delete-no-ajax';
if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile
print '<span id="action-delete" class="butActionDelete">'.$langs->trans('Delete').'</span>'."\n";
} else {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans('Delete').'</a>'."\n";
$deleteUrl = '';
$buttonId = 'action-delete';
}
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $deleteUrl, $buttonId, $permissiontodelete);
}
}

View File

@ -870,10 +870,13 @@ if ($user->rights->societe->creer) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['preenable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
$arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['predisable'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
$arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
}
if ($user->rights->societe->creer) {
$arrayofmassactions['presetcommercial'] = img_picto('', '', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
$arrayofmassactions = array();

View File

@ -104,7 +104,7 @@ if ($action == "updatename") {
if (strlen($newname) > 3) {
$newname = substr($newname, 0, 3); // Only 3 chars
}
$db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid = ".((int) $place));
$resql = $db->query("UPDATE ".MAIN_DB_PREFIX."takepos_floor_tables set label='".$db->escape($newname)."' WHERE rowid = ".((int) $place));
}
if ($action == "add") {

View File

@ -656,9 +656,12 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$holiday->id = $objp->rowid;
$holiday->ref = $objp->rowid;
$holiday->fk_type = $objp->fk_type;
$holiday->statut = $objp->status;
$nbopenedday = num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday);
$holiday->status = $objp->status;
$nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday);
print '<tr class="oddeven">';
print '<td class="nowrap">';