diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index dd44ce0cece..6b7d12c122a 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -60,7 +60,7 @@ if ($action == 'update') { $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2); $minamount = GETPOST('MEMBER_MIN_AMOUNT'); $publiccounters = GETPOST('MEMBER_COUNTERS_ARE_PUBLIC'); - $showtable = GETPOST('MEMBER_SHOW_TABLE');; + $showtable = GETPOST('MEMBER_SHOW_TABLE'); $showvoteallowed = GETPOST('MEMBER_SHOW_VOTE_ALLOWED'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index d98165d28a2..4b3b530148d 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -639,7 +639,7 @@ if ($num == 0) { $colspan++; } } - print ''.$langs->trans("NoRecordFound").''; + print ''.$langs->trans("NoRecordFound").''; } diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 5f33afbae7f..724e09554db 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -346,7 +346,7 @@ for ($i = 1 ; $i < $MAXLINES; $i++) { print ''; print ''; -}; +} print ''; print ''; diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 77cd3234cd8..54344da699e 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -18,7 +18,7 @@ /** * \file htdocs/core/ajax/objectonoff.php * \brief File to set status for an object - * This Ajax service is called when option MAIN_DIRECT_STATUS_UPDATE is set. + * This Ajax service is oftenly called when option MAIN_DIRECT_STATUS_UPDATE is set. */ if (!defined('NOTOKENRENEWAL')) { @@ -53,15 +53,34 @@ $format = 'int'; $object = new GenericObject($db); -$tablename = $element; -if ($tablename == 'websitepage') { - $tablename = 'website_page'; -} +$tmparray = explode('@', $element); +if (empty($tmparray[1])) { + $subelement = ''; -$object->table_element = $tablename; + $object->module = $element; + $object->element = $element; + $object->table_element = $element; + + // Special case for compatibility + if ($object->table_element == 'websitepage') { + $object->table_element = 'website_page'; + } +} else { + $element = $tmparray[0]; + $subelement = $tmparray[1]; + + $object->module = $element; + $object->element = $subelement; + $object->table_element = $object->module.'_'.$object->element; +} $object->id = $id; $object->fields[$field] = array('type' => $format, 'enabled' => 1); +$module = $object->module; +$element = $object->element; + +//var_dump($object->module); var_dump($object->element); var_dump($object->table_element); + // Security check if (!empty($user->socid)) { $socid = $user->socid; @@ -70,12 +89,20 @@ if (!empty($user->socid)) { //$user->hasRight('societe', 'lire') = 0;$user->rights->fournisseur->lire = 0; //restrictedArea($user, 'societe', $id); -if (in_array($field, array('status'))) { - restrictedArea($user, $element, $id); +// We check permission. +// Check is done on $user->rights->element->create or $user->rights->element->subelement->create (because $action = 'set') +if (preg_match('/status$/', $field)) { + $module = $object->module; + $element = $object->element; + $usesublevelpermission = ($module != $element ? $element : ''); + if ($usesublevelpermission && !isset($user->rights->$module->$element)) { // There is no permission on object defined, we will check permission on module directly + $usesublevelpermission = ''; + } + restrictedArea($user, $object->module, $object, $object->table_element, $usesublevelpermission); } elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products - restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid'); + restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid'); } else { - httponly_accessforbidden("Bad value for combination of parameters element/field."); + httponly_accessforbidden("Bad value for combination of parameters element/field."); // This includes the exit. } @@ -89,7 +116,7 @@ print ''; print load_fiche_titre($langs->trans($title), $morehtmlright, '', 0, 0, 'showlinkedobjectblock'); @@ -8916,20 +8918,19 @@ class Form $res = @include dol_buildpath('core/tpl/objectlinked_lineimport.tpl.php'); } - print ''; - - return $nbofdifferenttypes; } + + return $nbofdifferenttypes; } /** * Show block with links to link to other objects. * - * @param CommonObject $object Object we want to show links to - * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction. - * @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion. - * @return string <0 if KO, >0 if OK + * @param CommonObject $object Object we want to show links to + * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction. + * @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion. + * @return string HTML block */ public function showLinkToObjectBlock($object, $restrictlinksto = array(), $excludelinksto = array()) { diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index fde2a988cf7..25aee10e2f3 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -696,8 +696,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof * @param Object $object Object to set * @param string $code Name of property in object : 'status' or 'status_buy' for product by example * @param string $field Name of database field : 'tosell' or 'tobuy' for product by example - * @param string $text_on Text if on - * @param string $text_off Text if off + * @param string $text_on Text if on ('Text' or 'Text:css picto on') + * @param string $text_off Text if off ('Text' or 'Text:css picto on') * @param array $input Array of type->list of CSS element to switch. Example: array('disabled'=>array(0=>'cssid')) * @param string $morecss More CSS * @param string $htmlname Name of HTML component. Keep '' or use a different value if you need to use this component several time on same page for same property. @@ -710,6 +710,7 @@ function ajax_object_onoff($object, $code, $field, $text_on, $text_off, $input = if (empty($htmlname)) { $htmlname = $code; } + //var_dump($object->module); var_dump($object->element); $out = ''; - $out .= ''.img_picto($langs->trans($text_off), 'switch_off').''; - $out .= ''.img_picto($langs->trans($text_on), 'switch_on').''; + + $switchon = 'switch_on'; + $switchoff = 'switch_off'; + $tmparray = explode(':', $text_on); + if (!empty($tmparray[1])) { + $text_on = $tmparray[0]; + $switchon = $tmparray[1]; + } + $tmparray = explode(':', $text_off); + if (!empty($tmparray[1])) { + $text_off = $tmparray[0]; + $switchoff = $tmparray[1]; + } + + $out .= ''.img_picto($langs->trans($text_off), $switchoff).''; + $out .= ''.img_picto($langs->trans($text_on), $switchon).''; return $out; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 24dafa06f69..918046fc218 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4134,7 +4134,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'off', 'on', 'order', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'phoning', 'phoning_mobile', 'phoning_fax', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'proposal', 'puce', 'stock', 'resize', 'service', 'stats', 'trip', - 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', + 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'switch_on_warning', 'switch_on_red', 'tools', 'unlink', 'uparrow', 'user', 'user-tie', 'vcard', 'wrench', 'github', 'google', 'jabber', 'microsoft', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing', @@ -4180,7 +4180,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right', 'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry', 'sign-out'=>'sign-out-alt', - 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', + 'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_warning'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter', 'list-alt'=>'list-alt', 'calendarlist'=>'bars', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table', 'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'currency'=>'dollar-sign', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice', @@ -4264,7 +4264,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'members'=>'infobox-adherent', 'member'=>'infobox-adherent', 'money-bill-alt'=>'infobox-bank_account', 'order'=>'infobox-commande', 'user'=>'infobox-adherent', 'users'=>'infobox-adherent', - 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'switch_on_red'=>'font-status8', + 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'switch_on_warning'=>'font-status4 warning', 'switch_on_red'=>'font-status8', 'holiday'=>'infobox-holiday', 'info'=>'opacityhigh', 'invoice'=>'infobox-commande', 'knowledgemanagement'=>'infobox-contrat rotate90', 'loan'=>'infobox-bank_account', 'payment'=>'infobox-bank_account', 'payment_vat'=>'infobox-bank_account', 'poll'=>'infobox-adherent', 'pos'=>'infobox-bank_account', 'project'=>'infobox-project', 'projecttask'=>'infobox-project', diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 1f7b9404a7c..63202c693e4 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -485,7 +485,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $readok = 0; $nbko++; } - } elseif (!empty($feature2)) { // This is for permissions on 2 levels + } elseif (!empty($feature2)) { // This is for permissions on 2 levels (module->object->read) $tmpreadok = 1; foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid) { @@ -504,7 +504,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $readok = 0; // All tests are ko (we manage here the and, the or will be managed later using $nbko). $nbko++; } - } elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) { // This is permissions on 1 level + } elseif (!empty($feature) && ($feature != 'user' && $feature != 'usergroup')) { // This is permissions on 1 level (module->read) if (empty($user->rights->$feature->lire) && empty($user->rights->$feature->read) && empty($user->rights->$feature->run)) { @@ -531,7 +531,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', // Check write permission from module (we need to know write permission to create but also to delete drafts record or to upload files) $createok = 1; $nbko = 0; - $wemustcheckpermissionforcreate = (GETPOST('sendit', 'alpha') || GETPOST('linkit', 'alpha') || in_array(GETPOST('action', 'aZ09'), array('create', 'update', 'add_element_resource', 'confirm_delete_linked_resource')) || GETPOST('roworder', 'alpha', 2)); + $wemustcheckpermissionforcreate = (GETPOST('sendit', 'alpha') || GETPOST('linkit', 'alpha') || in_array(GETPOST('action', 'aZ09'), array('create', 'update', 'set', 'add_element_resource', 'confirm_delete_linked_resource')) || GETPOST('roworder', 'alpha', 2)); $wemustcheckpermissionfordeletedraft = ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete'); if ($wemustcheckpermissionforcreate || $wemustcheckpermissionfordeletedraft) { @@ -576,7 +576,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', $createok = 0; $nbko++; } - } elseif (!empty($feature2)) { // This is for permissions on one level + } elseif (!empty($feature2)) { // This is for permissions on 2 levels (module->object->write) foreach ($feature2 as $subfeature) { if ($subfeature == 'user' && $user->id == $objectid && $user->rights->user->self->creer) { continue; // User can edit its own card @@ -599,7 +599,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', break; } } - } elseif (!empty($feature)) { // This is for permissions on 2 levels ('creer' or 'write') + } elseif (!empty($feature)) { // This is for permissions on 1 levels (module->write) //print '
feature='.$feature.' creer='.$user->rights->$feature->creer.' write='.$user->rights->$feature->write; exit; if (empty($user->rights->$feature->creer) && empty($user->rights->$feature->write) diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 1bf83410088..57cbb0188a5 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -30,7 +30,7 @@ * @param string $desc Description of export * @param array $events_array Array of events ("uid","startdate","duration","enddate","title","summary","category","email","url","desc","author") * @param string $outputfile Output file - * @return int < 0 if ko, Nb of events in file if ok + * @return int < 0 if KO, Nb of events in file if OK */ function build_calfile($format, $title, $desc, $events_array, $outputfile) { @@ -43,6 +43,8 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) return -1; } + $nbevents = 0; + // Note: A cal file is an UTF8 encoded file $calfileh = fopen($outputfile, "w"); @@ -144,6 +146,8 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) */ if ($type === "event") { + $nbevents++; + fwrite($calfileh, "BEGIN:VEVENT\n"); fwrite($calfileh, "UID:".$uid."\n"); @@ -247,6 +251,8 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // Output the vCard/iCal VJOURNAL object if ($type === "journal") { + $nbevents++; + fwrite($calfileh, "BEGIN:VJOURNAL\n"); fwrite($calfileh, "UID:".$uid."\n"); @@ -289,6 +295,8 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing"); return -2; } + + return $nbevents; } /** @@ -303,7 +311,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) * @param string $filter (optional) Filter * @param string $url Url (If empty, forge URL for agenda RSS export) * @param string $langcode Language code to show in header - * @return int < 0 if ko, Nb of events in file if ok + * @return int < 0 if KO, Nb of events in file if OK */ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '', $langcode = '') { @@ -317,6 +325,8 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt return -1; } + $nbevents = 0; + $fichier = fopen($outputfile, "w"); if ($fichier) { @@ -362,6 +372,8 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt } if ($eventqualified) { + $nbevents++; + if (is_object($event) && get_class($event) == 'WebsitePage') { // Convert object into an array $tmpevent = array(); @@ -426,6 +438,8 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt fclose($fichier); dolChmod($outputfile); } + + return $nbevents; } /** @@ -437,8 +451,6 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt */ function format_cal($format, $string) { - global $conf; - $newstring = $string; if ($format === "vcal") { diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 7bbe8d7c1a6..e83730c89e2 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -44,7 +44,7 @@ class DataPolicy /** * getAllContactNotInformed * - * @return number + * @return integer */ public function getAllContactNotInformed() { @@ -75,12 +75,14 @@ class DataPolicy $this->error = $this->db->error(); return -1; } + + return 1; } /** * getAllCompaniesNotInformed * - * @return number + * @return integer */ public function getAllCompaniesNotInformed() { @@ -110,12 +112,14 @@ class DataPolicy $this->error = $this->db->error(); return -1; } + + return 1; } /** * getAllAdherentsNotInformed * - * @return number + * @return integer */ public function getAllAdherentsNotInformed() { @@ -145,6 +149,8 @@ class DataPolicy $this->error = $this->db->error(); return -1; } + + return 1; } /** diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 1aceca10c16..1769033df28 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -134,7 +134,7 @@ class PaymentDonation extends CommonObject $now = dol_now(); // Validate parameters - if (!$this->datepaid) { + if (!$this->datep) { $this->error = 'ErrorBadValueForParameterCreatePaymentDonation'; return -1; } @@ -193,7 +193,7 @@ class PaymentDonation extends CommonObject $sql .= " fk_typepayment, num_payment, note, ext_payment_id, ext_payment_site,"; $sql .= " fk_user_creat, fk_bank)"; $sql .= " VALUES (".((int) $this->chid).", '".$this->db->idate($now)."',"; - $sql .= " '".$this->db->idate($this->datepaid)."',"; + $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " ".((float) price2num($totalamount)).","; $sql .= " ".((int) $this->paymenttype).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', "; $sql .= " ".($this->ext_payment_id ? "'".$this->db->escape($this->ext_payment_id)."'" : "null").", ".($this->ext_payment_site ? "'".$this->db->escape($this->ext_payment_site)."'" : "null").","; @@ -588,10 +588,9 @@ class PaymentDonation extends CommonObject if ($mode == 'payment_donation') { $amount = $total; } - // Insert payment into llx_bank $bank_line_id = $acc->addline( - $this->datepaid, + $this->datep, $this->paymenttype, // Payment mode id or code ("CHQ or VIR for example") $label, $amount, diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 0d056a1f9e4..4fe23ae589c 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -111,9 +111,8 @@ class PaymentExpenseReport extends CommonObject $error = 0; $now = dol_now(); - // Validate parameters - if (!$this->datepaid) { + if (!$this->datep) { $this->error = 'ErrorBadValueForParameterCreatePaymentExpenseReport'; return -1; } @@ -170,7 +169,7 @@ class PaymentExpenseReport extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."payment_expensereport (fk_expensereport, datec, datep, amount,"; $sql .= " fk_typepayment, num_payment, note, fk_user_creat, fk_bank)"; $sql .= " VALUES ($this->fk_expensereport, '".$this->db->idate($now)."',"; - $sql .= " '".$this->db->idate($this->datepaid)."',"; + $sql .= " '".$this->db->idate($this->datep)."',"; $sql .= " ".price2num($totalamount).","; $sql .= " ".((int) $this->fk_typepayment).", '".$this->db->escape($this->num_payment)."', '".$this->db->escape($this->note_public)."', ".((int) $user->id).","; $sql .= " 0)"; // fk_bank is ID of transaction into ll_bank @@ -531,7 +530,7 @@ class PaymentExpenseReport extends CommonObject // Insert payment into llx_bank $bank_line_id = $acc->addline( - $this->datepaid, + $this->datep, $this->fk_typepayment, // Payment mode id or code ("CHQ or VIR for example") $label, -$amount, diff --git a/htdocs/expensereport/payment/payment.php b/htdocs/expensereport/payment/payment.php index 6456bf80d7f..20b49b1533c 100644 --- a/htdocs/expensereport/payment/payment.php +++ b/htdocs/expensereport/payment/payment.php @@ -107,8 +107,8 @@ if ($action == 'add_payment') { // Create a line of payments $payment = new PaymentExpenseReport($db); $payment->fk_expensereport = $expensereport->id; - $payment->datepaid = $datepaid; - $payment->amounts = $amounts; // Tableau de montant + $payment->datep = $datepaid; + $payment->amounts = $amounts; // Tableau de montant $payment->total = $total; $payment->fk_typepayment = GETPOST("fk_typepayment", 'int'); $payment->num_payment = GETPOST("num_payment", 'alphanothtml'); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2a9b583b9e9..b54eff6a0e3 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -82,7 +82,7 @@ class MyObject extends CommonObject * 'date', 'datetime', 'timestamp', 'duration', * 'boolean', 'checkbox', 'radio', 'array', * 'mail', 'phone', 'url', 'password', 'ip' - * Note: Filter must be a Dolibarr filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)" + * Note: Filter must be a Dolibarr Universal Filter syntax string. Example: "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.status:!=:0) or (t.nature:is:NULL)" * 'label' the translation key. * 'picto' is code of a picto to show before value in forms * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) @@ -260,7 +260,7 @@ class MyObject extends CommonObject } // Example to show how to set values of fields definition dynamically - /*if ($user->rights->mymodule->myobject->read) { + /*if ($user->hasRights->('mymodule', 'myobject', 'read')) { $this->fields['myfield']['visible'] = 1; $this->fields['myfield']['noteditable'] = 0; }*/ diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b42384e934d..9141810d9c8 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2199,7 +2199,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $arrayselected[] = $cat->id; } } - if (GETPOSTISSET('categories', 'array')) { + if (GETPOSTISARRAY('categories')) { foreach (GETPOST('categories', 'array') as $cat) { $arrayselected[] = $cat; } diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php index 02d8e6e2002..f22e688327a 100644 --- a/htdocs/product/reassort.php +++ b/htdocs/product/reassort.php @@ -534,7 +534,7 @@ if ($resql) { print img_warning($langs->trans("StockLowerThanLimit", $objp->seuil_stock_alerte)).' '; } if ($objp->stock_physique < 0) { print ''; } - print price2num($product->stock_theorique, 'MS', 0, $langs, 1, 0); + print price(price2num($product->stock_theorique, 'MS'), 0, $langs, 1, 0); if ($objp->stock_physique < 0) { print ''; } print ''; } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index af2898a8556..dafe53a19d8 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -321,7 +321,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { // VAT print ''.$langs->trans("VATRate").''; - print $form->load_tva("tva_tx", $object->tva_tx, $mysoc, '', $object->id, $object->tva_npr, '', false, 1); + print $form->load_tva("tva_tx", GETPOST("tva_tx", "alpha"), $mysoc, '', $object->id, 0, '', false, 1); print ''; // Price base @@ -329,7 +329,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print $langs->trans('PriceBase'); print ''; print ''; - print $form->selectPriceBaseType($object->price_base_type, "price_base_type"); + print $form->selectPriceBaseType(GETPOST("price_base_type", "aZ09"), "price_base_type"); print ''; print ''; diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 55d63c3d40a..ee47afffc0e 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -129,7 +129,9 @@ print '
'; print '
'; -print ''.$langs->trans("UserPublicPageDesc").'

'; +if (!getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { + print ''.$langs->trans("UserPublicPageDesc").'

'; +} $param = '&id='.((int) $object->id); $param .= '&dol_openinpopup=1'; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 8ccd4882ac7..3d54742b38d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2023 Laurent Destailleur * Copyright (C) 2020 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify