diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 8b50a71deb0a7..629672d06c4ae 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -474,7 +474,7 @@ print "Clean $BUILDROOT\n"; $ret=`rm -f $BUILDROOT/$PROJECT/.buildpath`; $ret=`rm -fr $BUILDROOT/$PROJECT/.cache`; - $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.codeclimate.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.externalToolBuilders`; $ret=`rm -fr $BUILDROOT/$PROJECT/.git*`; $ret=`rm -fr $BUILDROOT/$PROJECT/.project`; @@ -484,8 +484,11 @@ $ret=`rm -fr $BUILDROOT/$PROJECT/.stickler.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.travis.yml`; $ret=`rm -fr $BUILDROOT/$PROJECT/.tx`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.pre-commit-config.yaml`; + $ret=`rm -fr $BUILDROOT/$PROJECT/.phan`; $ret=`rm -f $BUILDROOT/$PROJECT/build.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/phpstan.neon`; + $ret=`rm -fr $BUILDROOT/$PROJECT/phpstan.neon.dist`; $ret=`rm -f $BUILDROOT/$PROJECT/pom.xml`; $ret=`rm -f $BUILDROOT/$PROJECT/README-*.md`; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 71e457920742e..452bce9619186 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -418,42 +418,30 @@ } print ''; -print load_fiche_titre($langs->trans('CreationOptions'), '', ''); - -print ''; -print ''; -print ''; -print ''; -print ''; - -print "\n"; - -print ''; -print ''; -print ''; -print ''; - -print '
'.$langs->trans('Name').''.$langs->trans('Status').'
'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); -print ' '; -print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); -print '

