diff --git a/ChangeLog b/ChangeLog index ae767c91649..76709bd8f85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,9 +4,20 @@ English Dolibarr ChangeLog ***** ChangeLog for 17.0.0 compared to 16.0.0 ***** +For users: +--------------- + +... + + For developers or integrators: ------------------------------ +... + + +WARNING: + Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product @@ -192,6 +203,8 @@ NEW: Add hooks select product list and select thirdparty list function NEW: Add hook to getSellPrice function +WARNING: + Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * There is a new specific permission to be allowed to enter timesheets. If you use timesheet, don't forget to give the new permission (disable and enable the module project if it is not visible). @@ -489,6 +502,8 @@ NEW: we need to be able to put more filters on deleteByParentField() function NEW: make it easier to set the `keyword`, `keywords` and `description` attributes of an ecm file object NEW: Experimental feature to manage user sessions in database + +WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * ALL EXTERNAL MODULES THAT WERE NOT CORRECTLY DEVELOPPED WILL NOT WORK ON V15 (All modules that forgot to manage the security token field diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c60308138d2..03d3c1f3d06 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1511,7 +1511,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; + $labeltouse = getDolGlobalString("ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION"); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 3075225abb9..1995485eb4e 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -63,6 +63,7 @@ $search_email = GETPOST("search_email", 'alpha'); $search_categ = GETPOST("search_categ", 'int'); $search_filter = GETPOST("search_filter", 'alpha'); $search_status = GETPOST("search_status", 'intcomma'); +$search_morphy = GETPOST("search_morphy", 'alpha'); $search_import_key = trim(GETPOST("search_import_key", "alpha")); $catid = GETPOST("catid", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -382,6 +383,9 @@ if ($search_status != '') { // Peut valoir un nombre ou liste de nombre separes par virgules $sql .= " AND d.statut in (".$db->sanitize($db->escape($search_status)).")"; } +if ($search_morphy != '') { + $sql .= natural_search("d.morphy", $search_morphy); +} if ($search_ref) { $sql .= natural_search("d.ref", $search_ref); } @@ -731,6 +735,11 @@ if (!empty($arrayfields['d.login']['checked'])) { } if (!empty($arrayfields['d.morphy']['checked'])) { print ''; + $arraymorphy = array('mor'=>$langs->trans("Moral"), 'phy'=>$langs->trans("Physical")); + print $form->selectarray('search_morphy', $arraymorphy, $search_morphy, 1); + print ''; +} +if (!empty($arrayfields['t.libelle']['checked'])) { print ''; } if (!empty($arrayfields['t.libelle']['checked'])) { diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 326e7028bbf..a8d33ae5a09 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -47,8 +47,9 @@ if (!in_array('clicktodial', $conf->modules)) { if ($action == 'setvalue' && $user->admin) { $result1 = dolibarr_set_const($db, "CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", GETPOST("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS"), 'chaine', 0, '', $conf->entity); $result2 = dolibarr_set_const($db, "CLICKTODIAL_URL", GETPOST("CLICKTODIAL_URL"), 'chaine', 0, '', $conf->entity); + $result3 = dolibarr_set_const($db, "CLICKTODIAL_KEY_FOR_CIDLOOKUP", GETPOST("CLICKTODIAL_KEY_FOR_CIDLOOKUP"), 'chaine', 0, '', $conf->entity); - if ($result1 >= 0 && $result2 >= 0) { + if ($result1 >= 0 && $result2 >= 0 && $result3 >= 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else { setEventMessages($langs->trans("Error"), null, 'errors'); @@ -80,7 +81,7 @@ print ''; print '
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; @@ -89,21 +90,21 @@ print ''; print ''; +print ''; +print ''; +print ''; +print ''; + print '
'.$langs->trans("Name").''.$langs->trans("Name").''.$langs->trans("Value").'
'; print $langs->trans("ClickToDialUseTelLink").''; print $form->selectyesno("CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS", $conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS, 1).'
'; print '
'; -print $langs->trans("ClickToDialUseTelLinkDesc"); +print ''.$langs->trans("ClickToDialUseTelLinkDesc").''; print '
'; print $langs->trans("DefaultLink").''; -print 'global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS ? ' disabled="disabled"' : '').' value="'.$conf->global->CLICKTODIAL_URL.'">
'; +print '
'; print ajax_autoselect('CLICKTODIAL_URL'); print '
'; print $langs->trans("ClickToDialUrlDesc").'
'; print '
'; print ''; print $langs->trans("Examples").':
'; -print 'https://myphoneserver/mypage?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
'; -print 'sip:__PHONETO__@my.sip.server'; +print '* https://myphoneserver/phoneurl?login=__LOGIN__&password=__PASS__&caller=__PHONEFROM__&called=__PHONETO__
'; +print '* sip:__PHONETO__@my.sip.server'; print '
'; //if (! empty($user->clicktodial_url)) @@ -114,6 +115,37 @@ print ''; print '
'.$langs->trans("SecurityKey").''; + +global $dolibarr_main_url_root; + +// Define $urlwithroot +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + +// Url for CIDLookup +//print '
'; +//print $langs->trans("URLToLaunchCronJobs").':
'; +$url = $urlwithroot.'/public/clicktodial/cidlookup.php?securitykey='.getDolGlobalString('CLICKTODIAL_KEY_FOR_CIDLOOKUP', 'ValueToDefine').'&phone=...'; +//print img_picto('', 'globe').' '.$url."
\n"; +//print '
'; +//print '
'; + + +print ''.$langs->trans("CIDLookupURL").''; +print '
'.$url; +print '
'; +print '
'; +print ''; +if (!empty($conf->use_javascript_ajax)) { + print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); +} +print '
'; print '
'; @@ -156,6 +188,23 @@ if (!empty($conf->global->CLICKTODIAL_URL)) { } } +if (!empty($conf->use_javascript_ajax)) { + print "\n".''; +} + // End of page llxFooter(); $db->close(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 6453210e596..fa5d6deae97 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -2090,6 +2090,8 @@ if ($id > 0) { $valuetoshow = $langs->trans($obj->{$value}); } elseif ($value == 'block_if_negative') { $valuetoshow = yn($obj->{$value}); + } elseif ($value == 'icon') { + $valuetoshow = $obj->{$value}." ".img_picto("", $obj->{$value}); } elseif ($value == 'type_duration') { $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); $valuetoshow =$TDurationTypes[$obj->{$value}]; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 38245b5e204..760df948d34 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -188,6 +188,7 @@ print '
'; print ''; print ''; +print '
'; print ''; print ''; print ''; @@ -198,7 +199,7 @@ print ''; print ''; print ''; @@ -224,7 +225,7 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER", $arrval, getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER')); } print ''; print ''; @@ -236,11 +237,12 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX", $arrval, getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX')); } print ''; print ''; print '
'.$langs->trans("Parameter").'
'; print $langs->trans("NotificationEMailFrom").''; print img_picto('', 'email', 'class="pictofixedwidth"'); -print ''; +print ''; if (!empty($conf->global->NOTIFICATION_EMAIL_FROM) && !isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) { print ' '.img_warning($langs->trans("ErrorBadEMail")); } @@ -212,7 +213,7 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT'); } else { $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, $conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT); + print $form->selectarray("NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT", $arrval, getDolGlobalString('NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT')); } print '
'; +print '
'; print $form->buttonsSaveCancel("Save", ''); @@ -387,6 +389,7 @@ if (!empty($conf->societe->enabled)) { } print ''; +print '
'; print ''; print ''; print ''; @@ -449,7 +452,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1]; $value = GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key') ?GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key', 'alpha') : $conf->global->$param; - $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. $arrayemail = explode(',', $value); $showwarning = 0; foreach ($arrayemail as $keydet => $valuedet) { @@ -468,7 +471,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { } // New entry input fields if (empty($inputfieldalreadyshown) || !$codehasnotrigger) { - $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. + $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
'.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); } print ''; @@ -501,6 +504,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { print ''; } print '
'.$langs->trans("Module").'
'; +print '
'; print $form->buttonsSaveCancel("Save", ''); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4b51a519223..57f2662bcfc 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -914,8 +914,10 @@ if ($object->id > 0) { * Latest orders */ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { + $param =""; + $sql = "SELECT s.nom, s.rowid"; - $sql .= ", c.rowid as cid, c.total_ht"; + $sql .= ", c.rowid as cid, c.entity, c.total_ht"; $sql .= ", c.total_tva"; $sql .= ", c.total_ttc"; $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture"; @@ -1024,7 +1026,7 @@ if ($object->id > 0) { */ if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire) { $sql = 'SELECT e.rowid as id'; - $sql .= ', e.ref'; + $sql .= ', e.ref, e.entity'; $sql .= ', e.date_creation'; $sql .= ', e.fk_statut as statut'; $sql .= ', s.nom'; diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index fb4f9eb17d4..226c4bc350e 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -1,6 +1,4 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f63d58db933..25543ed9d82 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -57,6 +57,7 @@ class Paiement extends CommonObject public $facid; public $datepaye; + public $date; // same than $datepaye /** * @deprecated @@ -153,6 +154,7 @@ class Paiement extends CommonObject */ public $ref_ext; + /** * Constructor * diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 5cdc0d0c6e4..52cde1877b8 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1199,6 +1199,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Categories if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + $arrayselected = array(); print ''.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, null, null, null, 1); @@ -1301,11 +1302,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $action = 'presend'; } + // View mode if (!empty($id) && $action != 'edit' && $action != 'create') { $objsoc = new Societe($db); - // View mode - // Show errors dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors); @@ -1530,9 +1530,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if ($object->user_id) { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); - print $dolibarr_user->getLoginUrl(1); + print $dolibarr_user->getLoginUrl(-1); } else { - print $langs->trans("NoDolibarrAccess"); + //print ''.$langs->trans("NoDolibarrAccess").''; + if (!$object->user_id && $user->rights->user->user->creer) { + print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").''; + } } print ''; @@ -1565,10 +1568,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans('Modify').''; } - if (!$object->user_id && $user->rights->user->user->creer) { - print ''.$langs->trans("CreateDolibarrLogin").''; - } - // Activer if ($object->statut == 0 && $user->rights->societe->contact->creer) { print ''.$langs->trans("Reactivate").''; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 41a6a74dd4b..0ba88228666 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -167,7 +167,7 @@ if ($object->thirdparty->client) { } } -if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { +if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) { $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions'); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 801c859924e..1e497b0ab2e 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -342,6 +342,9 @@ $formother = new FormOther($db); $formcompany = new FormCompany($db); $contactstatic = new Contact($db); +$morejs=array(); +$morecss = array(); + if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { $contactstatic->loadCacheOfProspStatus(); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a336784e653..b6b3a9d6295 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7718,16 +7718,24 @@ abstract class CommonObject } if ($result > 0) { if ($object->element === 'product') { - $getnomurlparam3 = (!isset($InfoFieldList[5]) ? 0 : $InfoFieldList[5]); - $getnomurlparam4 = (!isset($InfoFieldList[6]) ? -1 : $InfoFieldList[6]); - $getnomurlparam5 = (!isset($InfoFieldList[7]) ? 0 : $InfoFieldList[7]); - $getnomurlparam6 = (!isset($InfoFieldList[8]) ? '' : $InfoFieldList[8]); - $getnomurlparam7 = (!isset($InfoFieldList[9]) ? 0 : $InfoFieldList[9]); + $get_name_url_param_arr = array($getnomurlparam, $getnomurlparam2, 0, -1, 0, '', 0); + if (isset($val['get_name_url_params'])) { + $get_name_url_params = explode(':', $val['get_name_url_params']); + if (!empty($get_name_url_params)) { + $param_num_max = count($get_name_url_param_arr) - 1; + foreach ($get_name_url_params as $param_num => $param_value) { + if ($param_num > $param_num_max) { + break; + } + $get_name_url_param_arr[$param_num] = $param_value; + } + } + } /** * @var Product $object */ - $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2, $getnomurlparam3, $getnomurlparam4, $getnomurlparam5, $getnomurlparam6, $getnomurlparam7); + $value = $object->getNomUrl($get_name_url_param_arr[0], $get_name_url_param_arr[1], $get_name_url_param_arr[2], $get_name_url_param_arr[3], $get_name_url_param_arr[4], $get_name_url_param_arr[5], $get_name_url_param_arr[6]); } else { $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2); } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 2fe60cc323c..e24afd73879 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -1316,7 +1316,7 @@ class DolGraph if (empty($showlegend)) { $this->stringtoshow .= 'legend: { display: false }, '."\n"; } else { - $this->stringtoshow .= 'legend: { maxWidth: '.round($this->width / 2).', labels: { boxWidth: 15 }, position: \'' . ($showlegend == 2 ? 'right' : 'top') . '\' },'."\n"; + $this->stringtoshow .= 'legend: { maxWidth: '.round(intVal($this->width) / 2).', labels: { boxWidth: 15 }, position: \'' . (($showlegend && $showlegend == 2) ? 'right' : 'top') . '\' },'."\n"; } $this->stringtoshow .= "}, \n"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 68bca2606b7..625791ea0d0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3342,7 +3342,6 @@ class Form } $outref = $objp->ref; - $outval = ''; $outbarcode = $objp->barcode; $outqty = 1; $outdiscount = 0; @@ -3523,48 +3522,52 @@ class Form } } - $opt = '\n"; // Add new entry // "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax // "label" value of json key array is used by jQuery automatically as text for combo box - $out .= $opt; - array_push( - $outarray, - array('key'=>$outkey, - 'value'=>$outref, - 'label'=>$outval, - 'qty'=>$outqty, - 'price_qty_ht'=>price2num($objp->fprice, 'MU'), // Keep higher resolution for price for the min qty - 'price_unit_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price - 'price_ht'=>price2num($objp->unitprice, 'MU'), // This is used to fill the Unit Price (for compatibility) - 'tva_tx'=>$objp->tva_tx, - 'default_vat_code'=>$objp->default_vat_code, - 'discount'=>$outdiscount, - 'type'=>$outtype, - 'duration_value'=>$outdurationvalue, - 'duration_unit'=>$outdurationunit, - 'disabled'=>(empty($objp->idprodfournprice) ? true : false), - 'description'=>$objp->description - ) - ); + $out .= $optstart . ' data-html="'.dol_escape_htmltag($optlabel).'">' . $optlabel . "\n";; + array_push($outarray, $outarrayentry); + // Exemple of var_dump $outarray // array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp" // ["label"]=>string(76) "ppp (fff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)" diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 32f2a9b1007..2a900ea53a4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -825,13 +825,14 @@ class FormCompany extends Form /** * showContactRoles on view and edit mode * - * @param string $htmlname Html component name and id - * @param Contact $contact Contact Obejct - * @param string $rendermode view, edit - * @param array $selected $key=>$val $val is selected Roles for input mode - * @return string String with contacts roles + * @param string $htmlname Html component name and id + * @param Contact $contact Contact Obejct + * @param string $rendermode view, edit + * @param array $selected $key=>$val $val is selected Roles for input mode + * @param string $morecss More css + * @return string String with contacts roles */ - public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array()) + public function showRoles($htmlname, Contact $contact, $rendermode = 'view', $selected = array(), $morecss = 'minwidth500') { if ($rendermode === 'view') { $toprint = array(); @@ -856,7 +857,7 @@ class FormCompany extends Form $selected = $newselected; } } - return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, 'minwidth500'); + return $this->multiselectarray($htmlname, $contactType, $selected, 0, 0, $morecss); } return 'ErrorBadValueForParameterRenderMode'; // Should not happened diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index df7408200a9..4c77566eeed 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -954,7 +954,7 @@ class FormMail extends Form $out .= ''; } else { if (!isset($this->ckeditortoolbar)) { - $this->ckeditortoolbar = 'dolibarr_notes'; + $this->ckeditortoolbar = 'dolibarr_mailings'; } // Editor wysiwyg diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 5bee2f31dd4..103b370dcb0 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1513,9 +1513,10 @@ class FormOther * @param array $search_xaxis Array of preselected fields * @param array $arrayofxaxis Array of groupby to fill * @param string $showempty '1' or 'text' + * @param string $morecss More css * @return string HTML string component */ - public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1') + public function selectXAxisField($object, $search_xaxis, &$arrayofxaxis, $showempty = '1', $morecss = 'minwidth250 maxwidth500') { global $form; @@ -1523,7 +1524,7 @@ class FormOther foreach ($arrayofxaxis as $key => $val) { $arrayofxaxislabel[$key] = $val['label']; } - $result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth250 maxwidth500', 1); + $result = $form->selectarray('search_xaxis', $arrayofxaxislabel, $search_xaxis, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); return $result; } diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 6b45cd08f98..caeece975f2 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -181,21 +181,21 @@ class Menubase if (!isset($this->enabled)) { $this->enabled = '1'; } - $this->menu_handler = trim($this->menu_handler); - $this->module = trim($this->module); - $this->type = trim($this->type); - $this->mainmenu = trim($this->mainmenu); - $this->leftmenu = trim($this->leftmenu); + $this->menu_handler = trim((string) $this->menu_handler); + $this->module = trim((string) $this->module); + $this->type = trim((string) $this->type); + $this->mainmenu = trim((string) $this->mainmenu); + $this->leftmenu = trim((string) $this->leftmenu); $this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined - $this->fk_mainmenu = trim($this->fk_mainmenu); - $this->fk_leftmenu = trim($this->fk_leftmenu); + $this->fk_mainmenu = trim((string) $this->fk_mainmenu); + $this->fk_leftmenu = trim((string) $this->fk_leftmenu); $this->position = (int) $this->position; - $this->url = trim($this->url); - $this->target = trim($this->target); - $this->title = trim($this->title); - $this->langs = trim($this->langs); - $this->perms = trim($this->perms); - $this->enabled = trim($this->enabled); + $this->url = trim((string) $this->url); + $this->target = trim((string) $this->target); + $this->title = trim((string) $this->title); + $this->langs = trim((string) $this->langs); + $this->perms = trim((string) $this->perms); + $this->enabled = trim((string) $this->enabled); $this->user = (int) $this->user; if (empty($this->position)) { $this->position = 0; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 46b885bd60a..c1222a6b762 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -217,7 +217,7 @@ foreach ($arrayoftype as $key => $val) { if (dol_eval($val['enabled'], 1, 1, '1')) { $newarrayoftype[$key] = $arrayoftype[$key]; } - if ($val['langs']) { + if (!empty($val['langs'])) { $langs->load($val['langs']); } } @@ -450,7 +450,7 @@ $simplearrayofmesures = array(); foreach ($arrayofmesures as $key => $val) { $simplearrayofmesures[$key] = $arrayofmesures[$key]['label']; } -print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth400', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields +print $form->multiselectarray('search_measures', $simplearrayofmesures, $search_measures, 0, 0, 'minwidth300', 1, 0, '', '', $langs->trans("Measures")); // Fill the array $arrayofmeasures with possible fields print ''; // XAxis @@ -458,7 +458,7 @@ $count = 0; print '
'; print '
'; //var_dump($arrayofxaxis); -print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis")); // Fill the array $arrayofxaxis with possible fields +print $formother->selectXAxisField($object, $search_xaxis, $arrayofxaxis, $langs->trans("XAxis"), 'minwidth300 maxwidth400'); // Fill the array $arrayofxaxis with possible fields print '
'; // Group by @@ -970,31 +970,31 @@ function fillArrayOfMeasures($object, $tablealias, $labelofobject, &$arrayofmesu // Add main fields of object foreach ($object->fields as $key => $val) { if (!empty($val['isameasure']) && (!isset($val['enabled']) || dol_eval($val['enabled'], 1, 1, '1'))) { - $position = (!empty($val['position']) ? $val['position'] : 0); + $position = (empty($val['position']) ? 0 : intVal($val['position'])); $arrayofmesures[$tablealias.'.'.$key.'-sum'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Sum").')', - 'position' => ($position+($count * 100000)).'.1', + 'position' => ($position + ($count * 100000)).'.1', 'table' => $object->table_element ); $arrayofmesures[$tablealias.'.'.$key.'-average'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Average").')', - 'position' => ($position+($count * 100000)).'.2', + 'position' => ($position + ($count * 100000)).'.2', 'table' => $object->table_element ); $arrayofmesures[$tablealias.'.'.$key.'-min'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Minimum").')', - 'position' => ($position+($count * 100000)).'.3', + 'position' => ($position + ($count * 100000)).'.3', 'table' => $object->table_element ); $arrayofmesures[$tablealias.'.'.$key.'-max'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$langs->trans("Maximum").')', - 'position' => ($position+($count * 100000)).'.4', + 'position' => ($position + ($count * 100000)).'.4', 'table' => $object->table_element ); } } // Add extrafields to Measures - if ($object->isextrafieldmanaged) { + if (!empty($object->isextrafieldmanaged)) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['totalizable'][$key]) && (!isset($extrafields->attributes[$object->table_element]['enabled'][$key]) || dol_eval($extrafields->attributes[$object->table_element]['enabled'][$key], 1, 1, '1'))) { $position = (!empty($val['position']) ? $val['position'] : 0); @@ -1098,26 +1098,27 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $position = (!empty($val['position']) ? $val['position'] : 0); + $position = (empty($val['position']) ? 0 : intVal($val['position'])); $arrayofxaxis[$tablealias.'.'.$key.'-year'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', - 'position' => ($position+($count * 100000)).'.1', + 'position' => ($position + ($count * 100000)).'.1', 'table' => $object->table_element ); $arrayofxaxis[$tablealias.'.'.$key.'-month'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', - 'position' => ($position+($count * 100000)).'.2', + 'position' => ($position + ($count * 100000)).'.2', 'table' => $object->table_element ); $arrayofxaxis[$tablealias.'.'.$key.'-day'] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', - 'position' => ($position+($count * 100000)).'.3', + 'position' => ($position + ($count * 100000)).'.3', 'table' => $object->table_element ); } else { + $position = (empty($val['position']) ? 0 : intVal($val['position'])); $arrayofxaxis[$tablealias.'.'.$key] = array( 'label' => img_picto('', $object->picto, 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), - 'position' => ($position+($count * 100000)), + 'position' => ($position + ($count * 100000)), 'table' => $object->table_element ); } @@ -1125,7 +1126,7 @@ function fillArrayOfXAxis($object, $tablealias, $labelofobject, &$arrayofxaxis, } // Add extrafields to X-Axis - if ($object->isextrafieldmanaged) { + if (!empty($object->isextrafieldmanaged)) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { continue; @@ -1196,7 +1197,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup // Add main fields of object foreach ($object->fields as $key => $val) { - if (!$val['isameasure']) { + if (empty($val['isameasure'])) { if (in_array($key, array( 'id', 'ref_int', 'ref_ext', 'rowid', 'entity', 'last_main_doc', 'logo', 'logo_squarred', 'extraparams', 'parent', 'photo', 'socialnetworks', 'webservices_url', 'webservices_key'))) { @@ -1218,26 +1219,27 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup continue; } if (in_array($val['type'], array('timestamp', 'date', 'datetime'))) { - $position = (!empty($val['position']) ? $val['position'] : 0); + $position = (empty($val['position']) ? 0 : intVal($val['position'])); $arrayofgroupby[$tablealias.'.'.$key.'-year'] = array( 'label' => img_picto('', $object->picto, - 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($position+($count * 100000)).'.1', + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.')', 'position' => ($position + ($count * 100000)).'.1', 'table' => $object->table_element ); $arrayofgroupby[$tablealias.'.'.$key.'-month'] = array( 'label' => img_picto('', $object->picto, - 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($position+($count * 100000)).'.2', + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.')', 'position' => ($position + ($count * 100000)).'.2', 'table' => $object->table_element ); $arrayofgroupby[$tablealias.'.'.$key.'-day'] = array( 'label' => img_picto('', $object->picto, - 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($position+($count * 100000)).'.3', + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']).' ('.$YYYY.'-'.$MM.'-'.$DD.')', 'position' => ($position + ($count * 100000)).'.3', 'table' => $object->table_element ); } else { + $position = (empty($val['position']) ? 0 : intVal($val['position'])); $arrayofgroupby[$tablealias.'.'.$key] = array( 'label' => img_picto('', $object->picto, - 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($position+($count * 100000)), + 'class="pictofixedwidth"').' '.$labelofobject.': '.$langs->trans($val['label']), 'position' => ($position + ($count * 100000)), 'table' => $object->table_element ); } @@ -1245,7 +1247,7 @@ function fillArrayOfGroupBy($object, $tablealias, $labelofobject, &$arrayofgroup } // Add extrafields to Group by - if ($object->isextrafieldmanaged) { + if (! empty($object->isextrafieldmanaged)) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { continue; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 6c097e97073..908dacb870c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -896,14 +896,15 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel /** * Show html area for list of contacts * - * @param Conf $conf Object conf - * @param Translate $langs Object langs - * @param DoliDB $db Database handler - * @param Societe $object Third party object - * @param string $backtopage Url to go once contact is created + * @param Conf $conf Object conf + * @param Translate $langs Object langs + * @param DoliDB $db Database handler + * @param Societe $object Third party object + * @param string $backtopage Url to go once contact is created + * @param int $showuserlogin 1=Show also user login if it exists * @return int */ -function show_contacts($conf, $langs, $db, $object, $backtopage = '') +function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserlogin = 0) { global $user, $conf, $extrafields, $hookmanager; global $contextpage; @@ -1137,13 +1138,16 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') if (in_array($key, array('statut'))) { print $form->selectarray('search_status', array('-1'=>'', '0'=>$contactstatic->LibStatut(0, 1), '1'=>$contactstatic->LibStatut(1, 1)), $search_status); } elseif (in_array($key, array('role'))) { - print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles); + print $formcompany->showRoles("search_roles", $contactstatic, 'edit', $search_roles, 'minwidth200 maxwidth300'); } else { print ''; } print ''; } } + if ($showuserlogin) { + print ''; + } // Extra fields $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -1183,6 +1187,9 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') print getTitleFieldOfList($arrayfields['sc.'.$key]['label'], 0, $_SERVER['PHP_SELF'], '', '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n"; } } + if ($showuserlogin) { + print ''.$langs->trans("DolibarrLogin").''; + } // Extra fields $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -1281,6 +1288,16 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '') print ''.$contactstatic->getLibStatut(5).''; } + if ($showuserlogin) { + print ''; + $tmpuser= new User($db); + $resfetch = $tmpuser->fetch(0, '', '', 0, -1, '', $contactstatic->id); + if ($resfetch > 0) { + print $tmpuser->getNomUrl(1, '', 0, 0, 24, 1); + } + print ''; + } + // Extra fields $extrafieldsobjectkey = $contactstatic->table_element; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 51d26491826..9250251de11 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7461,8 +7461,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__MEMBER_PHONEMOBILE__'] = (isset($object->phone_mobile) ? dol_print_phone($object->phone_mobile) : ''); $substitutionarray['__MEMBER_TYPE__'] = (isset($object->type) ? $object->type : ''); $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc'); - $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc'); - $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc'); + $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = (isset($object->first_subscription_date_start) ? dol_print_date($object->first_subscription_date_start, 'dayrfc') : ''); + $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = (isset($object->first_subscription_date_end) ? dol_print_date($object->first_subscription_date_end, 'dayrfc') : ''); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'dayrfc'); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'dayrfc'); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc'); @@ -8599,7 +8599,8 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1, $onlysimplestring = '1' if ($onlysimplestring == '1') { // We must accept: '1 && getDolGlobalInt("doesnotexist1") && $conf->global->MAIN_FEATURES_LEVEL' // We must accept: '$conf->barcode->enabled && preg_match(\'/^(AAA|BBB)/\',$leftmenu)' - if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/', '/').']/i', $s)) { + // We must accept: '$user->rights->cabinetmed->read && $object->canvas=="patient@cabinetmed"' + if (preg_match('/[^a-z0-9\s'.preg_quote('^$_+-.*>&|=!?():"\',/@', '/').']/i', $s)) { if ($returnvalue) { return 'Bad string syntax to evaluate (found chars that are not chars for simplestring): '.$s; } else { @@ -9020,6 +9021,7 @@ function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, if ($values[0] != $type) { continue; } + //var_dump(verifCond($values[4])); if (verifCond($values[4])) { if ($values[3]) { diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 8afafd8c06c..314a1fa7853 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -1,6 +1,4 @@ * Copyright (C) 2020 Josep Lluís Amador * diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 0fc13cbe134..842495c242d 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -173,7 +173,7 @@ class pdf_standard extends CommonStickerGenerator $widthtouse = $maxwidthtouse; $heighttouse = 0; // old value for image $tmp = dol_getImageSize($photo, false); - if ($tmp['height']) { + if (isset($tmp['height'])) { $imgratio = $tmp['width'] / $tmp['height']; if ($imgratio >= $defaultratio) { $widthtouse = $maxwidthtouse; @@ -314,10 +314,10 @@ class pdf_standard extends CommonStickerGenerator complete_substitutions_array($substitutionarray, $langs); // For business cards - $textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); - $textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); - $textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); - $textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); + $textleft = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT"), $substitutionarray); + $textheader = make_substitutions(getDolGlobalString("ADHERENT_CARD_HEADER_TEXT"), $substitutionarray); + $textfooter = make_substitutions(getDolGlobalString("ADHERENT_CARD_FOOTER_TEXT"), $substitutionarray); + $textright = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT_RIGHT"), $substitutionarray); $nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY']; if ($nb <= 0) { @@ -330,8 +330,8 @@ class pdf_standard extends CommonStickerGenerator 'textheader'=>$textheader, 'textfooter'=>$textfooter, 'textright'=>$textright, - 'id'=>$object->rowid, - 'photo'=>$object->photo + 'id'=>(isset($object->rowid) ? $object->rowid : ""), + 'photo'=>(isset($object->photo) ? $object->photo : "") ); } diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index aeafac07962..2a12a07fd23 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -68,6 +68,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield']; } if (is_numeric($obj->$tmpkey)) { + if (!isset($totalarray['totalizable'][$key]['total'])) { + $totalarray['totalizable'][$key]['total'] = 0; + } $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; } } diff --git a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php index 6e4f8cb1563..b4d32860c82 100644 --- a/htdocs/core/triggers/interface_50_modNotification_Notification.class.php +++ b/htdocs/core/triggers/interface_50_modNotification_Notification.class.php @@ -90,7 +90,7 @@ class InterfaceNotification extends DolibarrTriggers */ public function getListOfManagedEvents() { - global $conf; + global $conf, $action; global $hookmanager; @@ -100,6 +100,8 @@ class InterfaceNotification extends DolibarrTriggers } $hookmanager->initHooks(array('notification')); + $parameters = array(); + $object = new stdClass(); $reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action); if (empty($reshook)) { if (!empty($hookmanager->resArray['arrayofnotifsupported'])) { diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index 28078242dc6..ff413a8a1c2 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -133,15 +133,16 @@ if (!empty($conf->use_javascript_ajax)) { print "\n".''; } diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index 5a27b97b691..6b7e27c67aa 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -417,17 +417,19 @@ class ActionsDatapolicy } if (GETPOST('socid')) { + /* Removed due to awful harcoded values require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); - if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { + if (!empty($object->forme_juridique_code) && !in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $jsscript .= ''; } + */ } } elseif ($parameters['currentcontext'] == 'contactcard') { if (GETPOST('action') == 'create' || GETPOST('action') == 'edit') { diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 419727b1cca..8b4b7bf31c4 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -510,6 +510,7 @@ if (!function_exists('ftp_connect')) { $nboflines = count($contents); $rawlisthasfailed = false; $i = 0; + $nbofentries = 0; while ($i < $nboflines && $i < 1000) { $vals = preg_split('@ +@', utf8_encode($buff[$i]), 9); //$vals=preg_split('@ +@','drwxr-xr-x 2 root root 4096 Aug 30 2008 backup_apollon1',9); @@ -527,6 +528,7 @@ if (!function_exists('ftp_connect')) { // Is it a directory ? $is_directory = 0; + $is_link = 0; if ($file == '..') { $is_directory = 1; } elseif (!$rawlisthasfailed) { @@ -695,6 +697,7 @@ function dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $sect $ok = 1; $conn_id = null; + $mesg=""; if (!is_numeric($ftp_port)) { $mesg = $langs->transnoentitiesnoconv("FailedToConnectToFTPServer", $ftp_server, $ftp_port); diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 383d3577a8e..68454c6772e 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -910,7 +910,7 @@ $edit = false; if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') { // If user has no permission to create a leave - if ((in_array($fuserid, $childids) && empty($user->rights->holiday->write)) || (!in_array($fuserid, $childids) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->holiday->writeall_advance)))) { + if ((in_array($fuserid, $childids) && empty($user->rights->holiday->write)) || (!in_array($fuserid, $childids) && ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->holiday->writeall_advance) || empty($user->rights->holiday->writeall))))) { $errors[] = $langs->trans('CantCreateCP'); } else { // Form to add a leave request diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 7e21909bb06..1923204c272 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -80,8 +80,8 @@ if (!empty($useragent)) { } -// Check PHP version -$arrayphpminversionerror = array(5, 5, 0); +// Check PHP version min +$arrayphpminversionerror = array(5, 6, 0); $arrayphpminversionwarning = array(5, 6, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { // Minimum to use (error if lower) print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); @@ -97,6 +97,14 @@ if (empty($force_install_nophpinfo)) { } print "
\n"; +// Check PHP version max +$arrayphpmaxversionwarning = array(8, 1, 0); +if (versioncompare(versionphparray(), $arrayphpmaxversionwarning) > 0 && versioncompare(versionphparray(), $arrayphpmaxversionwarning) < 3) { // Maximum to use (warning if higher) + print 'Error '.$langs->trans("ErrorPHPVersionTooHigh", versiontostring($arrayphpmaxversionwarning)); + $checksok = 1; // 0=error, 1=warning + print "
\n"; +} + // Check PHP support for $_GET and $_POST if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) { // We must keep $_GET and $_POST here diff --git a/htdocs/install/doctemplates/websites/website_template-style02.jpg b/htdocs/install/doctemplates/websites/website_template-style02.jpg new file mode 100644 index 00000000000..63622f3b1cd Binary files /dev/null and b/htdocs/install/doctemplates/websites/website_template-style02.jpg differ diff --git a/htdocs/install/doctemplates/websites/website_template-style02.zip b/htdocs/install/doctemplates/websites/website_template-style02.zip new file mode 100644 index 00000000000..11116bcfc64 Binary files /dev/null and b/htdocs/install/doctemplates/websites/website_template-style02.zip differ diff --git a/htdocs/install/mysql/data/llx_c_socialnetworks.sql b/htdocs/install/mysql/data/llx_c_socialnetworks.sql index 468086291fc..7741f8cdfef 100644 --- a/htdocs/install/mysql/data/llx_c_socialnetworks.sql +++ b/htdocs/install/mysql/data/llx_c_socialnetworks.sql @@ -37,7 +37,7 @@ INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'gifycat', 'Gificat', '{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'giphy', 'Giphy', '{socialid}', '', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'github', 'GitHub', 'https://www.github.com/{socialid}', '', 0); -INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus-g', 0); +INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'googleplus', 'GooglePlus', 'https://www.googleplus.com/{socialid}', 'fa-google-plus', 0); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'instagram', 'Instagram', 'https://www.instagram.com/{socialid}', 'fa-instagram', 1); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'linkedin', 'LinkedIn', 'https://www.linkedin.com/{socialid}', 'fa-linkedin', 1); INSERT INTO llx_c_socialnetworks (entity, code, label, url, icon, active) VALUES ( 1, 'mastodon', 'Mastodon', '{socialid}', '', 0); diff --git a/htdocs/install/mysql/tables/llx_product_stock.sql b/htdocs/install/mysql/tables/llx_product_stock.sql index c5a2f4ad005..8132a71cdd3 100644 --- a/htdocs/install/mysql/tables/llx_product_stock.sql +++ b/htdocs/install/mysql/tables/llx_product_stock.sql @@ -16,6 +16,7 @@ -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . -- +-- See also its child table llx_product_batch that contains details per lot -- ============================================================================ create table llx_product_stock diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 813c7a4faa0..9de9cd23ef4 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2284,4 +2284,5 @@ AlwaysEnabled=Always Enabled DoesNotWorkWithAllThemes=Will not work with all themes NoName=No name ShowAdvancedOptions= Show advanced options -HideAdvancedoptions= Hide advanced options \ No newline at end of file +HideAdvancedoptions= Hide advanced options +CIDLookupURL=The module brings an URL that can be used by an external tool to get the name of a thirdparty or contact from its phone number. URL to use is: diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index 32f251707a4..6aee82bacec 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -24,7 +24,8 @@ ErrorWrongValueForParameter=You may have typed a wrong value for parameter '%s'. ErrorFailedToCreateDatabase=Failed to create database '%s'. ErrorFailedToConnectToDatabase=Failed to connect to database '%s'. ErrorDatabaseVersionTooLow=Database version (%s) too old. Version %s or higher is required. -ErrorPHPVersionTooLow=PHP version too old. Version %s is required. +ErrorPHPVersionTooLow=PHP version too old. Version %s or higher is required. +ErrorPHPVersionTooHigh=PHP version too high. Version %s or lower is required. ErrorConnectedButDatabaseNotFound=Connection to server successful but database '%s' not found. ErrorDatabaseAlreadyExists=Database '%s' already exists. ErrorNoMigrationFilesFoundForParameters=No migration file found for the selected versions diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 94330eb8dc1..b87131a4135 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -212,7 +212,7 @@ print ''; print ''; print ''.$langs->trans("MARGIN_METHODE_FOR_DISCOUNT").''; print ''; -print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, $conf->global->MARGIN_METHODE_FOR_DISCOUNT); +print Form::selectarray('MARGIN_METHODE_FOR_DISCOUNT', $methods, getDolGlobalString('MARGIN_METHODE_FOR_DISCOUNT')); print ''; print ''; print ''; @@ -230,7 +230,7 @@ print ''.$langs->trans("AgentContactType").''; print ''; $formcompany = new FormCompany($db); $facture = new Facture($db); -print $formcompany->selectTypeContact($facture, $conf->global->AGENT_CONTACT_TYPE, "AGENT_CONTACT_TYPE", "internal", "code", 1, "maxwidth250"); +print $formcompany->selectTypeContact($facture, getDolGlobalString('AGENT_CONTACT_TYPE'), "AGENT_CONTACT_TYPE", "internal", "code", 1, "maxwidth250"); print ''; print ''; print ''; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 78ba4461019..d7d167035a7 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -101,7 +101,7 @@ class Inventory extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax200'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php::::0:-1:0::1', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'get_name_url_params' => '0::0:-1:0::1', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'categories_product' => array('type'=>'chkbxlst:categorie:label:rowid::type=0:0:', 'label'=>'OrProductsWithCategories', 'visible'=>3, 'enabled'=>1, 'position'=>33, 'help'=>'', 'picto'=>'category', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default. 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 311b04a4c89..b4730778d32 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -720,7 +720,9 @@ if ($action == 'create') { $productstatic->type = $objp->type; $productstatic->entity = $objp->entity; $productstatic->status_batch = $objp->tobatch; - $productstatic->fk_unit = $objp->fk_unit; + if (!empty($conf->global->PRODUCT_USE_UNITS)) { + $productstatic->fk_unit = $objp->fk_unit; + } $productstatic->status = $objp->tosell; $productstatic->status_buy = $objp->tobuy; $productstatic->barcode = $objp->barcode; diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index de9f72fbcd6..29e337c3728 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -35,7 +35,7 @@ $ref = GETPOST('ref', 'alpha'); // Security check //$result=restrictedArea($user,'stock', $id, 'entrepot&stock'); $result = restrictedArea($user, 'stock'); - +$usercancreate = $user->rights->stock->creer; /* * View @@ -75,7 +75,7 @@ if (!empty($conf->project->enabled)) { $morehtmlref .= ''; $morehtmlref .= ''; } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!empty($object->socid) ? $object->socid : 0), $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (!empty($object->fk_project)) { diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 561ee5d5d4d..6a5499734bd 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -59,6 +59,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist'; $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list +$backtopage = GETPOST("backtopage", "alpha"); $idproduct = GETPOST('idproduct', 'int'); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 2743c4a5ea7..ba6b81abd79 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -42,6 +42,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productlotlist'; // To manage different context of search $optioncss = GETPOST('optioncss', 'alpha'); +$mode = GETPOST('mode', 'alpha'); $search_entity = GETPOST('search_entity', 'int'); $search_product = GETPOST('search_product', 'alpha'); diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index cfb46231a72..53803b0929d 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -112,12 +112,12 @@ if (!empty($conf->productbatch->enabled) && print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.$langs->trans("SellByDate").''; - print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate((!empty($d_sellby) ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print ''; } if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''.$langs->trans("EatByDate").''; - print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled + print $form->selectDate((!empty($d_eatby) ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print ''; } print ''; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index f527a13644e..52902604cec 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1062,6 +1062,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; + $nboftaskshown = 0; if (count($tasksarray) > 0) { // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 82628d5136b..bed307d65bf 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -175,7 +175,7 @@ if ($id > 0 || !empty($ref)) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 718af1bf17b..680f8ecc70a 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -239,7 +239,7 @@ if ($id > 0 || !empty($ref)) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 25bf2f94d5d..f86d9c8f441 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -195,7 +195,7 @@ if ($object->id > 0) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index b877c7c8a8d..6b7142dc0f2 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -185,7 +185,7 @@ if ($object->id > 0) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 31fa1547ffc..24cadfd38f4 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -128,6 +128,28 @@ if ($action == 'update' && !GETPOST("cancel") && $user->rights->projet->creer) { } } +if ($action == 'confirm_clone' && $confirm == 'yes') { + //$clone_contacts = GETPOST('clone_contacts') ? 1 : 0; + $clone_prog = GETPOST('clone_prog') ? 1 : 0; + $clone_time = GETPOST('clone_time') ? 1 : 0; + $clone_affectation = GETPOST('clone_affectation') ? 1 : 0; + $clone_change_dt = GETPOST('clone_change_dt') ? 1 : 0; + $clone_notes = GETPOST('clone_notes') ? 1 : 0; + $clone_file = GETPOST('clone_file') ? 1 : 0; + $result = $object->createFromClone($user, $object->id, $object->fk_project, $object->fk_task_parent, $clone_change_dt, $clone_affectation, $clone_time, $clone_file, $clone_notes, $clone_prog); + if ($result <= 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } else { + // Load new object + $newobject = new Task($db); + $newobject->fetch($result); + $newobject->fetch_optionals(); + $newobject->fetch_thirdparty(); // Load new object + $object = $newobject; + $action = ''; + } +} + if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->supprimer) { $result = $projectstatic->fetch($object->fk_project); $projectstatic->fetch_thirdparty(); @@ -205,6 +227,7 @@ $help_url = ''; llxHeader('', $title, $help_url); + if ($id > 0 || !empty($ref)) { $res = $object->fetch_optionals(); if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { @@ -259,7 +282,7 @@ if ($id > 0 || !empty($ref)) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || !empty($conf->eventorganization->enabled)) { + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { print ''; @@ -282,8 +305,8 @@ if ($id > 0 || !empty($ref)) { print $form->textwithpicto($langs->trans("BillTime"), $htmltext); print '
'; } - if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + if (isModEnabled('eventorganization')) { + print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } @@ -385,6 +408,22 @@ if ($id > 0 || !empty($ref)) { //$userAccess = $projectstatic->restrictedProjectArea($user); // We allow task affected to user even if a not allowed project //$arrayofuseridoftask=$object->getListContactId('internal'); + if ($action == 'clone') { + $formquestion = array( + 'text' => $langs->trans("ConfirmClone"), + //array('type' => 'checkbox', 'name' => 'clone_contacts', 'label' => $langs->trans("CloneContacts"), 'value' => true), + array('type' => 'checkbox', 'name' => 'clone_change_dt', 'label' => $langs->trans("CloneChanges"), 'value' => true), + array('type' => 'checkbox', 'name' => 'clone_affectation', 'label' => $langs->trans("CloneAffectation"), 'value' => true), + array('type' => 'checkbox', 'name' => 'clone_prog', 'label' => $langs->trans("CloneProgression"), 'value' => true), + array('type' => 'checkbox', 'name' => 'clone_time', 'label' => $langs->trans("CloneTimes"), 'value' => true), + array('type' => 'checkbox', 'name' => 'clone_file', 'label' => $langs->trans("CloneFile"), 'value' => true), + + ); + + print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id, $langs->trans("ToClone"), $langs->trans("ConfirmCloneTask"), "confirm_clone", $formquestion, '', 1, 300, 590); + } + + $head = task_prepare_head($object); if ($action == 'edit' && $user->rights->projet->creer) { @@ -628,6 +667,7 @@ if ($id > 0 || !empty($ref)) { // Modify if ($user->rights->projet->creer) { print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Clone').''; } else { print ''.$langs->trans('Modify').''; } diff --git a/htdocs/asterisk/cidlookup.php b/htdocs/public/clicktodial/cidlookup.php similarity index 71% rename from htdocs/asterisk/cidlookup.php rename to htdocs/public/clicktodial/cidlookup.php index 716057198f8..3ec7024855d 100644 --- a/htdocs/asterisk/cidlookup.php +++ b/htdocs/public/clicktodial/cidlookup.php @@ -16,20 +16,45 @@ */ /** - * \file htdocs/asterisk/cidlookup.php + * \file htdocs/public/clicktodial/cidlookup.php * \brief Script to search companies names based on incoming calls, from caller phone number - * \remarks To use this script, your Asterisk must be compiled with CURL, - * and your dialplan must be something like this: + * \remarks To use this script, your Asterisk must be compiled with CURL, and your dialplan must be something like this: * - * exten => s,1,Set(CALLERID(name)=${CURL(http://IP-DOLIBARR:80/asterisk/cidlookup.php?phone=${CALLERID(num)})}) + * exten => s,1,Set(CALLERID(name)=${CURL(http://IP-DOLIBARR:80/asterisk/cidlookup.php?phone=${CALLERID(num)}&securitykey=SECURITYKEY)}) * * Change IP-DOLIBARR to the IP address of your dolibarr server + * Change SECURITYKEY to the value defined into your setup of module ClickToDial */ +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOLOGIN')) { + define('NOLOGIN', '1'); +} +if (!defined('NOIPCHECK')) { + define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip +} -include '../master.inc.php'; +// So log file will have a suffix +if (!defined('USESUFFIXINLOG')) { + define('USESUFFIXINLOG', '_cidlookup'); +} + +include '../../main.inc.php'; $phone = GETPOST('phone'); +$securitykey = GETPOST('securitykey'); + $notfound = $langs->trans("Unknown"); // Security check @@ -38,12 +63,27 @@ if (empty($conf->clicktodial->enabled)) { exit; } + +/* + * View + */ + +if (empty($securitykey)) { + echo 'Securitykey is required. Check setup of clicktodial module.'; + exit; +} +if ($securitykey != getDolGlobalString('CLICKTODIAL_KEY_FOR_CIDLOOKUP')) { + echo 'Securitykey is wrong.'; + exit; +} + // Check parameters if (empty($phone)) { print "Error: Url must be called with parameter phone=phone to search\n"; exit; } + $sql = "SELECT s.nom as name FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON sp.fk_soc = s.rowid"; $sql .= " WHERE s.entity IN (".getEntity('societe').")"; diff --git a/htdocs/public/cron/cron_run_jobs_by_url.php b/htdocs/public/cron/cron_run_jobs_by_url.php index 8aa910a2d4f..fea2a2d7f82 100644 --- a/htdocs/public/cron/cron_run_jobs_by_url.php +++ b/htdocs/public/cron/cron_run_jobs_by_url.php @@ -93,7 +93,7 @@ if (empty($key)) { echo 'Securitykey is required. Check setup of cron jobs module.'; exit; } -if ($key != $conf->global->CRON_KEY) { +if ($key != getDolGlobalString('CRON_KEY')) { echo 'Securitykey is wrong.'; exit; } diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index 021ed614a5f..b0a8e9e52a0 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -127,7 +127,7 @@ class RecruitmentCandidature extends CommonObject //'fk_recruitment_origin' => array('type'=>'integer:CRecruitmentOrigin:recruitment/class/crecruitmentorigin.class.php', 'label'=>'Origin', 'enabled'=>'1', 'position'=>45, 'visible'=>1, 'index'=>1), 'remuneration_requested' => array('type'=>'integer', 'label'=>'RequestedRemuneration', 'enabled'=>'1', 'position'=>80, 'notnull'=>0, 'visible'=>-1,), 'remuneration_proposed' => array('type'=>'integer', 'label'=>'ProposedRemuneration', 'enabled'=>'1', 'position'=>81, 'notnull'=>0, 'visible'=>-1,), - 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>500, 'notnull'=>0, 'visible'=>3,), + 'description' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>500, 'notnull'=>0, 'visible'=>3, 'cssview'=>'wordbreak'), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'default'=>0, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Received', '3'=>'ContractProposed', '5'=>'ContractSigned', '8'=>'Refused', '9'=>'Canceled')), diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index aa784d8639d..c25d1edb37f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -3035,6 +3035,22 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; } + // Link user (you must create a contact to get a user) + /* + print ''; + */ + // Webservices url/key if (!empty($conf->syncsupplierwebservices->enabled)) { print ''; diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index a09c9751f1f..4ecfc2a8cf4 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -173,7 +173,7 @@ print '
'; if ($action != 'presend') { // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id, 1); } } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index f4637186b4d..a13d8a3de99 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -178,7 +178,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + $statstring .= ""; } $statstring2 = ''; - if (((isModEnabled('societe') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { + if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) { $statstring2 = ""; $statstring2 .= ''; $statstring2 .= ""; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index c0bff452b9c..a63b91b024b 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -682,6 +682,7 @@ $title = $langs->trans("ThirdParty"); if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$langs->trans('PaymentInformation'); } +$help_url = ''; llxHeader('', $title, $help_url); diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index df10c0d4bf9..b1e5174820c 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -128,17 +128,10 @@ $contactstatic = new Contact($db); $userstatic = new User($db); -/* *************************************************************************** */ -/* */ -/* Mode vue et edition */ -/* */ -/* *************************************************************************** */ +// View and edit if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { - $soc = new Societe($db); - $soc->fetch($object->socid); - $head = societe_prepare_head($object); print dol_get_fiche_head($head, 'contact', $langs->trans("ThirdParty"), -1, 'company'); diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index b14ed0e8ca6..00d3c4a0d94 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -115,7 +115,7 @@ class Stripe extends CommonObject $tokenstring = $obj->tokenstring; $tmparray = json_decode($tokenstring); - $key = $tmparray->stripe_user_id; + $key = empty($tmparray->stripe_user_id) ? '' : $tmparray->stripe_user_id; } else { $tokenstring = ''; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ee6d0e7bd14..588dba10a19 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -416,9 +416,10 @@ class User extends CommonObject * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx), 0=do not load personal conf. * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. * @param int $email If defined, email to used for search + * @param int $fk_socpeople If defined, id of contact for search * @return int <0 if KO, 0 not found, >0 if OK */ - public function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity = -1, $email = '') + public function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity = -1, $email = '', $fk_socpeople = 0) { global $conf, $user; @@ -486,6 +487,8 @@ class User extends CommonObject $sql .= " AND u.login = '".$this->db->escape($login)."'"; } elseif ($email) { $sql .= " AND u.email = '".$this->db->escape($email)."'"; + } elseif ($fk_socpeople > 0) { + $sql .= " AND u.fk_socpeople = ".((int) $fk_socpeople); } else { $sql .= " AND u.rowid = ".((int) $id); } @@ -2755,10 +2758,10 @@ class User extends CommonObject if (empty($hidethirdpartylogo)) { $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company } - $company = ' ('.$langs->trans("Company").': '.dol_string_nohtmltag($thirdpartystatic->name).')'; + $company = ' ('.$langs->trans("Company").': '.img_picto('', 'company').' '.dol_string_nohtmltag($thirdpartystatic->name).')'; } - $type = ($this->socid ? $langs->trans("External").$company : $langs->trans("Internal")); - $label .= '
'.$langs->trans("Type").': '.dol_string_nohtmltag($type); + $type = ($this->socid ? $langs->trans("ExternalUser").$company : $langs->trans("InternalUser")); + $label .= '
'.$langs->trans("Type").': '.$type; $label .= ''; if ($infologin > 0) { $label .= '
'; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index b79476e7d5c..33b0465e5f1 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -164,7 +164,7 @@ if ($resql) { $companystatic->canvas = $obj->canvas; $lastcreatedbox .= ''; - $lastcreatedbox .= '"; - $lastcreatedbox .= ''; - $lastcreatedbox .= "'; + $texttoshow = ''; if ($obj->fk_soc) { - $lastcreatedbox .= $companystatic->getNomUrl(1); + $texttoshow .= $companystatic->getNomUrl(1); } else { - $lastcreatedbox .= $langs->trans("InternalUser"); + $texttoshow .= ''.$langs->trans("InternalUser").''; } if ($obj->ldap_sid) { - $lastcreatedbox .= ' ('.$langs->trans("DomainUser").')'; + $texttoshow .= ' ('.$langs->trans("DomainUser").')'; } - $entity = $obj->entity; $entitystring = ''; // TODO Set of entitystring should be done with a hook @@ -194,8 +193,9 @@ if ($resql) { $entitystring = $mc->label; } } - $lastcreatedbox .= ($entitystring ? ' ('.$entitystring.')' : ''); - + $texttoshow .= ($entitystring ? ' ('.$entitystring.')' : ''); + $lastcreatedbox .= ''; $lastcreatedbox .= ''; $lastcreatedbox .= '
'; print $langs->trans("Usage"); print '
'.$langs->trans("DolibarrLogin").''; + if ($object->user_id) { + $dolibarr_user = new User($db); + $result = $dolibarr_user->fetch($object->user_id); + print $dolibarr_user->getLoginUrl(-1); + } else { + //print ''.$langs->trans("NoDolibarrAccess").''; + if (!$object->user_id && $user->rights->user->user->creer) { + print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").''; + } + } + print '
'.$langs->trans("WebServiceURL").''.dol_print_url($object->webservices_url).'
'.$langs->trans("Suppliers").''.round($third['supplier']).'
'; + $lastcreatedbox .= ''; $lastcreatedbox .= $fuserstatic->getNomUrl(-1); if (!empty($conf->multicompany->enabled) && $obj->admin && !$obj->entity) { $lastcreatedbox .= img_picto($langs->trans("SuperAdministrator"), 'redstar'); @@ -172,17 +172,16 @@ if ($resql) { $lastcreatedbox .= img_picto($langs->trans("Administrator"), 'star'); } $lastcreatedbox .= "'.$obj->login.'"; + $lastcreatedbox .= ''.dol_escape_htmltag($obj->login).''; + $lastcreatedbox .= $texttoshow; $lastcreatedbox .= ''.dol_print_date($db->jdate($obj->datec), 'dayhour').''; diff --git a/htdocs/webhook/target_card.php b/htdocs/webhook/target_card.php index dd0d5e171e8..1e1f6522ea1 100644 --- a/htdocs/webhook/target_card.php +++ b/htdocs/webhook/target_card.php @@ -532,7 +532,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Clone - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd); + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd); /* if ($permissiontoadd) {