Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop_of_consumption_selectbatch

This commit is contained in:
atm-lena 2022-04-22 08:48:47 +02:00
commit bcfcbe4849
78 changed files with 1137 additions and 337 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

@ -117,7 +117,7 @@ if (!GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end))
$date_end = dol_get_last_day($pastmonthyear, $pastmonth, false);
}
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.amount_main_currency, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type, b.fk_account,";
$sql .= " ba.courant, ba.ref as baref, ba.account_number, ba.fk_accountancy_journal,";
$sql .= " soc.rowid as socid, soc.nom as name, soc.email as email, bu1.type as typeop_company,";
if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
@ -142,7 +142,7 @@ if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) {
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on bu2.url_id=u.rowid";
$sql .= " WHERE ba.fk_accountancy_journal=".((int) $id_journal);
$sql .= ' AND b.amount != 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
$sql .= ' AND b.amount <> 0 AND ba.entity IN ('.getEntity('bank_account', 0).')'; // We don't share object for accountancy
if ($date_start && $date_end) {
$sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'";
}
@ -282,6 +282,7 @@ if ($result) {
$tabpay[$obj->rowid]["fk_bank"] = $obj->rowid;
$tabpay[$obj->rowid]["bank_account_ref"] = $obj->baref;
$tabpay[$obj->rowid]["fk_bank_account"] = $obj->fk_account;
$reg = array();
if (preg_match('/^\((.*)\)$/i', $obj->label, $reg)) {
$tabpay[$obj->rowid]["lib"] = $langs->trans($reg[1]);
} else {
@ -296,6 +297,12 @@ if ($result) {
$tabtype[$obj->rowid] = 'unknown';
$tabmoreinfo[$obj->rowid] = array();
$amounttouse = $obj->amount;
if (!empty($obj->amount_main_currency)) {
// If $obj->amount_main_currency is set, it means that $obj->amount is not in same currency, we must use $obj->amount_main_currency
$amounttouse = $obj->amount_main_currency;
}
// get_url may return -1 which is not traversable
if (is_array($links) && count($links) > 0) {
// Now loop on each link of record in bank (code similar to bankentries_list.php)
@ -334,7 +341,7 @@ if ($result) {
$societestatic->email = $tabcompany[$obj->rowid]['email'];
$tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30);
if ($compta_soc) {
$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
}
} elseif ($links[$key]['type'] == 'user') {
$userstatic->id = $links[$key]['url_id'];
@ -350,7 +357,7 @@ if ($result) {
$tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment.
}
if ($compta_user) {
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
}
} elseif ($links[$key]['type'] == 'sc') {
$chargestatic->id = $links[$key]['url_id'];
@ -383,7 +390,7 @@ if ($result) {
$resultmid = $db->query($sqlmid);
if ($resultmid) {
$objmid = $db->fetch_object($resultmid);
$tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount;
$tabtp[$obj->rowid][$objmid->accountancy_code] += $amounttouse;
}
} elseif ($links[$key]['type'] == 'payment_donation') {
$paymentdonstatic->id = $links[$key]['url_id'];
@ -391,7 +398,7 @@ if ($result) {
$paymentdonstatic->fk_donation = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentdonstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id;
$tabtp[$obj->rowid][$account_pay_donation] += $obj->amount;
$tabtp[$obj->rowid][$account_pay_donation] += $amounttouse;
} elseif ($links[$key]['type'] == 'member') {
$paymentsubscriptionstatic->id = $links[$key]['url_id'];
$paymentsubscriptionstatic->ref = $links[$key]['url_id'];
@ -399,14 +406,14 @@ if ($result) {
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentsubscriptionstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id;
$paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id);
$tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount;
$tabtp[$obj->rowid][$account_pay_subscription] += $amounttouse;
} elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT
$paymentvatstatic->id = $links[$key]['url_id'];
$paymentvatstatic->ref = $links[$key]['url_id'];
$paymentvatstatic->label = $links[$key]['label'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentvatstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id;
$tabtp[$obj->rowid][$account_pay_vat] += $obj->amount;
$tabtp[$obj->rowid][$account_pay_vat] += $amounttouse;
} elseif ($links[$key]['type'] == 'payment_salary') {
$paymentsalstatic->id = $links[$key]['url_id'];
$paymentsalstatic->ref = $links[$key]['url_id'];
@ -438,7 +445,7 @@ if ($result) {
if (empty($obj->typeop_user)) { // Add test to avoid to add amount twice if a link already exists also on user.
$compta_user = $userstatic->accountancy_code;
if ($compta_user) {
$tabtp[$obj->rowid][$compta_user] += $obj->amount;
$tabtp[$obj->rowid][$compta_user] += $amounttouse;
$tabuser[$obj->rowid] = array(
'id' => $userstatic->id,
'name' => dolGetFirstLastname($userstatic->firstname, $userstatic->lastname),
@ -465,14 +472,14 @@ if ($result) {
$account_various = (!empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
$account_subledger = (!empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
$tabpay[$obj->rowid]["account_various"] = $account_various;
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
$tabtp[$obj->rowid][$account_subledger] += $amounttouse;
} elseif ($links[$key]['type'] == 'payment_loan') {
$paymentloanstatic->id = $links[$key]['url_id'];
$paymentloanstatic->ref = $links[$key]['url_id'];
$paymentloanstatic->fk_loan = $links[$key]['url_id'];
$tabpay[$obj->rowid]["lib"] .= ' '.$paymentloanstatic->getNomUrl(2);
$tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id;
//$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount;
//$tabtp[$obj->rowid][$account_pay_loan] += $amounttouse;
$sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest';
$sqlmid .= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l';
$sqlmid .= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.((int) $obj->rowid);
@ -488,14 +495,14 @@ if ($result) {
} elseif ($links[$key]['type'] == 'banktransfert') {
$accountLinestatic->fetch($links[$key]['url_id']);
$tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- '.$accountLinestatic ->getNomUrl(1);
$tabtp[$obj->rowid][$account_transfer] += $obj->amount;
$tabtp[$obj->rowid][$account_transfer] += $amounttouse;
$bankaccountstatic->fetch($tabpay[$obj->rowid]['fk_bank_account']);
$tabpay[$obj->rowid]["soclib"] = $bankaccountstatic->getNomUrl(2);
}
}
}
$tabbq[$obj->rowid][$compta_bank] += $obj->amount;
$tabbq[$obj->rowid][$compta_bank] += $amounttouse;
// If no links were found to know the amount on thirdparty, we try to guess it.
// This may happens on bank entries without the links lines to 'company'.
@ -542,7 +549,7 @@ if ($result) {
}
}*/
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $obj->amount;
// if($obj->socid)$tabtp[$obj->rowid][$compta_soc] += $amounttouse;
$i++;
}

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

@ -1033,8 +1033,8 @@ if ($resql) {
$event->type = 'holiday';
$event->type_picto = 'holiday';
$event->datep = $db->jdate($obj->date_start);
$event->datef = $db->jdate($obj->date_end);
$event->datep = $db->jdate($obj->date_start) + (empty($halfday) || $halfday == 1 ? 0 : 12 * 60 * 60 - 1);
$event->datef = $db->jdate($obj->date_end) + (empty($halfday) || $halfday == -1 ? 24 : 12) * 60 * 60 - 1;
$event->date_start_in_calendar = $event->datep;
$event->date_end_in_calendar = $event->datef;

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

@ -45,8 +45,14 @@ if ($mode == 'customer' && !$user->rights->commande->lire) {
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
accessforbidden();
}
if ($mode == 'supplier') {
$object_status = GETPOST('object_status', 'array:int');
$object_status = implode(',', $object_status);
} else {
$object_status = GETPOST('object_status', 'intcomma');
}
$object_status = GETPOST('object_status', 'intcomma');
$typent_id = GETPOST('typent_id', 'int');
$categ_id = GETPOST('categ_id', 'categ_id');

View File

@ -276,6 +276,9 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', '
if ($offset) {
$param .= '&offset='.urlencode($offset);
}
if ($limit) {
$param .= '&limit='.urlencode($limit);
}
if ($search_conciliated != '' && $search_conciliated != '-1') {
$param .= '&search_conciliated='.urlencode($search_conciliated);
}
@ -980,21 +983,27 @@ if ($resql) {
$moreforfilter = '';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateOperationShort').' ';
$moreforfilter .= $langs->trans('DateOperationShort');
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
//$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
$moreforfilter .= $form->selectDate($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
$moreforfilter .= '</div>';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dt_end, 'search_end_dt', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
$moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('DateValueShort').' ';
$moreforfilter .= $langs->trans('DateValueShort');
$moreforfilter .= ($conf->browser->layout == 'phone' ? '<br>' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')).'</div>';
//$moreforfilter .= ' - ';
$moreforfilter .= '<div class="nowrap inline-block">'.$form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')).'</div>';
$moreforfilter .= $form->selectDate($search_dv_start, 'search_start_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
$moreforfilter .= '</div>';
$moreforfilter .= ($conf->browser->layout == 'phone' ? '' : ' ');
$moreforfilter .= '<div class="nowrap inline-block">';
$moreforfilter .= $form->selectDate($search_dv_end, 'search_end_dv', 0, 0, 1, "search_form", 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
$moreforfilter .= '</div>';
$moreforfilter .= '</div>';
if (!empty($conf->categorie->enabled)) {

View File

@ -519,9 +519,10 @@ class Account extends CommonObject
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
* @param int $datev Date value
* @param string $num_releve Label of bank receipt for reconciliation
* @param float $amount_main_currency Amount
* @return int Rowid of added entry, <0 if KO
*/
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '', $amount_main_currency = null)
{
// Deprecation warning
if (is_numeric($oper)) {
@ -579,6 +580,7 @@ class Account extends CommonObject
$accline->datev = $datev;
$accline->label = $label;
$accline->amount = $amount;
$accline->amount_main_currency = $amount_main_currency;
$accline->fk_user_author = $user->id;
$accline->fk_account = $this->id;
$accline->fk_type = $oper;
@ -1801,7 +1803,8 @@ class AccountLine extends CommonObject
*/
public $datev;
public $amount;
public $amount; /* Amount of payment in the bank account currency */
public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */
/**
* @var int ID
@ -1962,6 +1965,7 @@ class AccountLine extends CommonObject
$sql .= ", datev";
$sql .= ", label";
$sql .= ", amount";
$sql .= ", amount_main_currency";
$sql .= ", fk_user_author";
$sql .= ", num_chq";
$sql .= ", fk_account";
@ -1976,7 +1980,8 @@ class AccountLine extends CommonObject
$sql .= ", '".$this->db->idate($this->datev)."'";
$sql .= ", '".$this->db->escape($this->label)."'";
$sql .= ", ".price2num($this->amount);
$sql .= ", ".($this->fk_user_author > 0 ? $this->fk_user_author : "null");
$sql .= ", ".(empty($this->amount_main_currency) ? "NULL" : price2num($this->amount_main_currency));
$sql .= ", ".($this->fk_user_author > 0 ? ((int) $this->fk_user_author) : "null");
$sql .= ", ".($this->num_chq ? "'".$this->db->escape($this->num_chq)."'" : "null");
$sql .= ", '".$this->db->escape($this->fk_account)."'";
$sql .= ", '".$this->db->escape($this->fk_type)."'";

View File

@ -811,6 +811,10 @@ class Facture extends CommonInvoice
$fk_parent_line = 0;
}
// Complete vat rate with code
$vatrate = $newinvoiceline->tva_tx;
if ($newinvoiceline->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$newinvoiceline->vat_src_code.')';
$newinvoiceline->fk_parent_line = $fk_parent_line;
if ($this->type === Facture::TYPE_REPLACEMENT && $newinvoiceline->fk_remise_except) {
@ -821,7 +825,37 @@ class Facture extends CommonInvoice
$newinvoiceline->fk_remise_except = $discountId;
}
$result = $newinvoiceline->insert();
$result = $this->addline(
$newinvoiceline->desc,
$newinvoiceline->subprice,
$newinvoiceline->qty,
$vatrate,
$newinvoiceline->localtax1_tx,
$newinvoiceline->localtax2_tx,
$newinvoiceline->fk_product,
$newinvoiceline->remise_percent,
$newinvoiceline->date_start,
$newinvoiceline->date_end,
$newinvoiceline->fk_code_ventilation,
$newinvoiceline->info_bits,
$newinvoiceline->fk_remise_except,
'HT',
0,
$newinvoiceline->product_type,
$newinvoiceline->rang,
$newinvoiceline->special_code,
$newinvoiceline->element,
$newinvoiceline->id,
$fk_parent_line,
$newinvoiceline->fk_fournprice,
$newinvoiceline->pa_ht,
$newinvoiceline->label,
$newinvoiceline->array_options,
$newinvoiceline->situation_percent,
$newinvoiceline->fk_prev_id,
$newinvoiceline->fk_unit,
$newinvoiceline->multicurrency_subprice
);
// Defined the new fk_parent_line
if ($result > 0) {
@ -1596,8 +1630,6 @@ class Facture extends CommonInvoice
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $notused = '', $fetch_situation = false)
{
global $conf;
if (empty($rowid) && empty($ref) && empty($ref_ext)) {
return -1;
}

View File

@ -912,7 +912,7 @@ if ($object->id > 0) {
}
if (!$numopen && !$numclosed) {
print '<tr class="oddeven"><td colspan="7" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
$db->free($result);

View File

@ -266,6 +266,7 @@ if (empty($reshook)) {
if (!$error) {
// Create payment and update this->multicurrency_amounts if this->amounts filled or
// this->amounts if this->multicurrency_amounts filled.
// This also set ->amount and ->multicurrency_amount
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); // This include closing invoices and regenerating documents
if ($paiement_id < 0) {
setEventMessages($paiement->error, $paiement->errors, 'errors');

View File

@ -636,17 +636,22 @@ class Paiement extends CommonObject
$this->db->begin();
$totalamount = $this->amount;
$totalamount_main_currency = null;
if (empty($totalamount)) {
$totalamount = $this->total; // For backward compatibility
}
// if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me)
if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) {
$totalamount = $this->multicurrency_amount;
$totalamount = $this->multicurrency_amount; // We will insert into llx_bank.amount in foreign currency
$totalamount_main_currency = $this->amount; // We will also save the amount in main currency into column llx_bank.amount_main_currency
}
if ($mode == 'payment_supplier') {
$totalamount = -$totalamount;
if (isset($totalamount_main_currency)) {
$totalamount_main_currency = -$totalamount_main_currency;
}
}
// Insert payment into llx_bank
@ -660,8 +665,11 @@ class Paiement extends CommonObject
$user,
$emetteur_nom,
$emetteur_banque,
$accountancycode
);
$accountancycode,
null,
'',
$totalamount_main_currency
);
// Mise a jour fk_bank dans llx_paiement
// On connait ainsi le paiement qui a genere l'ecriture bancaire
@ -706,7 +714,7 @@ class Paiement extends CommonObject
DOL_URL_ROOT.'/comm/card.php?socid=',
$fac->thirdparty->name,
'company'
);
);
if ($result <= 0) {
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
}
@ -724,7 +732,7 @@ class Paiement extends CommonObject
DOL_URL_ROOT.'/fourn/card.php?socid=',
$fac->thirdparty->name,
'company'
);
);
if ($result <= 0) {
dol_syslog(get_class($this).'::addPaymentToBank '.$this->db->lasterror());
}
@ -742,7 +750,7 @@ class Paiement extends CommonObject
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
$this->num_payment,
'withdraw'
);
);
}
// Add link 'InvoiceRefused' in bank_url
@ -753,7 +761,7 @@ class Paiement extends CommonObject
DOL_URL_ROOT.'/compta/prelevement/card.php?id=',
$this->num_prelevement,
'withdraw'
);
);
}
if (!$error && !$notrigger) {
@ -1291,40 +1299,40 @@ class Paiement extends CommonObject
$langs->load('compta');
/*if ($mode == 0)
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 1)
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 2)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 3)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 4)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 5)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 6)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}*/
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 1)
{
if ($status == 0) return $langs->trans('ToValidate');
if ($status == 1) return $langs->trans('Validated');
}
if ($mode == 2)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 3)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 4)
{
if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut1').' '.$langs->trans('ToValidate');
if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated');
}
if ($mode == 5)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}
if ($mode == 6)
{
if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut1');
if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4');
}*/
return '';
}

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

@ -657,6 +657,8 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
} else {
// If we want one invoice per order or if there is no first invoice yet for this thirdparty.
$objecttmp->socid = $cmd->socid;
$objecttmp->thirdparty = $cmd->thirdparty;
$objecttmp->type = $objecttmp::TYPE_STANDARD;
$objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
$objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
@ -1600,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

@ -119,7 +119,7 @@ class box_birthdays extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'text' => dol_print_date($dateb, "day", 'gmt').' - '.$age.' '.$langs->trans('DurationYears')
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
);
/*$this->info_box_contents[$line][] = array(

View File

@ -126,10 +126,9 @@ abstract class CommonObject
public $linkedObjects;
/**
* @var boolean is linkedObjects full loaded. Loaded by ->fetchObjectLinked
* important for pdf generation time reduction
* @var boolean Array of boolean with object id as key and value as true if linkedObjects full loaded. Loaded by ->fetchObjectLinked. Important for pdf generation time reduction.
*/
public $linkedObjectsFullLoaded = false;
public $linkedObjectsFullLoaded = array();
/**
* @var Object To store a cloned copy of object before to edit it and keep track of old properties
@ -3781,9 +3780,11 @@ abstract class CommonObject
{
global $conf, $hookmanager, $action;
// important for pdf generation time reduction
// this boolean is true if $this->linkedObjects has already been loaded with all objects linked without filter
if ($this->linkedObjectsFullLoaded) return 1;
// Important for pdf generation time reduction
// This boolean is true if $this->linkedObjects has already been loaded with all objects linked without filter
if ($this->id > 0 && !empty($this->linkedObjectsFullLoaded[$this->id])) {
return 1;
}
$this->linkedObjectsIds = array();
$this->linkedObjects = array();
@ -3846,8 +3847,8 @@ abstract class CommonObject
} else {
$sql .= "(fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."')";
$sql .= " ".$clause." (fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."')";
if ($sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') {
$this->linkedObjectsFullLoaded = true;
if ($loadalsoobjects && $this->id > 0 && $sourceid == $this->id && $sourcetype == $this->element && $targetid == $this->id && $targettype == $this->element && $clause == 'OR') {
$this->linkedObjectsFullLoaded[$this->id] = true;
}
}
$sql .= " ORDER BY ".$orderby;
@ -4951,18 +4952,18 @@ abstract class CommonObject
global $langs, $hookmanager, $conf, $form, $action;
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('Description').'</td>';
print '<td class="right">'.$langs->trans('VATRate').'</td>';
print '<td class="right">'.$langs->trans('PriceUHT').'</td>';
print '<td class="linecolref">'.$langs->trans('Ref').'</td>';
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
print '<td class="linecolvat right">'.$langs->trans('VATRate').'</td>';
print '<td class="linecoluht right">'.$langs->trans('PriceUHT').'</td>';
if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$langs->trans('PriceUHTCurrency').'</td>';
print '<td class="linecoluht_currency right">'.$langs->trans('PriceUHTCurrency').'</td>';
}
print '<td class="right">'.$langs->trans('Qty').'</td>';
print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '<td class="left">'.$langs->trans('Unit').'</td>';
print '<td class="linecoluseunit left">'.$langs->trans('Unit').'</td>';
}
print '<td class="right">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecoldiscount right">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecolht right">'.$langs->trans('TotalHT').'</td>';
print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
print '</tr>';
@ -5397,16 +5398,20 @@ abstract class CommonObject
return 1;
} else {
$outputlangs->charset_output = $sav_charset_output;
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
$this->error = $obj->error;
$this->errors = $obj->errors;
dol_syslog("Error generating document for ".__CLASS__.". Error: ".$obj->error, LOG_ERR);
return -1;
}
} else {
if (!$filefound) {
$this->error = $langs->trans("Error").' Failed to load doc generator with modelpaths='.$modelspath.' - modele='.$modele;
dol_print_error('', $this->error);
$this->errors[] = $this->error;
dol_syslog($this->error, LOG_ERR);
} else {
$this->error = $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $filefound);
dol_print_error('', $this->error);
$this->errors[] = $this->error;
dol_syslog($this->error, LOG_ERR);
}
return -1;
}

View File

@ -6174,19 +6174,22 @@ class Form
* - local date in user area, if set_time is '' (so if set_time is '', output may differs when done from two different location)
* - Empty (fields empty), if set_time is -1 (in this case, parameter empty must also have value 1)
*
* @param integer $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
* @param integer $set_time Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
* @param integer $set_time_end Pre-selected date (must be a local PHP server timestamp), -1 to keep date not preselected, '' to use current date with 00:00 hour (Parameter 'empty' must be 0 or 2).
* @param string $prefix Prefix for fields name
* @param string $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
* @return string Html for selectDate
* @param string $prefix Prefix for fields name
* @param string $empty 0=Fields required, 1=Empty inputs are allowed, 2=Empty inputs are allowed for hours only
* @param string $forcenewline Force new line between the 2 dates.
* @return string Html for selectDate
* @see form_date(), select_month(), select_year(), select_dayofweek()
*/
public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0)
public function selectDateToDate($set_time = '', $set_time_end = '', $prefix = 're', $empty = 0, $forcenewline = 0)
{
global $langs;
$ret = $this->selectDate($set_time, $prefix.'_start', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"), 'tzuserrel');
$ret .= '<br>';
if ($forcenewline) {
$ret .= '<br>';
}
$ret .= $this->selectDate($set_time_end, $prefix.'_end', 0, 0, $empty, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"), 'tzuserrel');
return $ret;
}

View File

@ -790,7 +790,7 @@ class FormFile
}
// Button
$genbutton = '<input class="button buttongen reposition" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton = '<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton .= ' type="submit" value="'.$buttonlabel.'"';
if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
$genbutton .= ' disabled';
@ -928,7 +928,7 @@ class FormFile
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
$out .= img_picto($langs->trans("FileSharedViaALink"), 'globe').' ';
$out .= '<input type="text" class="quatrevingtpercentminusx width75" id="downloadlink'.$file['rowid'].'" name="downloadexternallink" title="'.dol_escape_htmltag($langs->trans("FileSharedViaALink")).'" value="'.dol_escape_htmltag($fulllink).'">';
$out .= '<input type="text" class="quatrevingtpercentminusx width75 nopadding small" id="downloadlink'.$file['rowid'].'" name="downloadexternallink" title="'.dol_escape_htmltag($langs->trans("FileSharedViaALink")).'" value="'.dol_escape_htmltag($fulllink).'">';
$out .= ajax_autoselect('downloadlink'.$file['rowid']);
} else {
//print '<span class="opacitymedium">'.$langs->trans("FileNotShared").'</span>';
@ -1451,7 +1451,7 @@ class FormFile
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
print img_picto($langs->trans("FileSharedViaALink"), 'globe').' ';
print '<input type="text" class="quatrevingtpercent minwidth200imp" id="downloadlink'.$filearray[$key]['rowid'].'" name="downloadexternallink" title="'.dol_escape_htmltag($langs->trans("FileSharedViaALink")).'" value="'.dol_escape_htmltag($fulllink).'">';
print '<input type="text" class="quatrevingtpercent minwidth200imp nopadding small" id="downloadlink'.$filearray[$key]['rowid'].'" name="downloadexternallink" title="'.dol_escape_htmltag($langs->trans("FileSharedViaALink")).'" value="'.dol_escape_htmltag($fulllink).'">';
} else {
//print '<span class="opacitymedium">'.$langs->trans("FileNotShared").'</span>';
}
@ -1931,7 +1931,7 @@ class FormFile
$fulllink = $urlwithroot.'/document.php'.($paramlink ? '?'.$paramlink : '');
print img_picto($langs->trans("FileSharedViaALink"), 'globe').' ';
print '<input type="text" class="quatrevingtpercent width100 nopadding" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
print '<input type="text" class="quatrevingtpercent width100 nopadding nopadding small" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
}
//if (! empty($useinecm) && $useinecm != 6) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart;
//if ($forcedownload) print '&attachment=1';

View File

@ -6521,7 +6521,8 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
{
$allowed_tags = array(
"html", "head", "meta", "body", "article", "a", "abbr", "b", "blockquote", "br", "cite", "div", "dl", "dd", "dt", "em", "font", "img", "ins", "hr", "i", "li", "link",
"ol", "p", "q", "s", "section", "span", "strike", "strong", "title", "table", "tr", "th", "td", "u", "ul", "sup", "sub", "blockquote", "pre", "h1", "h2", "h3", "h4", "h5", "h6"
"ol", "p", "q", "s", "section", "span", "strike", "strong", "title", "table", "tr", "th", "td", "u", "ul", "sup", "sub", "blockquote", "pre", "h1", "h2", "h3", "h4", "h5", "h6",
"comment" // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment>
);
if ($allowiframe) {
$allowed_tags[] = "iframe";
@ -6534,7 +6535,8 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
$stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
$stringtoclean = preg_replace('/<!--[^>]*-->/', '', $stringtoclean);
//$stringtoclean = preg_replace('/<!--[^>]*-->/', '', $stringtoclean);
$stringtoclean = preg_replace('/<!--([^>]*)-->/', '<comment>\1</comment>', $stringtoclean);
$stringtoclean = preg_replace('/&colon;/i', ':', $stringtoclean);
$stringtoclean = preg_replace('/&#58;|&#0+58|&#x3A/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...'
@ -6557,6 +6559,9 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1,
$temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE
$temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments
return $temp;
}

View File

@ -675,7 +675,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$checkonentitydone = 0;
// Array to define rules of checks to do
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website'); // Test on entity only (Objects with no link to company)
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'salaries', 'website', 'recruitment'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object

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

@ -28,20 +28,20 @@ if (empty($conf) || !is_object($conf)) {
<!-- BEGIN PHP TEMPLATE originproductline.tpl.php -->
<?php
print '<tr data-id="'.$this->tpl['id'].'" class="oddeven'.(empty($this->tpl['strike']) ? '' : ' strikefordisabled').'">';
print '<td>'.$this->tpl['label'].'</td>';
print '<td>'.$this->tpl['description'].'</td>';
print '<td class="right">'.$this->tpl['vat_rate'].'</td>';
print '<td class="right">'.$this->tpl['price'].'</td>';
print '<td class="linecolref">'.$this->tpl['label'].'</td>';
print '<td class="linecoldescription">'.$this->tpl['description'].'</td>';
print '<td class="linecolvat right">'.$this->tpl['vat_rate'].'</td>';
print '<td class="linecoluht right">'.$this->tpl['price'].'</td>';
if (!empty($conf->multicurrency->enabled)) {
print '<td class="right">'.$this->tpl['multicurrency_price'].'</td>';
print '<td class="linecoluht_currency right">'.$this->tpl['multicurrency_price'].'</td>';
}
print '<td class="right">'.$this->tpl['qty'].'</td>';
print '<td class="linecolqty right">'.$this->tpl['qty'].'</td>';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
print '<td class="left">'.$langs->trans($this->tpl['unit']).'</td>';
print '<td class="linecoluseunit left">'.$langs->trans($this->tpl['unit']).'</td>';
}
print '<td class="right">'.$this->tpl['remise_percent'].'</td>';
print '<td class="linecoldiscount right">'.$this->tpl['remise_percent'].'</td>';
print '<td class="linecolht right">'.$this->tpl['total_ht'].'</td>';
$selected = 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

@ -376,7 +376,7 @@ if (!empty($object->share)) {
print img_picto('', 'globe').' ';
if ($action != 'edit') {
print '<input type="text" class="quatrevingtpercent" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
print '<input type="text" class="quatrevingtpercent nopadding small" id="downloadlink" name="downloadexternallink" value="'.dol_escape_htmltag($fulllink).'">';
} else {
print $fulllink;
}

View File

@ -2179,8 +2179,8 @@ class Expedition extends CommonObject
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.'expedition SET fk_statut='.self::STATUS_CLOSED;
$sql .= " WHERE rowid = ".((int) $this->id).' AND fk_statut > 0';
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET fk_statut = ".self::STATUS_CLOSED;
$sql .= " WHERE rowid = ".((int) $this->id)." AND fk_statut > 0";
$resql = $this->db->query($sql);
if ($resql) {
@ -2208,8 +2208,8 @@ class Expedition extends CommonObject
}
}
$this->statut = self::STATUS_CLOSED;
$this->statut = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
$this->status = self::STATUS_CLOSED; // Will be revert to STATUS_VALIDATED at end if there is a rollback
// If stock increment is done on closing
if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
@ -2221,10 +2221,12 @@ class Expedition extends CommonObject
// TODO possibilite d'expedier a partir d'une propale ou autre origine ?
$sql = "SELECT cd.fk_product, cd.subprice,";
$sql .= " ed.rowid, ed.qty, ed.fk_entrepot,";
$sql .= " e.ref,";
$sql .= " edb.rowid as edbrowid, edb.eatby, edb.sellby, edb.batch, edb.qty as edbqty, edb.fk_origin_stock";
$sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
$sql .= " ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."expeditiondet_batch as edb on edb.fk_expeditiondet = ed.rowid";
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."expedition as e ON ed.fk_expedition = e.rowid";
$sql .= " WHERE ed.fk_expedition = ".((int) $this->id);
$sql .= " AND cd.rowid = ed.fk_origin_line";
@ -2252,7 +2254,7 @@ class Expedition extends CommonObject
// line without batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr", $numref));
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr", $obj->ref));
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -2262,7 +2264,7 @@ class Expedition extends CommonObject
// line with batch detail
// We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr", $numref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
$result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ShipmentClassifyClosedInDolibarr", $obj->ref), '', $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock);
if ($result < 0) {
$this->error = $mouvS->error;
$this->errors = $mouvS->errors;
@ -2293,6 +2295,8 @@ class Expedition extends CommonObject
return 1;
} else {
$this->statut = self::STATUS_VALIDATED;
$this->status = self::STATUS_VALIDATED;
$this->db->rollback();
return -1;
}

View File

@ -211,6 +211,34 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
// If massaction is close
if ($massaction == 'classifyclose') {
$error=0;
$selectids = GETPOST('toselect', 'array');
foreach ($selectids as $selectid) {
// $object->fetch($selectid);
$object->fetch($selectid);
$result = $object->setClosed();
}
$massaction = $action = 'classifyclose';
if ($result < 0) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessage($langs->trans("Close Done"));
header('Location: '.$_SERVER["PHP_SELF"]);
exit;
} else {
$db->rollback();
exit;
}
}
/*
* View
@ -489,7 +517,7 @@ $param .= $hookmanager->resPrint;
$arrayofmassactions = array(
'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged
'classifyclose'=>$langs->trans("Close"),
'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if (in_array($massaction, array('presend'))) {

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

@ -160,11 +160,12 @@ class PaiementFourn extends Paiement
$error = 0;
$way = $this->getWay();
$now = dol_now();
// Clean parameters
$totalamount = 0;
$totalamount_converted = 0;
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$atleastonepaymentnotnull = 0;
if ($way == 'dolibarr') {
$amounts = &$this->amounts;
@ -174,23 +175,62 @@ class PaiementFourn extends Paiement
$amounts_to_update = &$this->amounts;
}
$currencyofpayment = '';
foreach ($amounts as $key => $value) {
if (empty($value)) {
continue;
}
// $key is id of invoice, $value is amount, $way is a 'dolibarr' if amount is in main currency, 'customer' if in foreign currency
$value_converted = Multicurrency::getAmountConversionFromInvoiceRate($key, $value ? $value : 0, $way, 'facture_fourn');
// Add controls of input validity
if ($value_converted === false) {
// We failed to find the conversion for one invoice
$this->error = 'FailedToFoundTheConversionRateForInvoice';
return -1;
}
if (empty($currencyofpayment)) {
$currencyofpayment = $this->multicurrency_code[$key];
}
if ($currencyofpayment != $this->multicurrency_code[$key]) {
// If we have invoices with different currencies in the payment, we stop here
$this->error = 'ErrorYouTryToPayInvoicesWithDifferentCurrenciesInSamePayment';
return -1;
}
$totalamount_converted += $value_converted;
$amounts_to_update[$key] = price2num($value_converted, 'MT');
$newvalue = price2num($value, 'MT');
$amounts[$key] = $newvalue;
$totalamount += $newvalue;
if (!empty($newvalue)) {
$atleastonepaymentnotnull++;
}
}
if (!empty($currencyofpayment)) {
// We must check that the currency of invoices is the same than the currency of the bank
$bankaccount = new Account($this->db);
$bankaccount->fetch($this->fk_account);
$bankcurrencycode = empty($bankaccount->currency_code) ? $conf->currency : $bankaccount->currency_code;
if ($currencyofpayment != $bankcurrencycode && $currencyofpayment != $conf->currency && $bankcurrencycode != $conf->currency) {
$langs->load("errors");
$this->error = $langs->trans('ErrorYouTryToPayInvoicesInACurrencyFromBankWithAnotherCurrency', $currencyofpayment, $bankcurrencycode);
return -1;
}
}
$totalamount = price2num($totalamount);
$totalamount_converted = price2num($totalamount_converted);
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$this->db->begin();
if ($totalamount <> 0) { // On accepte les montants negatifs
$ref = $this->getNextNumRef(is_object($thirdparty) ? $thirdparty : '');
$now = dol_now();
if ($way == 'dolibarr') {
$total = $totalamount;
@ -346,7 +386,7 @@ class PaiementFourn extends Paiement
$this->total = $total;
$this->multicurrency_amount = $mtotal;
$this->db->commit();
dol_syslog('PaiementFourn::Create Ok Total = '.$this->total);
dol_syslog('PaiementFourn::Create Ok Total = '.$this->amount.', Total currency = '.$this->multicurrency_amount);
return $this->id;
} else {
$this->db->rollback();

View File

@ -3192,7 +3192,7 @@ if ($action == 'create') {
}
// Show link for "recalculate"
if ($object->getVentilExportCompta() == 0) {
$s = '<span class="hideonsmartphone">'.$langs->trans("ReCalculate").' </span>';
$s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
$s .= ' / ';
$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';

View File

@ -268,6 +268,8 @@ if (empty($reshook)) {
$datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$multicurrency_code = array();
// Clean parameters amount if payment is for a credit note
foreach ($amounts as $key => $value) { // How payment is dispatched
$tmpinvoice = new FactureFournisseur($db);
@ -276,6 +278,7 @@ if (empty($reshook)) {
$newvalue = price2num($value, 'MT');
$amounts[$key] = - abs($newvalue);
}
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
}
foreach ($multicurrency_amounts as $key => $value) { // How payment is dispatched
@ -285,6 +288,7 @@ if (empty($reshook)) {
$newvalue = price2num($value, 'MT');
$multicurrency_amounts[$key] = - abs($newvalue);
}
$multicurrency_code[$key] = $tmpinvoice->multicurrency_code;
}
//var_dump($amounts);
@ -304,12 +308,16 @@ if (empty($reshook)) {
$paiement->datepaye = $datepaye;
$paiement->amounts = $amounts; // Array of amounts
$paiement->multicurrency_amounts = $multicurrency_amounts;
$paiement->multicurrency_code = $multicurrency_code; // Array with all currency of payments dispatching
$paiement->paiementid = GETPOST('paiementid', 'int');
$paiement->num_payment = GETPOST('num_paiement', 'alphanohtml');
$paiement->note_private = GETPOST('comment', 'alpha');
$paiement->fk_account = GETPOST('accountid', 'int');
if (!$error) {
// Create payment and update this->multicurrency_amounts if this->amounts filled or
// this->amounts if this->multicurrency_amounts filled.
// This also set ->amount and ->multicurrency_amount
$paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty);
if ($paiement_id < 0) {
setEventMessages($paiement->error, $paiement->errors, 'errors');
@ -318,7 +326,7 @@ if (empty($reshook)) {
}
if (!$error) {
$result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, '', '');
$result = $paiement->addPaymentToBank($user, 'payment_supplier', '(SupplierInvoicePayment)', $accountid, GETPOST('chqemetteur'), GETPOST('chqbank'));
if ($result < 0) {
setEventMessages($paiement->error, $paiement->errors, 'errors');
$error++;

View File

@ -471,10 +471,9 @@ if (empty($reshook)) {
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysToValidate");
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
$message .= "\n";
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
$message .= $langs->transnoentities("HolidaysToValidateBody")."\n";
$message .= "<p>".$langs->transnoentities("HolidaysToValidateBody")."</p>\n";
// option to warn the validator in case of too short delay
@ -484,8 +483,7 @@ if (empty($reshook)) {
$nowplusdelay = dol_time_plus_duree($now, $delayForRequest, 'd');
if ($object->date_debut < $nowplusdelay) {
$message .= "\n";
$message .= $langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."\n";
$message = "<p>".$langs->transnoentities("HolidaysToValidateDelay", $delayForRequest)."</p>\n";
}
}
}
@ -495,20 +493,21 @@ if (empty($reshook)) {
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
if ($nbopenedday > $object->getCPforUser($object->fk_user, $object->fk_type)) {
$message .= "\n";
$message .= $langs->transnoentities("HolidaysToValidateAlertSolde")."\n";
$message .= "<p>".$langs->transnoentities("HolidaysToValidateAlertSolde")."</p>\n";
}
}
$message .= "\n";
$message .= "- ".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message .= "- ".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."\n";
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
$message .= "\n";
$link = dol_buildpath("/holiday/card.php", 3) . '?id='.$object->id;
$message .= "<ul>";
$message .= "<li>".$langs->transnoentitiesnoconv("Name")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Period")." : ".dol_print_date($object->date_debut, 'day')." ".$langs->transnoentitiesnoconv("To")." ".dol_print_date($object->date_fin, 'day')."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>\n";
$trackid = 'leav'.$object->id;
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
// Sending the email
$result = $mail->sendfile();
@ -617,19 +616,20 @@ if (empty($reshook)) {
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysValidated");
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
$message .= "\n";
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
$message .= $langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
$message .= "<p>".$langs->transnoentities("HolidaysValidatedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
$message .= "- ".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
$message .= "\n";
$message .= "<ul>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("ValidatedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>\n";
$trackid = 'leav'.$object->id;
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
// Sending email
$result = $mail->sendfile();
@ -697,20 +697,21 @@ if (empty($reshook)) {
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysRefused");
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
$message .= "\n";
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
$message .= $langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
$message .= GETPOST('detail_refuse', 'alpha')."\n\n";
$message .= "<p>".$langs->transnoentities("HolidaysRefusedBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."<p>\n";
$message .= "<p>".GETPOST('detail_refuse', 'alpha')."</p>";
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
$message .= "\n";
$message .= "<ul>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>";
$trackid = 'leav'.$object->id;
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
// sending email
$result = $mail->sendfile();
@ -842,18 +843,20 @@ if (empty($reshook)) {
$subject = $societeName." - ".$langs->transnoentitiesnoconv("HolidaysCanceled");
// Content
$message = $langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",\n";
$message .= "\n";
$message = "<p>".$langs->transnoentitiesnoconv("Hello")." ".$destinataire->firstname.",</p>\n";
$message .= $langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."\n";
$message .= "- ".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."\n";
$message .= "<p>".$langs->transnoentities("HolidaysCanceledBody", dol_print_date($object->date_debut, 'day'), dol_print_date($object->date_fin, 'day'))."</p>\n";
$message .= "- ".$langs->transnoentitiesnoconv("Link")." : ".$dolibarr_main_url_root."/holiday/card.php?id=".$object->id."\n\n";
$message .= "\n";
$link = dol_buildpath('/holiday/card.php', 3).'?id='.$object->id;
$message .= "<ul>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("ModifiedBy")." : ".dolGetFirstLastname($expediteur->firstname, $expediteur->lastname)."</li>\n";
$message .= "<li>".$langs->transnoentitiesnoconv("Link").' : <a href="'.$link.'" target="_blank">'.$link."</a></li>\n";
$message .= "</ul>\n";
$trackid = 'leav'.$object->id;
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 0, '', '', $trackid);
$mail = new CMailFile($subject, $emailTo, $emailFrom, $message, array(), array(), array(), '', '', 0, 1, '', '', $trackid);
// sending email
$result = $mail->sendfile();

View File

@ -537,3 +537,7 @@ INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle, active) VALUES (154,
-- VMYSQL4.3 ALTER TABLE llx_user MODIFY COLUMN fk_soc integer NULL;
-- VPGSQL8.2 ALTER TABLE llx_user ALTER COLUMN fk_soc DROP NOT NULL;
-- 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. 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

@ -97,6 +97,12 @@ ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_soc (fk_type, fk_soc,
ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_member, date_partnership_start);
-- 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. 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;
-- v16
UPDATE llx_cronjob set label = 'RecurringInvoicesJob' where label = 'RecurringInvoices';
@ -302,6 +308,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;
@ -324,3 +333,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);

View File

@ -557,3 +557,8 @@ UPDATE llx_facturedet SET situation_percent = 100 WHERE situation_percent IS NUL
DELETE FROM llx_rights_def WHERE module = 'hrm' AND perms = 'employee';
-- Sequence to fix the content of llx_bank.amount_main_currency
-- DROP TABLE tmp_bank;
-- CREATE TABLE tmp_bank SELECT b.rowid, b.amount, p.rowid as pid, p.amount as pamount, p.multicurrency_amount as pmulticurrencyamount FROM llx_bank as b INNER JOIN llx_bank_url as bu ON bu.fk_bank=b.rowid AND bu.type = 'payment' INNER JOIN llx_paiement as p ON bu.url_id = p.rowid WHERE p.multicurrency_amount <> 0 AND p.multicurrency_amount <> p.amount;
-- UPDATE llx_bank as b SET b.amount_main_currency = (SELECT tb.pamount FROM tmp_bank as tb WHERE tb.rowid = b.rowid) WHERE b.amount_main_currency IS NULL;

View File

@ -24,7 +24,8 @@ create table llx_bank
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
datev date, -- date de valeur
dateo date, -- date operation
amount double(24,8) NOT NULL default 0,
amount double(24,8) NOT NULL default 0, -- amount in the currency of the bank account
amount_main_currency double(24,8) NULL, -- amount in the main currency of the company
label varchar(255),
fk_account integer,
fk_user_author integer,

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

@ -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

@ -144,6 +144,9 @@ AsciiToPdfConverter=Ascii to PDF converter
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required
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

@ -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
@ -2322,9 +2348,7 @@ function top_menu_quickadd()
$html .= '<!-- div for quick add link -->
<div id="topmenu-quickadd-dropdown" class="atoplogin dropdown inline-block">
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('QuickAdd').' ('.$langs->trans('QuickAddMenuShortCut').')">
<i class="fa fa-plus-circle" ></i>
</a>
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('QuickAdd').' ('.$langs->trans('QuickAddMenuShortCut').')"><i class="fa fa-plus-circle"></i></a>
<div class="dropdown-menu">'.printDropdownQuickadd().'</div>
</div>';
$html .= '
@ -2533,9 +2557,7 @@ function top_menu_bookmark()
} else {
$html .= '<!-- div for bookmark link -->
<div id="topmenu-bookmark-dropdown" class="dropdown inline-block">
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')">
<i class="fa fa-star" ></i>
</a>
<a class="dropdown-toggle login-dropdown-a" data-toggle="dropdown" href="#" title="'.$langs->trans('Bookmarks').' ('.$langs->trans('BookmarksMenuShortCut').')"><i class="fa fa-star"></i></a>
<div class="dropdown-menu">
'.printDropdownBookmarksList().'
</div>

View File

@ -466,9 +466,18 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module)) {
dolReplaceInFile($destfile2, $arrayreplacement);
} else {
$langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors');
if ($result1 <= 0) {
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile1), null, 'errors');
}
if ($result2 <= 0) {
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile2), null, 'errors');
}
}
// TODO Enable in class the property $isextrafieldmanaged = 1
// Now we update the object file to set $isextrafieldmanaged to 0
$srcfile = $dirins.'/'.strtolower($module).'/class/'.strtolower($objectname).'.class.php';
$arrayreplacement = array('/\$isextrafieldmanaged = 0;/' => '$isextrafieldmanaged = 1;');
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
@ -770,6 +779,8 @@ if ($dirins && $action == 'addlanguage' && !empty($module)) {
// remove/delete File
if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
$objectname = $tabobj;
$relativefilename = dol_sanitizePathName(GETPOST('file', 'restricthtml'));
if ($relativefilename) {
$dirnametodelete = dirname($relativefilename);
@ -780,6 +791,19 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
if (!$result) {
setEventMessages($langs->trans("ErrorFailToDeleteFile", basename($filetodelete)), null, 'errors');
} else {
// If we delete a sql file
if (preg_match('/\.sql$/', $relativefilename)) {
if (preg_match('/\.key\.sql$/', $relativefilename)) {
$relativefilename = preg_replace('/\.key\.sql$/', '.sql', $relativefilename);
$filetodelete = $dirins.'/'.$relativefilename;
$result = dol_delete_file($filetodelete);
} elseif (preg_match('/\.sql$/', $relativefilename)) {
$relativefilename = preg_replace('/\.sql$/', '.key.sql', $relativefilename);
$filetodelete = $dirins.'/'.$relativefilename;
$result = dol_delete_file($filetodelete);
}
}
if (dol_is_dir_empty($dirtodelete)) {
dol_delete_dir($dirtodelete);
}
@ -790,6 +814,11 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
$arrayreplacement = array('/^\s*\''.preg_quote('/'.$relativefilename, '/').'\',*/m'=>' // \'/'.$relativefilename.'\',');
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
// Now we update the object file to set $isextrafieldmanaged to 0
$srcfile = $dirins.'/'.strtolower($module).'/class/'.strtolower($objectname).'.class.php';
$arrayreplacement = array('/\$isextrafieldmanaged = 1;/' => '$isextrafieldmanaged = 0;');
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
}
}
}
@ -1986,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';
@ -2046,6 +2080,7 @@ if ($module == 'initmodule') {
// Note module is inside $dirread
if ($tab == 'description') {
print '<!-- tab=description -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$pathtofilereadme = $modulelowercase.'/README.md';
$pathtochangelog = $modulelowercase.'/ChangeLog.md';
@ -2128,7 +2163,9 @@ if ($module == 'initmodule') {
print '<tr><td>';
print $langs->trans("EditorUrl");
print '</td><td>';
print $moduleobj->editor_url;
if (!empty($moduleobj->editor_url)) {
print '<a href="'.$moduleobj->editor_url.'" class="_blank" rel="noopener">'.$moduleobj->editor_url.' '.img_picto('', 'globe').'</a>';
}
print '</td></tr>';
print '<tr><td>';
@ -2204,6 +2241,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'languages') {
print '<!-- tab=languages -->'."\n";
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">'.$langs->trans("LanguageDefDesc").'</span><br>';
print '<br>';
@ -2243,7 +2281,7 @@ if ($module == 'initmodule') {
$pathtofile = 'langs/'.$langfile['relativename'];
}
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : <strong>'.$pathtofile.'</strong>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=txt&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=ini&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
print '</td>';
}
@ -2279,6 +2317,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'dictionaries') {
print '<!-- tab=dictionaries -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$dicts = $moduleobj->dictionaries;
@ -2313,7 +2352,7 @@ if ($module == 'initmodule') {
print '<table class="noborder">';
print '<tr class="liste_titre">';
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, ' aaa ');
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'thsticky thstickygrey ');
print_liste_field_titre("Table", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Label", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("SQL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
@ -2331,7 +2370,7 @@ if ($module == 'initmodule') {
while ($i < $maxi) {
print '<tr class="oddeven">';
print '<td>';
print '<td class="tdsticky tdstickygray">';
print ($i + 1);
print '</td>';
@ -2375,7 +2414,7 @@ if ($module == 'initmodule') {
$i++;
}
} else {
print '<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
print '<tr><td colspan="10"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print '</table>';
@ -2409,6 +2448,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'objects') {
print '<!-- tab=objects -->'."\n";
$head3 = array();
$h = 0;
@ -2570,8 +2610,9 @@ if ($module == 'initmodule') {
print '<div class="fichehalfleft smallxxx">';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
// API file
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).($realpathtoapi ? '' : '</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong>'.($realpathtoapi ? '' : '<strike>').(dol_is_file($realpathtoapi)?'':'<span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span>').($realpathtoapi ? '' : '</strike>').'</strong>';
if (dol_is_file($realpathtoapi)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoapi).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
@ -2588,7 +2629,7 @@ if ($module == 'initmodule') {
}
// PHPUnit
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).($realpathtophpunit ? '' : '</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong>'.($realpathtophpunit ? '' : '<strike>').(dol_is_file($realpathtophpunit)?'':'<span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit)?'':'</span>').($realpathtophpunit ? '' : '</strike>').'</strong>';
if (dol_is_file($realpathtophpunit)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
@ -2621,7 +2662,7 @@ if ($module == 'initmodule') {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=sql&file='.urlencode($pathtosqlkey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).($realpathtosqlextra ? '' : '</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileExtraFields").' : <strong>'.($realpathtosqlextra ? '' : '<strike>').(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '<span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextra).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '</span">').($realpathtosqlextra ? '' : '</strike>').'</strong>';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&file='.urlencode($pathtosqlextra).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
@ -2633,7 +2674,7 @@ if ($module == 'initmodule') {
}
//print ' &nbsp; <a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("RunSql").'</a>';
print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKeyExtraFields").' : <strong>'.($realpathtosqlextrakey ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).($realpathtosqlextrakey ? '' : '</strike>').'</strong>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFileKeyExtraFields").' : <strong>'.($realpathtosqlextrakey ? '' : '<strike>').(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '<span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtosqlextrakey).(dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey) ? '' : '</span">').($realpathtosqlextrakey ? '' : '</strike>').'</strong>';
if (dol_is_file($realpathtosqlextra) && dol_is_file($realpathtosqlextrakey)) {
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=sql&file='.urlencode($pathtosqlextrakey).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print ' ';
@ -2726,7 +2767,7 @@ if ($module == 'initmodule') {
print '<div class="div-table-responsive">';
print '<table class="noborder small">';
print '<tr class="liste_titre">';
print '<th class="thsticky thstickygray">'.$langs->trans("Property");
print '<th class="none">'.$langs->trans("Property");
print ' (<a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeExamples").'</a>)';
print '</th>';
print '<th>';
@ -2752,7 +2793,7 @@ if ($module == 'initmodule') {
//print '<th class="center">'.$langs->trans("Disabled").'</th>';
print '<th>'.$form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")).'</th>';
print '<th>'.$langs->trans("Comment").'</th>';
print '<th class="thstickyright tdstickyghostwhite"></th>';
print '<th class="none"></th>';
print '</tr>';
// We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobjet->fields may have been
@ -2763,7 +2804,7 @@ if ($module == 'initmodule') {
if (!empty($properties)) {
// Line to add a property
print '<tr>';
print '<td class="tdsticky tdstickygray"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>';
print '<td class="none"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval', 'restricthtml')).'"></td>';
@ -3075,6 +3116,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'menus') {
print '<!-- tab=menus -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$menus = $moduleobj->menu;
@ -3105,6 +3147,7 @@ if ($module == 'initmodule') {
print '<table class="noborder small">';
print '<tr class="liste_titre">';
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'thsticky ');
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
@ -3120,9 +3163,16 @@ if ($module == 'initmodule') {
print "</tr>\n";
if (count($menus)) {
$i = 0;
foreach ($menus as $menu) {
$i++;
print '<tr class="oddeven">';
print '<td class="tdsticky tdstickygray">';
print $i;
print '</td>';
print '<td>';
print dol_escape_htmltag($menu['type']);
print '</td>';
@ -3208,6 +3258,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'permissions') {
print '<!-- tab=permissions -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$perms = $moduleobj->rights;
@ -3253,7 +3304,7 @@ if ($module == 'initmodule') {
print '</td>';
print '<td>';
print $perm[1];
print $langs->trans($perm[1]);
print '</td>';
print '<td>';
@ -3301,6 +3352,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'hooks') {
print '<!-- tab=hooks -->'."\n";
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">'.$langs->trans("HooksDefDesc").'</span><br>';
print '<br>';
@ -3321,7 +3373,7 @@ if ($module == 'initmodule') {
print '<strong>'.$pathtohook.'</strong>';
print '</td>';
print '<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} else {
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inithook&format=php&file='.urlencode($pathtohook).'">'.img_picto('Generate', 'generate', 'class="paddingleft"').'</td>';
@ -3355,6 +3407,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'triggers') {
print '<!-- tab=triggers -->'."\n";
require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php';
$interfaces = new Interfaces($db);
@ -3380,7 +3433,7 @@ if ($module == 'initmodule') {
print '<tr><td>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("TriggersFile").' : <strong>'.$pathtofile.'</strong>';
print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
print '<td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
print '<td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($pathtofile).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
print '</tr>';
}
} else {
@ -3420,6 +3473,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'css') {
print '<!-- tab=css -->'."\n";
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">'.$langs->trans("CSSDesc").'</span><br>';
print '<br>';
@ -3431,8 +3485,8 @@ if ($module == 'initmodule') {
print '<span class="fa fa-file-o"></span> '.$langs->trans("CSSFile").' : ';
if (dol_is_file($dirins.'/'.$pathtohook)) {
print '<strong>'.$pathtohook.'</strong>';
print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} else {
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcss&format=php&file='.urlencode($pathtohook).'">'.img_picto('Generate', 'generate', 'class="paddingleft"').'</a></td>';
@ -3465,6 +3519,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'js') {
print '<!-- tab=js -->'."\n";
if ($action != 'editfile' || empty($file)) {
print '<span class="opacitymedium">'.$langs->trans("JSDesc").'</span><br>';
print '<br>';
@ -3510,6 +3565,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'widgets') {
print '<!-- tab=widgets -->'."\n";
require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
$widgets = ModeleBoxes::getWidgetsList(array('/'.strtolower($module).'/core/boxes'));
@ -3561,6 +3617,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'exportimport') {
print '<!-- tab=exportimport -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$exportlist = $moduleobj->export_label;
@ -3600,6 +3657,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'cli') {
print '<!-- tab=cli -->'."\n";
$clifiles = array();
$i = 0;
@ -3678,6 +3736,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'cron') {
print '<!-- tab=cron -->'."\n";
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
$cronjobs = $moduleobj->cronjobs;
@ -3799,6 +3858,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'specifications') {
print '<!-- tab=specifications -->'."\n";
$specs = dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$', array('\/temp\/'));
if ($action != 'editfile' || empty($file)) {
@ -3912,6 +3972,7 @@ if ($module == 'initmodule') {
}
if ($tab == 'buildpackage') {
print '<!-- tab=buildpackage -->'."\n";
print '<span class="opacitymedium">'.$langs->trans("BuildPackageDesc").'</span>';
print '<br>';
@ -3976,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

@ -755,6 +755,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),
);
/**
@ -771,6 +773,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

@ -272,6 +272,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -183,7 +183,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -214,6 +214,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER ['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -197,6 +197,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -176,6 +176,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -199,6 +199,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -198,6 +198,7 @@ if ($id > 0 || !empty($ref)) {
}
print '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$product->id.'" name="search_form">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
if (!empty($sortfield)) {
print '<input type="hidden" name="sortfield" value="'.$sortfield.'"/>';
}

View File

@ -909,10 +909,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
}
// Desired stock
print '<td class="right">'.($fk_entrepot > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
print '<td class="right">'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $desiredstockwarehouse : $desiredstock).'</td>';
// Limit stock for alert
print '<td class="right">'.($fk_entrepot > 0 ? $alertstockwarehouse : $alertstock).'</td>';
print '<td class="right">'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $alertstockwarehouse : $alertstock).'</td>';
// Current stock (all warehouses)
print '<td class="right">'.$warning.$stock;
@ -928,7 +928,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
print '<td class="right"><a href="replenishorders.php?search_product='.$prod->id.'">'.$ordered.'</a> '.$picto.'</td>';
// To order
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.($fk_entrepot > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
print '<td class="right"><input type="text" size="4" name="tobuy'.$i.'" value="'.((!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entrepot > 0) > 0 ? $stocktobuywarehouse : $stocktobuy).'"></td>';
// Supplier
print '<td class="right">';

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

@ -249,7 +249,7 @@ $arrayfields = array(
's.idprof6'=>array('label'=>"ProfId6Short", 'position'=>45, 'checked'=>$checkedprofid6),
's.tva_intra'=>array('label'=>"VATIntraShort", 'position'=>50, 'checked'=>0),
'customerorsupplier'=>array('label'=>'NatureOfThirdParty', 'position'=>61, 'checked'=>1),
's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'position'=>62, 'checked'=>$checkprospectlevel),
's.fk_prospectlevel'=>array('label'=>"ProspectLevel", 'position'=>62, 'checked'=>$checkprospectlevel),
's.fk_stcomm'=>array('label'=>"StatusProsp", 'position'=>63, 'checked'=>$checkstcomm),
's2.nom'=>array('label'=>'ParentCompany', 'position'=>64, 'checked'=>0),
's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
@ -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('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
$arrayofmassactions = array();
@ -1645,7 +1648,7 @@ while ($i < min($num, $limit)) {
$titlealt = $val['label'];
}
if ($obj->stcomm_id != $val['id']) {
print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.urlencode($val['code']).'&action=setstcomm&token='.newToken().$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
print '<a class="pictosubstatus reposition" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.urlencode($val['code']).'&action=setstcomm&token='.newToken().$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code'], $val['picto']).'</a>';
}
}
print '</div></div></td>';

View File

@ -1426,7 +1426,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$out .= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss);
}
// Button
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton = '<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton .= ' type="submit" value="'.$buttonlabel.'"';
if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
$genbutton .= ' disabled';
@ -1529,7 +1529,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard'
$out.= ajax_combobox('model');
//print $out;
$buttonlabel=$langs->trans("Generate");
$genbutton = '<input class="button buttongen" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton = '<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"';
$genbutton.= '>';
print $genbutton;

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

@ -96,8 +96,6 @@ button.dropdown-item.global-search-item {
box-shadow: 0 6px 12px rgba(0,0,0,.175);
}
.dropdown-menu {
border-color: #eee;
position: absolute;
top: 100%;
left: 0;
@ -112,7 +110,6 @@ button.dropdown-item.global-search-item {
background-color: #fff;
-webkit-background-clip: padding-box;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0,0,0,.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
@ -500,8 +497,19 @@ div.quickaddblock:focus {
right: 0;
}
#topmenu-quickadd-dropdown .dropdown-menu {
min-width: 220px;
max-width: 235px;
}
#topmenu-bookmark-dropdown .dropdown-menu {
min-width: 280px;
min-width: 220px;
max-width: 360px;
}
.dropdown-menu {
border: none;
-webkit-box-shadow: none;
box-shadow: none;
}
}

View File

@ -78,6 +78,7 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
--colortexttitle: rgb(220,220,220);
--colortext: rgb(220,220,220);
--colortextlink: #4390dc;
--colortexttitlelink: #4390dc;
--colortextbackhmenu: rgb(220,220,220);
--colortextbackvmenu: rgb(220,220,220);
--tooltipfontcolor : rgb(220,220,220);
@ -4096,7 +4097,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste
font-family: <?php print $fontlist ?>;
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
vertical-align: middle;
height: 24px;
height: 28px;
}
tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a {
text-shadow: none !important;
@ -4222,8 +4223,8 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) .oddeven.tagtr:nt
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair2) 0%, var(--colorbacklineimpair2) 100%);
}
.noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre),
.noborder .oddeven.tagtr:nth-child(even):not(:last-child) .tagtd:not(.liste_titre)
.noborder > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre),
.noborder .oddeven.tagtr:nth-child(even):not(:last-of-type) .tagtd:not(.liste_titre)
{
border-bottom: 1px solid #e0e0e0;
}
@ -5967,6 +5968,12 @@ span.select2.select2-container.select2-container--default {
border-right: none;
<?php } ?>
}
span.select2.select2-container.select2-container--default {
<?php if (empty($conf->global->THEME_SHOW_BORDER_ON_INPUT)) { ?>
//border-bottom: solid 1px var(--inputbordercolor);
<?php } ?>
}
input.select2-input {
border-bottom: none ! important;
}
@ -5985,7 +5992,7 @@ input.select2-input {
border: none;
}
.select2-container--focus span.select2-selection.select2-selection--single {
border-bottom: 1px solid #666 !important;
border-bottom: 1px solid var(--inputbordercolor) !important;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
@ -5996,14 +6003,14 @@ input.select2-input {
background-color: var(--colorbackvmenu1);
}
.select2-container--default .select2-selection--single {
background-color: var(--colorbackbody);
background-color: var(--inputbackgroundcolor);
}
#blockvmenusearch .select2-container--default .select2-selection--single .select2-selection__placeholder {
color: var(--colortextbackvmenu);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: var(--colortext);
/* background-color: var(--colorbackvmenu1); */
/* background-color: var(--inputbackgroundcolor); */
}
.select2-default {
color: #999 !important;

View File

@ -21,20 +21,26 @@ button.dropdown-item.global-search-item {
}
#topmenu-bookmark-dropdown a.login-dropdown-a {
#topmenu-quickadd-dropdown a.login-dropdown-a, #topmenu-bookmark-dropdown a.login-dropdown-a {
color: #fff;
}
div#topmenu-quickadd-dropdown {
position: fixed;
right: 65px;
top: 0px;
}
div#topmenu-bookmark-dropdown {
position: fixed;
right: 20px;
top: 0px;
}
#topmenu-login-dropdown .dropdown-toggle:after {
display: none;
}
#topmenu-bookmark-dropdown .dropdown-menu {
#topmenu-quickadd-dropdown .dropdown-menu, #topmenu-bookmark-dropdown .dropdown-menu {
min-width: 300px;
max-width: 360px;
}
@ -43,8 +49,8 @@ button.dropdown-item.global-search-item {
outline: none;
}
.open>.dropdown-search, .open>.dropdown-bookmark, .open>.dropdown-menu{
display: block;
.open>.dropdown-search, .open>.dropdown-quickadd, .open>.dropdown-bookmark, .open>.dropdown-menu{
display: block !important;
}
.dropdown-search {
@ -194,7 +200,7 @@ button.dropdown-item.global-search-item {
max-width: 100%;
}
div#topmenu-global-search-dropdown, div#topmenu-bookmark-dropdown {
div#topmenu-global-search-dropdown, div#topmenu-quickadd-dropdown, div#topmenu-bookmark-dropdown {
line-height: 46px;
}
a.top-menu-dropdown-link {
@ -255,7 +261,8 @@ a.top-menu-dropdown-link {
max-height: calc(90vh - 110px) ;
white-space: normal;
}
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body{
#topmenu-quickadd-dropdown .dropdown-menu > .bookmark-body, #topmenu-quickadd-dropdown .dropdown-body,
#topmenu-bookmark-dropdown .dropdown-menu > .bookmark-body, #topmenu-bookmark-dropdown .dropdown-body {
max-height: 60vh ; /* fallback for browsers without support for calc() */
max-height: calc(90vh - 200px) ;
}
@ -277,7 +284,7 @@ a.top-menu-dropdown-link {
}
#topmenu-login-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
#topmenu-login-dropdown, #topmenu-quickadd-dropdown, #topmenu-bookmark-dropdown, #topmenu-global-search-dropdown {
padding: 0 5px 0 5px;
}
#topmenu-login-dropdown a:hover{
@ -417,10 +424,18 @@ a.top-menu-dropdown-link {
/* smartphone */
@media only screen and (max-width: 767px)
{
#topmenu-quickadd-dropdown .dropdown-menu {
min-width: 220px;
max-width: 235px;
}
#topmenu-bookmark-dropdown .dropdown-menu {
min-width: 220px;
max-width: 360px;
}
#topmenu-bookmark-dropdown a.login-dropdown-a {
color: #000;
}
#topmenu-bookmark-dropdown .dropdown-menu {
width: 230px;
}

View File

@ -466,6 +466,9 @@ input, select {
-webkit-box-shadow: 0px 0px 6px 1px rgb(50 50 50 / 40%), 0px 0px 0px rgb(60 60 60 / 10%);
box-shadow: 0px 0px 6px 1px rgb(50 50 50 / 40%), 0px 0px 0px rgb(60 60 60 / 10%);
}
#mainbody input.buttongen, #mainbody button.buttongen {
padding: 3px 4px;
}
input.button.massactionconfirmed {
margin: 4px;
@ -2267,6 +2270,7 @@ div.nopadding {
}
td.nobordernopadding.widthpictotitle.col-picto {
color: #bbb;
opacity: 0.9;
}
.pictotitle {
@ -2276,6 +2280,9 @@ td.nobordernopadding.widthpictotitle.col-picto {
.pictoobjectwidth {
width: 14px;
}
span.widthpictotitle {
font-size: 1.3em;
}
.table-list-of-attached-files .col-picto, .table-list-of-links .col-picto {
opacity: 0.7 !important;
font-size: 1em;
@ -4149,7 +4156,7 @@ tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste
font-family: <?php print $fontlist ?>;
font-weight: <?php echo $useboldtitle ? 'bold' : 'normal'; ?>;
vertical-align: middle;
height: 24px;
height: 28px;
}
tr.liste_titre th a, th.liste_titre a, tr.liste_titre td a, td.liste_titre a, form.liste_titre div a, div.liste_titre a {
text-shadow: none !important;
@ -4275,8 +4282,8 @@ div:not(.fichecenter):not(.fichehalfleft):not(.fichehalfright) .oddeven.tagtr:nt
background: -moz-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
background: -webkit-linear-gradient(bottom, var(--colorbacklineimpair1) 0%, var(--colorbacklineimpair2) 100%);
}
.noborder > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-child) td:not(.liste_titre),
.noborder .tagtr:nth-child(even):not(:last-child) .oddeven.tagtd:not(.liste_titre)
.noborder > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre), .liste > tbody > tr:nth-child(even):not(:last-of-type) td:not(.liste_titre),
.noborder .tagtr:nth-child(even):not(:last-of-type) .oddeven.tagtd:not(.liste_titre)
{
border-bottom: 1px solid #ddd;
}
@ -7346,10 +7353,7 @@ if (is_object($db)) {
background: #ddd;
}
div#topmenu-bookmark-dropdown {
position: fixed;
right: 20px;
}
/* Must be at end */
div.flot-text .flot-tick-label .tickLabel, .fa-color-unset {

View File

@ -619,7 +619,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$db->free($resql);
if ($num <= 0) {
print '<td colspan="5" class="opacitymedium">'.$langs->trans("None").'</a>';
print '<td colspan="5"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
}
print "</table>";
} else {
@ -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">';
@ -671,7 +674,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$db->free($resql);
if ($num <= 0) {
print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>';
print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
}
print "</table>";
} else {
@ -721,7 +724,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$db->free($resql);
if ($num <= 0) {
print '<td colspan="4" class="opacitymedium">'.$langs->trans("None").'</a>';
print '<td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></a>';
}
print "</table>";
} else {

View File

@ -1277,7 +1277,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Date birth
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
print '<td>';
print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0);
print $form->selectDate($dateofbirth, 'dateofbirth', 0, 0, 1, 'createuser', 1, 0, 0, '', 0, '', '', 1, '', '', 'tzserver');
print '</td>';
print "</tr>\n";
@ -1568,6 +1568,13 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</td>';
print "</tr>\n";
// Date of birth
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
print '<td>';
print dol_print_date($object->birth, 'day', 'tzserver');
print '</td>';
print "</tr>\n";
// Default warehouse
if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
@ -1846,7 +1853,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle', '', $canSendMail, $params);
}
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
$params = array(
'attr' => array(
'title' => '',
@ -1860,7 +1867,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=edit&token='.newToken(), '', true, $params);
}
} elseif ($caneditpassword && !$object->ldap_sid &&
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
$params = array(
'attr' => array(
'title' => '',
@ -1882,7 +1889,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$params['attr']['title'] = $langs->trans('UserDisabled');
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
print dolGetButtonAction($langs->trans('ReinitPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password&token='.newToken(), '', true, $params);
}
@ -1890,7 +1897,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$params['attr']['title'] = $langs->trans('UserDisabled');
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'#', '', false, $params);
} elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
if ($object->email) {
print dolGetButtonAction($langs->trans('SendNewPassword'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend&token='.newToken(), '', true, $params);
} else {
@ -1908,12 +1915,12 @@ if ($action == 'create' || $action == 'adduserldap') {
)
);
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
print dolGetButtonAction($langs->trans('Reactivate'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=enable&token='.newToken(), '', true, $params);
}
// Disable user
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
print dolGetButtonAction($langs->trans('DisableUser'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disable&token='.newToken(), '', true, $params);
} else {
if ($user->id == $id) {
@ -1923,7 +1930,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Delete
if ($user->id <> $id && $candisableuser &&
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) {
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
if ($user->admin || !$object->admin) { // If user edited is admin, delete is possible on for an admin
print dolGetButtonAction($langs->trans('DeleteUser'), '', 'default', $_SERVER['PHP_SELF'].'?action=delete&token='.newToken().'&id='.$object->id, '', true, $params);
} else {
@ -2759,9 +2766,9 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr><td>'.$langs->trans("DateOfBirth").'</td>';
print '<td>';
if ($caneditfield) {
echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0);
echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth, 'dateofbirth', 0, 0, 1, 'updateuser', 1, 0, 0, '', '', '', '', 1, '', '', 'tzserver');
} else {
print dol_print_date($object->birth, 'day');
print dol_print_date($object->birth, 'day', 'tzserver');
}
print '</td>';
print "</tr>\n";

View File

@ -1873,7 +1873,7 @@ class User extends CommonObject
$sql .= ", login = '".$this->db->escape($this->login)."'";
$sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null");
$sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth)."'" : 'null');
$sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null');
if (!empty($user->admin)) {
$sql .= ", admin = ".(int) $this->admin; // admin flag can be set/unset only by an admin user
}