'; -print '
'; /* * Other options - * */ + print load_fiche_titre($langs->trans("OtherOptions"), '', ''); print '
'; print ''; print ''; -print ""; -print ""; +print '
'; +print ''; print "\n"; -print ""; +print "\n"; +print ''; + +print ''; +print ''; +print ''; $substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); @@ -463,7 +451,7 @@ } $htmltext .= ''; -print '\n"; print '\n"; // Allow OnLine Sign print ''; -print ''; -print ''; +print ''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index bc0e4a3bec464..0e4bfa816a677 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -1228,7 +1228,7 @@ public function alreadyUsed($ignoresystem = 0) dol_print_error($this->db); } - dol_syslog("Module Blockedlog alreadyUsed with ignoresystem=".$ignoresystem." is ".json_encode($result)); + dol_syslog("Module Blockedlog alreadyUsed(ignoresystem=".$ignoresystem.") returns ".json_encode($result)); return $result; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 207743d770a4b..3ca29e1af4e57 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -2702,6 +2702,7 @@ public function sendEmailsReminder() // Load event $res = $this->fetch($actionCommReminder->fk_actioncomm); + if ($res > 0) $res = $this->fetch_thirdparty(); if ($res > 0) { // PREPARE EMAIL $errormesg = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 61f1a5f767fcf..a9283c8bd1880 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -2285,7 +2285,7 @@ // Alias name if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''; if (!$i) { @@ -2316,7 +2316,7 @@ // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; if (!$i) { @@ -2326,7 +2326,7 @@ // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { @@ -2336,7 +2336,7 @@ // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } @@ -2778,6 +2778,21 @@ } } } + + // Call Hook modifyTextInfo + $parameters = array('textinfo' => $text_info); + $reshook = $hookmanager->executeHooks('modifyTextInfo', $parameters, $object, $action); + if ($reshook == 1) { + // for add information + $text_info .= $hookmanager->resPrint; + } elseif ($reshook == 0) { + // for replace information + $text_info = $hookmanager->resPrint; + } elseif ($reshook == -1) { + // for errors + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if ($notshippable == 0) { $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft'); $text_info = $text_icon.' '.$langs->trans('Shippable').'
'.$text_info; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 1bf2b413e8e91..f1d2eaaeaf6dd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4654,6 +4654,9 @@ function setRadioForTypeOfInvoice() { $morehtmlref .= ''; $object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status + $object->totalcreditnotes = $totalcreditnotes; + $object->totaldeposits = $totaldeposits; + $object->remaintopay = price2num($object->total_ttc - $object->totalpaid - $object->totalcreditnotes - $object->totaldeposits, 'MT'); dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', ''); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 943a7721ab0eb..c78ecad1d5b4d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -442,8 +442,9 @@ $paiementAmount = $facture->getSommePaiement(); $totalcreditnotes = $facture->getSumCreditNotesUsed(); $totaldeposits = $facture->getSumDepositsUsed(); - $totalpay = $paiementAmount + $totalcreditnotes + $totaldeposits; - $remaintopay = price2num($facture->total_ttc - $totalpay); + + $totalallpayments = $paiementAmount + $totalcreditnotes + $totaldeposits; + $remaintopay = price2num($facture->total_ttc - $totalallpayments); // hook to finalize the remaining amount, considering e.g. cash discount agreements $parameters = array('remaintopay' => $remaintopay); diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index e5828a669d8ef..e9c6e9ae4e4d2 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -87,11 +87,21 @@ print ''; print ''; print ''; print "\n"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 7094ad7a68d70..e5119d46c569d 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -219,6 +219,9 @@ $thirdpartystatic->code_compta_client = $obj->code_compta; //$thirdpartystatic->code_compta_fournisseur = $obj->code_compta_fournisseur; + $totalallpayments = $tmpinvoice->getSommePaiement(0); + $totalallpayments += $tmpinvoice->getSumCreditNotesUsed(0); + $totalallpayments += $tmpinvoice->getSumDepositsUsed(0); print ''; print ''; - print ''; + print ''; print ''; @@ -380,6 +383,8 @@ print ''; print ''; $alreadypaid = $facstatic->getSommePaiement(); + $alreadypaid += $facstatic->getSumCreditNotesUsed(); + $alreadypaid += $facstatic->getSumDepositsUsed(); print ''; print ''; $total_ht += $obj->total_ht; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f1425f1fc56ff..494a30ff9edda 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -1321,7 +1321,7 @@ public function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoi $facturestatic = new Facture($this->db); foreach ($arraybill as $billid) { $facturestatic->fetch($billid); - $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, 1); + $label .= '
'.$facturestatic->getNomUrl(1, '', 0, 0, '', 1).' '.$facturestatic->getLibStatut(2, -1); } } } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index e123c7692f64c..8a7b164350beb 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -101,7 +101,7 @@ /* * Invoices waiting for withdraw */ -$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,"; +$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut as status, f.paye, f.type,"; $sql .= " pfd.date_demande, pfd.amount,"; $sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f,"; @@ -141,10 +141,13 @@ $invoicestatic->id = $obj->rowid; $invoicestatic->ref = $obj->ref; - $invoicestatic->statut = $obj->fk_statut; + $invoicestatic->statut = $obj->status; + $invoicestatic->status = $obj->status; $invoicestatic->paye = $obj->paye; $invoicestatic->type = $obj->type; - $alreadypayed = $invoicestatic->getSommePaiement(); + $totalallpayments = $invoicestatic->getSommePaiement(0); + $totalallpayments += $invoicestatic->getSumCreditNotesUsed(0); + $totalallpayments += $invoicestatic->getSumDepositsUsed(0); $thirdpartystatic->id = $obj->socid; $thirdpartystatic->name = $obj->name; @@ -177,7 +180,7 @@ print ''; print ''; print ''; $i++; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index ffd6498dbd727..720198eb0143d 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -159,7 +159,9 @@ print $fac->error."
"; continue; } - $totalpaid = $fac->getSommePaiement(); + $alreadypaid = $fac->getSommePaiement(); + $alreadypaid += $fac->getSumDepositsUsed(); + $alreadypaid += $fac->getSumCreditNotesUsed(); $userstatic->id = $objf->userid; $userstatic->login = $objf->login; @@ -169,7 +171,7 @@ 'date' => $fac->date, 'datefieldforsort' => $fac->date.'-'.$fac->ref, 'link' => $fac->getNomUrl(1), - 'status' => $fac->getLibStatut(2, $totalpaid), + 'status' => $fac->getLibStatut(2, $alreadypaid), 'amount' => $fac->total_ttc, 'author' => $userstatic->getLoginUrl(1) ); diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 6be7be691aaee..5b9125269d224 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -745,7 +745,8 @@ } if (!empty($arrayfields['t.status']['checked'])) { - print ''; + $totalallpayments = $obj->alreadypayed; + print ''; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index e2ff9935585d7..57f24b67a4c10 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -999,7 +999,7 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro $sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $sql .= " c.fk_prospectlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,"; $sql .= " c.import_key,"; - $sql .= " c.datec as date_creation, c.tms as date_modification,"; + $sql .= " c.datec as date_creation, c.tms as date_modification, c.fk_user_creat, c.fk_user_modif,"; $sql .= " co.label as country, co.code as country_code,"; $sql .= " d.nom as state, d.code_departement as state_code,"; $sql .= " u.rowid as user_id, u.login as user_login,"; @@ -1053,6 +1053,8 @@ public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoro $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); + $this->user_creation_id = $obj->fk_user_creat; + $this->user_modification_id = $obj->fk_user_modif; $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 7ee04c0b2d82c..b9be887b2edfe 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -105,6 +105,7 @@ public function loadBox($max = 5) if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } + $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact // Add where from hooks $parameters = array('socid' => $user->socid, 'boxcode' => $this->boxcode); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 99e94aec30623..d70703a50fc3d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1752,7 +1752,7 @@ public function select_thirdparty_list($selected = '', $htmlname = 'socid', $fil */ public function selectcontacts($socid, $selected = array(), $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $morecss = '', $options_only = 0, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false, $disableifempty = 0, $filter = '') { - global $conf, $langs, $hookmanager, $action; + global $conf, $user, $langs, $hookmanager, $action; $langs->load('companies'); @@ -1812,6 +1812,7 @@ public function selectcontacts($socid, $selected = array(), $htmlname = 'contact $sql .= " LEFT OUTER JOIN " . $this->db->prefix() . "societe as s ON s.rowid=sp.fk_soc"; } $sql .= " WHERE sp.entity IN (" . getEntity('contact') . ")"; + $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact if ($socid > 0 || $socid == -1) { $sql .= " AND sp.fk_soc = " . ((int) $socid); } diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6ec2b9bb051a9..6a696ab26deae 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -10,7 +10,7 @@ * Copyright (C) 2015-2024 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2017 Rui Strecht - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018-2024 Ferran Marcet * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -1026,7 +1026,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_contact as tc on ec.fk_c_type_contact = tc.rowid"; $sql .= " WHERE sc.fk_soc = ".((int) $object->id); $sql .= " AND p.entity IN (".getEntity('project').")"; - $sql .= " AND tc.element = 'project'"; + $sql .= " AND tc.element = 'project' AND tc.source = 'external'"; $sql .= " ORDER BY p.dateo DESC"; $result = $db->query($sql); @@ -1667,7 +1667,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl // Delete if ($user->hasRight('societe', 'contact', 'delete')) { - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index e3913c289d56e..e8e347e76471e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2799,11 +2799,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; $original_file = DOL_DOCUMENT_ROOT.'/public/theme/common/'.$original_file; } elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { - if (empty($entity) || empty($conf->medias->multidir_output[$entity])) { + /* the medias directory is by default a public directory accessible online for everybody, so test on permission per entity has no sense + if (isModEnabled('multicompany') && (empty($entity) || empty($conf->medias->multidir_output[$entity]))) { return array('accessallowed' => 0, 'error' => 'Value entity must be provided'); + } */ + if (empty($entity)) { + $entity = 1; } $accessallowed = 1; - $original_file = $conf->medias->multidir_output[$entity].'/'.$original_file; + $original_file = (empty($conf->medias->multidir_output[$entity]) ? $conf->medias->dir_output : $conf->medias->multidir_output[$entity]).'/'.$original_file; } elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.(log|json)$/', basename($original_file))); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d1a278d8681e8..d89c11a76c3c6 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1842,6 +1842,17 @@ function dol_escape_php($stringtoescape, $stringforquotes = 2) return 'Bad parameter for stringforquotes in dol_escape_php'; } +/** + * Returns text escaped for all protocols (so only alpha chars and numbers) + * + * @param string $stringtoescape String to escape + * @return string Escaped string for XML content. + */ +function dol_escape_all($stringtoescape) +{ + return preg_replace('/[^a-z0-9_]/i', '', $stringtoescape); +} + /** * Returns text escaped for inclusion into a XML string * @@ -2950,7 +2961,16 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $tmptxt = $object->getLibStatut(5, $object->alreadypaid); } $morehtmlstatus .= $tmptxt; - } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid + } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier'))) { // TODO Move this to use ->alreadypaid + $totalallpayments = $object->getSommePaiement(0); + $totalallpayments += $object->getSumCreditNotesUsed(0); + $totalallpayments += $object->getSumDepositsUsed(0); + $tmptxt = $object->getLibStatut(6, $totalallpayments); + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { + $tmptxt = $object->getLibStatut(5, $totalallpayments); + } + $morehtmlstatus .= $tmptxt; + } elseif (in_array($object->element, array('chargesociales', 'loan', 'tva'))) { // TODO Move this to use ->alreadypaid $tmptxt = $object->getLibStatut(6, $object->totalpaid); if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3)) { $tmptxt = $object->getLibStatut(5, $object->totalpaid); @@ -6337,7 +6357,7 @@ function print_barre_liste($title, $page, $file, $options = '', $sortfield = '', do { if ($pagenavastextinput) { if ($cpt == $page) { - $pagelist .= ''; + $pagelist .= ''; $pagelist .= '/'; } } else { diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 7e16ff46de1d8..f349368078a72 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -36,8 +36,6 @@ */ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) { - global $conf; - //$num = str_replace(array(',', ' '), '', trim($num)); This should be useless since $num MUST be a php numeric value if (!$num) { return false; @@ -48,13 +46,7 @@ function dol_convertToWord($num, $langs, $currency = '', $centimes = false) } if (isModEnabled('numberwords')) { - if ($currency) { - $type = '1'; - } else { - $type = '0'; - } - - $concatWords = $langs->getLabelFromNumber($num, $type); + $concatWords = $langs->getLabelFromNumber($num, $currency); return $concatWords; } else { $TNum = explode('.', (string) $num); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index 51405083fe6a4..3cc19ec9933bb 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -88,6 +88,7 @@ public function __construct(DoliDB $db) $this->description = $langs->trans("DocumentModelStandardPDF"); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template + // Dimension page $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -104,7 +105,7 @@ public function __construct(DoliDB $db) // Get source company $this->emetteur = $mysoc; - if (!$this->emetteur->country_code) { + if (empty($this->emetteur->country_code)) { $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } @@ -179,9 +180,9 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $realpath = ''; + $arephoto = false; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { - if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { - // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo + if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo if ($obj['photo_vignette']) { $filename = $obj['photo_vignette']; } else { @@ -192,11 +193,12 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } $realpath = $dir.$filename; + $arephoto = true; $this->atleastonephoto = true; break; } - if ($realpath) { + if ($realpath && $arephoto) { $realpatharray[$i] = $realpath; } } @@ -318,7 +320,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede } } - // Public note and Tracking code + // Displays notes. Here we are still on code executed only for the first page. $notetoshow = empty($object->note_public) ? '' : $object->note_public; // Extrafields in note @@ -572,6 +574,10 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $posYAfterDescription = 0; $heightforsignature = 0; + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); + } + if ($this->getColumnStatus('photo')) { // We start with Photo of product line if (isset($imglinesize['width']) && isset($imglinesize['height']) && ($curY + $imglinesize['height']) > ($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforsignature + $heightforinfotot))) { // If photo too high, we moved completely on new page @@ -975,7 +981,12 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs, $mysoc; - $langs->load("orders"); + $ltrdirection = 'L'; + if ($outputlangs->trans("DIRECTION") == 'rtl') { + $ltrdirection = 'R'; + } + + $outputlangs->load("orders"); $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -1014,7 +1025,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) } } else { $text = $this->emetteur->name; - $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); + $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, $ltrdirection); } $pdf->SetDrawColor(128, 128, 128); @@ -1131,7 +1142,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Sender"), 0, $ltrdirection); $pdf->SetXY($posx, $posy); $pdf->SetFillColor(230, 230, 230); $pdf->MultiCell($widthrecbox, $hautcadre, "", 0, 'R', 1); @@ -1150,7 +1161,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) // Show sender information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, 'L'); + $pdf->MultiCell($widthrecbox - 2, 4, $carac_emetteur, 0, $ltrdirection); // If SHIPPING contact defined, we use it @@ -1188,21 +1199,21 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs) $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posx + 2, $posy - 5); - $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, 'L'); + $pdf->MultiCell($widthrecbox, 5, $outputlangs->transnoentities("Recipient"), 0, $ltrdirection); $pdf->Rect($posx, $posy, $widthrecbox, $hautcadre); } // Show recipient name $pdf->SetXY($posx + 2, $posy + 3); $pdf->SetFont('', 'B', $default_font_size); - $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, 'L'); + $pdf->MultiCell($widthrecbox, 2, $carac_client_name, 0, $ltrdirection); $posy = $pdf->getY(); // Show recipient information $pdf->SetXY($posx + 2, $posy); $pdf->SetFont('', '', $default_font_size - 1); - $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, 'L'); + $pdf->MultiCell($widthrecbox, 4, $carac_client, 0, $ltrdirection); } $pdf->SetTextColor(0, 0, 0); @@ -1271,6 +1282,24 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide */ $rank = 0; // do not use negative rank + $this->cols['position'] = array( + 'rank' => $rank, + 'width' => 10, + 'status' => getDolGlobalInt('PDF_ESPADON_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false), + 'title' => array( + 'textkey' => '#', // use lang key is useful in somme case with module + 'align' => 'C', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'C', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + + $rank += 10; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, 'width' => false, // only for desc @@ -1280,15 +1309,16 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide 'align' => 'L', // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label // 'label' => ' ', // the final label - 'padding' => array(0.5, 1, 0.5, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), 'content' => array( - 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left 'align' => 'L', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left ), ); - $rank = $rank + 10; + // Image of product + $rank += 10; $this->cols['photo'] = array( 'rank' => $rank, 'width' => getDolGlobalInt('MAIN_DOCUMENTS_WITH_PICTURE_WIDTH', 20), // in mm diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index a32a6325def9d..7132a4de3ad98 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -92,7 +92,7 @@ public function __construct($db) $this->description = $langs->trans('SuppliersCommandModel'); $this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template - // Page size for A4 format + // Dimension page $this->type = 'pdf'; $formatarray = pdf_getFormat(); $this->page_largeur = $formatarray['width']; @@ -116,7 +116,7 @@ public function __construct($db) // Get source company $this->emetteur = $mysoc; if (empty($this->emetteur->country_code)) { - $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default, if was not defined + $this->emetteur->country_code = substr($langs->defaultlang, -2); // By default if not defined } // Define position of columns @@ -196,6 +196,8 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $realpath = ''; + + $arephoto = false; foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) { if (!getDolGlobalInt('CAT_HIGH_QUALITY_IMAGES')) { // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo if ($obj['photo_vignette']) { @@ -207,10 +209,12 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $filename = $obj['photo']; } $realpath = $dir.$filename; + $arephoto = true; + $this->atleastonephoto = true; break; } - if ($realpath) { + if ($realpath && $arephoto) { $realpatharray[$i] = $realpath; } } @@ -260,7 +264,8 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', global $action; $reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - $nblines = count($object->lines); + // Set nblines with the new facture lines content after hook + $nblines = is_array($object->lines) ? count($object->lines) : 0; $pdf = pdf_getInstance($this->format); $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance @@ -278,7 +283,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $pdf->SetFont(pdf_getPDFFont($outputlangs)); // Set path to the background PDF File - if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { + if (!getDolGlobalString('MAIN_DISABLE_FPDI') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')) { $pagecount = $pdf->setSourceFile($conf->mycompany->dir_output.'/' . getDolGlobalString('MAIN_ADD_PDF_BACKGROUND')); $tplidx = $pdf->importPage(1); } @@ -324,6 +329,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $tab_height = $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext; // Incoterm + $height_incoterms = 0; if (isModEnabled('incoterm')) { $desc_incoterms = $object->getIncotermsForPDF(); if ($desc_incoterms) { @@ -339,10 +345,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $pdf->Rect($this->marge_gauche, $tab_top - 1, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_incoterms + 1); $tab_top = $nexY + 6; + $height_incoterms += 4; } } - // Affiche notes + // Displays notes. Here we are still on code executed only for the first page. $notetoshow = empty($object->note_public) ? '' : $object->note_public; // Extrafields in note @@ -352,7 +359,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $pagenb = $pdf->getPage(); - if ($notetoshow) { + if (!empty($notetoshow)) { $tab_width = $this->page_largeur - $this->marge_gauche - $this->marge_droite; $pageposbeforenote = $pagenb; @@ -374,7 +381,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', if ($pageposafternote > $pageposbeforenote) { $pdf->rollbackTransaction(true); - // prepar pages to receive notes + // prepare pages to receive notes while ($pagenb < $pageposafternote) { $pdf->AddPage(); $pagenb++; @@ -444,8 +451,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', } $height_note = $posyafter - $tab_top_newpage; $pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1); - } else { - // No pagebreak + } else { // No pagebreak $pdf->commitTransaction(); $posyafter = $pdf->GetY(); $height_note = $posyafter - $tab_top; @@ -513,6 +519,10 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', $posYAfterImage = 0; $posYAfterDescription = 0; + if ($this->getColumnStatus('position')) { + $this->printStdColumnContent($pdf, $curY, 'position', (string) ($i + 1)); + } + // We start with Photo of product line if ($this->getColumnStatus('photo')) { // We start with Photo of product line @@ -545,6 +555,7 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', if ($this->getColumnStatus('desc')) { $pdf->startTransaction(); + $this->printColDescContent($pdf, $curY, 'desc', $object, $i, $outputlangs, $hideref, $hidedesc, 1); $pageposafter = $pdf->getPage(); @@ -814,11 +825,11 @@ public function write_file($object, $outputlangs = null, $srctemplatepath = '', return 1; // No error } else { - $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); + $this->error = $langs->transnoentities("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } } @@ -1514,6 +1525,24 @@ public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hide */ $rank = 0; // do not use negative rank + $this->cols['position'] = array( + 'rank' => $rank, + 'width' => 10, + 'status' => getDolGlobalInt('PDF_CORNAS_ADD_POSITION') ? true : (getDolGlobalInt('PDF_ADD_POSITION') ? true : false), + 'title' => array( + 'textkey' => '#', // use lang key is useful in somme case with module + 'align' => 'C', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'C', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); + + $rank += 10; // do not use negative rank $this->cols['desc'] = array( 'rank' => $rank, 'width' => false, // only for desc diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 4cb908025f42e..8ee77b5ffb859 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -51,8 +51,8 @@ continue; // We don't want this field } - if (in_array($key, array('ref', 'status'))) { - continue; // Ref and status are already in dol_banner + if (in_array($key, array('rowid', 'ref', 'status'))) { + continue; // rowid, ref and status are already in dol_banner } $value = $object->$key; diff --git a/htdocs/document.php b/htdocs/document.php index e204956acd3e4..ede788ab2faed 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -220,7 +220,7 @@ function llxFooter() $accessallowed = $check_access['accessallowed']; $sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals']; $fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name -//var_dump($fullpath_original_file.' '.$original_file.' '.$accessallowed);exit; +//var_dump($modulepart.' '.$fullpath_original_file.' '.$original_file.' '.$accessallowed);exit; if (!empty($hashp)) { $accessallowed = 1; // When using hashp, link is public so we force $accessallowed diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 379ef6c8320ab..b6de9bb3d9af6 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1835,8 +1835,8 @@ } // Alias if (!empty($arrayfields['s.name_alias']['checked'])) { - print ''."\n"; if (!$i) { $totalarray['nbfield']++; @@ -1844,8 +1844,8 @@ } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -1853,8 +1853,8 @@ } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -1862,7 +1862,7 @@ } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 8bf3c96ef74da..1102ed53dc75f 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1100,6 +1100,13 @@ public function update($user = null, $notrigger = 0) $this->errors[] = "Error ".$this->db->lasterror(); } + if (!$error) { + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } + if (!$error) { if (!$notrigger) { // Call trigger diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 2a93e7d181a93..e3d6f60d66626 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -18,8 +18,8 @@ FileIntegrityIsOkButFilesWereAdded=Files integrity check has passed, however som FileIntegritySomeFilesWereRemovedOrModified=Files integrity check has failed. Some files were modified, removed or added. GlobalChecksum=Global checksum MakeIntegrityAnalysisFrom=Make integrity analysis of application files from -LocalSignature=Embedded local signature (less reliable) -RemoteSignature=Remote distant signature (more reliable) +LocalSignature=Embedded local signature +RemoteSignature=Remote distant signature FilesMissing=Missing Files FilesUpdated=Updated Files FilesModified=Modified Files diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 737053673f032..a748db69ea26f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1623,7 +1623,7 @@ function llxHeader($head = '', $title = '', $help_url = '', $target = '', $disab print ''."\n"; // top menu and left menu area - if ((empty($conf->dol_hide_topmenu) || GETPOSTINT('dol_invisible_topmenu')) && !GETPOSTINT('dol_openinpopup')) { + if ((empty($conf->dol_hide_topmenu) || GETPOSTINT('dol_invisible_topmenu')) && !GETPOST('dol_openinpopup', 'aZ09')) { top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss, $morequerystring, $help_url); } @@ -1909,6 +1909,9 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (GETPOSTISSET('dol_hide_leftmenu')) { $themeparam .= '&dol_hide_leftmenu='.GETPOSTINT('dol_hide_leftmenu'); } + if (GETPOSTISSET('dol_openinpopup')) { + $themeparam .= '&dol_openinpopup='.GETPOST('dol_openinpopup', 'aZ09'); + } if (GETPOSTISSET('dol_optimize_smallscreen')) { $themeparam .= '&dol_optimize_smallscreen='.GETPOSTINT('dol_optimize_smallscreen'); } @@ -3536,7 +3539,7 @@ function main_area($title = '') { global $conf, $langs, $hookmanager; - if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup')) { + if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { print '
'; } @@ -3790,7 +3793,7 @@ function llxFooter($comment = '', $zone = 'private', $disabledoutputofmessages = print '
'."\n"; // End div fiche - if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup')) { + if (empty($conf->dol_hide_leftmenu) && !GETPOST('dol_openinpopup', 'aZ09')) { print ''."\n"; // End div id-right } diff --git a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang index 8677fa5806964..add75190d914e 100644 --- a/htdocs/modulebuilder/template/langs/en_US/mymodule.lang +++ b/htdocs/modulebuilder/template/langs/en_US/mymodule.lang @@ -1,17 +1,4 @@ -# Copyright (C) ---Put here your own copyright and developer email--- -# -# 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 . +# Translation file # # Generic diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6c8db41eeb741..05843b55d9011 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -20,7 +20,7 @@ * Copyright (C) 2019-2020 Thibault FOUCART * Copyright (C) 2020 Pierre Ardoin * Copyright (C) 2022 Vincent de Grandpré - * Copyright (C) 2024 MDW + * Copyright (C) 2024 MDW * * 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 @@ -1471,7 +1471,7 @@ // SellBy / EatBy mandatory list if (!empty($sellOrEatByMandatoryList)) { - print ''; } @@ -2098,7 +2098,7 @@ } else { $sellOrEatByMandatorySelectedId = $object->sell_or_eat_by_mandatory; } - print ''; } @@ -2550,7 +2550,7 @@ } } - print ''; } diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 1bf11f9074ddf..da3a39274cfab 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -196,17 +196,20 @@ // TODO Get desc in language of thirdparty } + $line->tva_tx = $productsupplier->vatrate_supplier; + $tva = $line->tva_tx / 100; + // If we use multicurrency if (isModEnabled('multicurrency') && !empty($productsupplier->fourn_multicurrency_code) && $productsupplier->fourn_multicurrency_code != $conf->currency) { - $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; - $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; - $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; + $line->multicurrency_code = $productsupplier->fourn_multicurrency_code; + $line->fk_multicurrency = $productsupplier->fourn_multicurrency_id; + $line->multicurrency_subprice = $productsupplier->fourn_multicurrency_unitprice; + $line->multicurrency_total_ht = $line->multicurrency_subprice * $qty; + $line->multicurrency_total_tva = $line->multicurrency_total_ht * $tva; + $line->multicurrency_total_ttc = $line->multicurrency_total_ht + $line->multicurrency_total_tva; } - - $line->tva_tx = $productsupplier->vatrate_supplier; $line->subprice = $productsupplier->fourn_pu; $line->total_ht = $productsupplier->fourn_pu * $qty; - $tva = $line->tva_tx / 100; $line->total_tva = $line->total_ht * $tva; $line->total_ttc = $line->total_ht + $line->total_tva; $line->remise_percent = $productsupplier->remise_percent; diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index cdf88596f2c03..873a0a02b56bc 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -24,6 +24,8 @@ * \ingroup core * \brief File to offer a way to make an online signature for a particular Dolibarr entity * Example of URL: https://localhost/public/onlinesign/newonlinesign.php?ref=PR... + * + * The signature is added by calling the file /htdocs/core/ajax/onlinSign.php */ if (!defined('NOLOGIN')) { diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 893f21db32944..c499fad5ae988 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -138,30 +138,22 @@ if ($action == 'confirm_delete' && $user->hasRight('societe', 'contact', 'delete')) { $id = GETPOST('id', 'int'); if (!empty($id) && $socid > 0) { - $db->begin(); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople_extrafields"; - $sql .= " WHERE fk_object = ".((int) $socid); - $sql .= " AND fk_object IN (SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople as sp WHERE sp.rowid = ".((int) $socid); - $sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0))"; - - $result1 = $db->query($sql); - - $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople"; - $sql .= " WHERE fk_soc = ".((int) $socid); - $sql .= " AND rowid = ".((int) $id); - $sql .= " AND ((fk_user_creat = ".((int) $user->id)." AND priv = 1) OR priv = 0)"; - - $result2 = $db->query($sql); - - if (!$result1 || !$result2) { - setEventMessages($db->lasterror(), null, 'errors'); - $db->rollback(); + $contact = new Contact($db); + $ret = $contact->fetch($id); + if ($ret > 0) { + if ($contact->priv == 0 || ($contact->user_modification_id == ((int) $user->id) && $contact->priv == 1)) { + $contact->oldcopy = clone $contact; // @phan-suppress-current-line PhanTypeMismatchProperty + $result = $contact->delete($user); + if ($result > 0) { + setEventMessages('RecordDeleted', null, 'mesgs'); + header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); + exit(); + } else { + setEventMessages($contact->error, $contact->errors, 'errors'); + } + } } else { - $db->commit(); - setEventMessages('RecordDeleted', null, 'mesgs'); - header("Location: ".$_SERVER['PHP_SELF']."?id=".$socid); - exit(); + setEventMessages($contact->error, $contact->errors, 'errors'); } } } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 83089a617ff12..e1b6c0503471c 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -422,7 +422,8 @@ if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } -$sql .= ' WHERE s.entity IN ('.getEntity('societe').') AND sp.fk_soc = s.rowid'; +$sql .= " WHERE s.entity IN (".getEntity('societe').") AND sp.fk_soc = s.rowid"; +$sql .= " AND ((sp.fk_user_creat = ".((int) $user->id)." AND sp.priv = 1) OR sp.priv = 0)"; // check if this is a private contact if (!$user->hasRight('societe', 'client', 'voir')) { $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id); } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1764c93a83020..21d4f6bd01418 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1626,7 +1626,8 @@ $totalarray['nbfield']++; } if (!empty($arrayfields['legalform.code']['checked'])) { - print_liste_field_titre($arrayfields['legalform.code']['label'], $_SERVER["PHP_SELF"], "legalform.code", "", $param, '', $sortfield, $sortorder); + // s.fk_forme_juridique as legalform_code + print_liste_field_titre($arrayfields['legalform.code']['label'], $_SERVER["PHP_SELF"], "legalform_code", "", $param, '', $sortfield, $sortorder); $totalarray['nbfield']++; } if (!empty($arrayfields['s.price_level']['checked'])) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 57ae6d202a19a..5100b3af29250 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2435,12 +2435,12 @@ div.fiche { margin-: dol_optimize_smallscreen) ? '42' : '6')); ?>px; margin-: dol_optimize_smallscreen) ? '38' : '6')); ?>px; - - + } body.onlinepaymentbody div.fiche { /* For online payment page */ margin: 20px !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5dd886ecb78f1..bfbef5d2a8ead 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2552,7 +2552,7 @@ div.fiche { margin-: dol_optimize_smallscreen) ? '35' : '6')); ?>px; margin-: dol_optimize_smallscreen) ? '33' : '6')); ?>px; - margin-bottom: 15px; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index b519b6d67bf26..0e7c67735feab 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -109,11 +109,13 @@ //print dol_get_fiche_head($head, 'info', $title, -1, 'user'); +/* $linkback = ''; if ($user->hasRight('user', 'user', 'lire') || $user->admin) { $linkback = ''.$langs->trans("BackToList").''; } +*/ $morehtmlref = ''; $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); @@ -128,7 +130,9 @@ print '
'; $param = '&id='.((int) $object->id); -$param .= '&dol_openinpopup=1'; +if (GETPOSTISSET('dol_openinpopup')) { + $param .= '&dol_openinpopup='.urlencode(GETPOST('dol_openinpopup', 'aZ09')); +} $enabledisablehtml = $langs->trans("EnablePublicVirtualCard").' '; if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 1f64b61922bba..1096dd1a27c4b 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -370,7 +370,7 @@ public function fetchAll() * Updates a product attribute * * @param User $user User who updates the attribute - * @param int $notrigger 1 = Do not execute trigger (0 by default) + * @param int $notrigger If 1 = Do not execute trigger (0 by default) * @return int Return <0 if KO, 1 if OK */ public function update(User $user, $notrigger = 0) diff --git a/htdocs/variants/tpl/productattributevalueline_view.tpl.php b/htdocs/variants/tpl/productattributevalueline_view.tpl.php index 825c3639a3fd8..1a550d443d469 100644 --- a/htdocs/variants/tpl/productattributevalueline_view.tpl.php +++ b/htdocs/variants/tpl/productattributevalueline_view.tpl.php @@ -64,8 +64,9 @@ $coldisplay++; if (empty($disableedit)) { ?>
id.'#line_'.$line->id; ?>"> - '; - } + + + '; print ' + \n"; diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 9a91d90ede5f4..f70e362087993 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -142,9 +142,9 @@ foreach ($ldaprecords as $key => $ldapgroup) { $group = new UserGroup($db); $group->fetch('', $ldapgroup[getDolGlobalString('LDAP_KEY_GROUPS')]); - $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')]; + $group->name = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')] ?? null; $group->nom = $group->name; // For backward compatibility - $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')]; + $group->note = $ldapgroup[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')] ?? null; $group->entity = $conf->entity; // print_r($ldapgroup); diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 40a88d6bad026..46d836ae28f05 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -201,30 +201,30 @@ } // Propriete membre - $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')]; - $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')]; - $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')]; - $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')]; - $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')]; + $fuser->firstname = $ldapuser[getDolGlobalString('LDAP_FIELD_FIRSTNAME')] ?? null; + $fuser->lastname = $ldapuser[getDolGlobalString('LDAP_FIELD_NAME')] ?? null; + $fuser->login = $ldapuser[getDolGlobalString('LDAP_FIELD_LOGIN')] ?? null; + $fuser->pass = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD')] ?? null; + $fuser->pass_indatabase_crypted = $ldapuser[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] ?? null; // $user->societe; /* - * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')]; - * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')]; - * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')]; - * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')]; + * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')] ?? null; + * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')] ?? null; + * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')] ?? null; + * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')] ?? null; * $fuser->country_id=$countries[$hashlib2rowid[strtolower($fuser->country)]]['rowid']; * $fuser->country_code=$countries[$hashlib2rowid[strtolower($fuser->country)]]['code']; */ - $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')]; - $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')]; - $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')]; - $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')]; - $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')]; + $fuser->office_phone = $ldapuser[getDolGlobalString('LDAP_FIELD_PHONE')] ?? null; + $fuser->user_mobile = $ldapuser[getDolGlobalString('LDAP_FIELD_MOBILE')] ?? null; + $fuser->office_fax = $ldapuser[getDolGlobalString('LDAP_FIELD_FAX')] ?? null; + $fuser->email = $ldapuser[getDolGlobalString('LDAP_FIELD_MAIL')] ?? null; + $fuser->ldap_sid = $ldapuser[getDolGlobalString('LDAP_FIELD_SID')] ?? null; - $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')]; - $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')]; + $fuser->job = $ldapuser[getDolGlobalString('LDAP_FIELD_TITLE')] ?? null; + $fuser->note = $ldapuser[getDolGlobalString('LDAP_FIELD_DESCRIPTION')] ?? null; $fuser->admin = 0; $fuser->socid = 0; $fuser->contact_id = 0; @@ -236,7 +236,7 @@ * if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) { * $fuser->datec=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); * $fuser->datevalid=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); - * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')]; + * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')] ?? null; * } */ // if ($fuser->statut > 1) $fuser->statut=1;
".$langs->trans("Parameter")."
'.$langs->trans('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); +print ''; +print ajax_constantonoff('SHIPPING_DISPLAY_STOCK_ENTRY_DATE'); +print '
'; +print '
'; print $form->textwithpicto($langs->trans("FreeLegalTextOnShippings"), $langs->trans("AddCRIfTooLong").'

'.$htmltext, 1, 'help', '', 0, 2, 'freetexttooltip').'
'; $variablename = 'SHIPPING_FREE_TEXT'; if (!getDolGlobalString('PDF_ALLOW_HTML_FOR_FREE_TEXT')) { @@ -476,14 +464,16 @@ print "
'; -print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; +print $form->textwithpicto($langs->trans("WatermarkOnDraftContractCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip'); +print '
'; print ''; print "
'.$langs->trans("AllowOnLineSign").''; +print ''.$langs->trans("AllowOnLineSign"); +print ''; print ajax_constantonoff('EXPEDITION_ALLOW_ONLINESIGN', array(), null, 0, 0, 0, 2, 0, 1); print '
'; + print ''; print dolPrintLabel($obj->alias); print ''; + print ''; print dolPrintLabel($obj->town); print ''; + print ''; print dolPrintLabel($obj->zip); print '".dolPrintLabel($obj->state_name)."'.dolPrintLabel($obj->state_name)."'; + $totalallpayments = 0; + $totalcalculated = false; if (method_exists($objectlink, 'getSommePaiement')) { - print $objectlink->getLibStatut(3, $objectlink->getSommePaiement()); - } else { - print $objectlink->getLibStatut(3); + $totalcalculated = true; + $totalallpayments += $objectlink->getSommePaiement(); } + if (method_exists($objectlink, 'getSumDepositsUsed')) { + $totalcalculated = true; + $totalallpayments += $objectlink->getSumDepositsUsed(); + } + if (method_exists($objectlink, 'getSumCreditNotesUsed')) { + $totalcalculated = true; + $totalallpayments += $objectlink->getSumCreditNotesUsed(); + } + print $objectlink->getLibStatut(3, ($totalcalculated ? $totalallpayments : -1)); print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'
'; @@ -251,7 +254,7 @@ print 'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''.$tmpinvoice->getLibStatut(3, $obj->am).''.$tmpinvoice->getLibStatut(3, $totalallpayments).'
'.price($obj->total_ttc).'jdate($obj->tms), 'dayhour', 'tzuserrel')).'">'.dol_print_date($db->jdate($obj->tms), 'day', 'tzuserrel').''.$facstatic->getLibStatut(3, $alreadypaid).'
'; - print $invoicestatic->getLibStatut(3, $alreadypayed); + print $invoicestatic->getLibStatut(3, $totalallpayments); print '
' . $tva_static->getLibStatut(5, $obj->alreadypayed) . '' . $tva_static->getLibStatut(5, $totalallpayments) . ''; - print $obj->alias; + print ''; + print dol_escape_htmltag($obj->alias); print ''; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; - print $obj->zip; + print ''; + print dol_escape_htmltag($obj->zip); print '".$obj->state_name."'.dol_escape_htmltag($obj->state_name)."
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print '
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, GETPOSTINT('sell_or_eat_by_mandatory')); print '
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print '
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $form->selectarray('sell_or_eat_by_mandatory', $sellOrEatByMandatoryList, $sellOrEatByMandatorySelectedId); print '
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->trans('SellByDate'), $langs->trans('EatByDate')).''; + print '
'.$langs->trans('BatchSellOrEatByMandatoryList', $langs->transnoentities('SellByDate'), $langs->transnoentities('EatByDate')).''; print $object->getSellOrEatByMandatoryLabel(); print '
'; @@ -101,7 +102,7 @@ } if ($action == 'selectlines') { ?> -