From b36838f1037dde6b674ee0b5b50600808bbe5937 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Aug 2022 22:11:33 +0200 Subject: [PATCH 1/4] Prepare v16 --- ChangeLog | 2 +- htdocs/core/modules/modEventOrganization.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c93a61a15c5..41f765c8197 100644 --- a/ChangeLog +++ b/ChangeLog @@ -124,7 +124,7 @@ NEW: Added MMK currency (Myanmar Kyat) Modules NEW: Module Partnership Management -NEW: Experimental module Event Organization Management +NEW: Module Event Organization Management For developers or integrators: diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index a7a6c048a4d..c2c9309cd44 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -56,7 +56,7 @@ class modEventOrganization extends DolibarrModules $this->description = "EventOrganizationDescription"; $this->descriptionlong = "EventOrganizationDescriptionLong"; - $this->version = 'experimental'; + $this->version = 'dolibarr'; // Key used in llx_const table to save module status enabled/disabled (where EVENTORGANIZATION is value of property name of module in uppercase) From daf3b928c7ae30d0894b1ae1b5468cdbf0a26cb7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Aug 2022 22:31:01 +0200 Subject: [PATCH 2/4] Debug v16 --- htdocs/admin/eventorganization.php | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index ee6c2ae6b52..bb1f0d87f15 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -228,14 +228,14 @@ if ($action == 'edit') { if ($val['type'] == 'textarea') { print '\n"; } elseif ($val['type']== 'html') { require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; - $doleditor = new DolEditor($constname, $conf->global->{$constname}, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor($constname, getDolGlobalString($constname), '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); } elseif ($val['type'] == 'yesno') { - print $form->selectyesno($constname, $conf->global->{$constname}, 1); + print $form->selectyesno($constname, getDolGlobalString($constname), 1); } elseif (preg_match('/emailtemplate:/', $val['type'])) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); @@ -255,7 +255,7 @@ if ($action == 'edit') { $arrayofmessagename[$modelmail->id] = $langs->trans(preg_replace('/\(|\)/', '', $modelmail->label)) . $moreonlabel; } } - print $form->selectarray($constname, $arrayofmessagename, $conf->global->{$constname}, 'None', 0, 0, '', 0, 0, 0, '', '', 1); + print $form->selectarray($constname, $arrayofmessagename, getDolGlobalString($constname), 'None', 0, 0, '', 0, 0, 0, '', '', 1); } elseif (preg_match('/category:/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -263,13 +263,13 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + print $formother->select_categories($tmp[1], getDolGlobalString($constname), $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); } elseif (preg_match('/thirdparty_type/', $val['type'])) { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; $formcompany = new FormCompany($db); - print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname, 'customerorprospect', 'form', '', 1); + print $formcompany->selectProspectCustomerType(getDolGlobalString($constname), $constname, 'customerorprospect', 'form', '', 1); } elseif ($val['type'] == 'securekey') { - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token'.$constname.'" class="linkobject"'); } @@ -294,7 +294,7 @@ if ($action == 'edit') { $form->select_produits($selected, $constname, '', 0); } } else { - print ''; + print ''; } print ''; } @@ -320,28 +320,28 @@ if ($action == 'edit') { print ''; if ($val['type'] == 'textarea') { - print dol_nl2br($conf->global->{$constname}); + print dol_nl2br(getDolGlobalString($constname)); } elseif ($val['type']== 'html') { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } elseif ($val['type'] == 'yesno') { print ajax_constantonoff($constname); } elseif (preg_match('/emailtemplate:/', $val['type'])) { - if (!empty($conf->global->{$constname})) { + if (getDolGlobalString($constname)) { include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; $formmail = new FormMail($db); $tmp = explode(':', $val['type']); - $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, $conf->global->{$constname}); + $template = $formmail->getEMailTemplate($db, $tmp[1], $user, $langs, getDolGlobalString($constname)); if ($template < 0) { setEventMessages(null, $formmail->errors, 'errors'); } print $langs->trans($template->label); } } elseif (preg_match('/category:/', $val['type'])) { - if (!empty($conf->global->{$constname})) { + if (getDolGlobalString($constname)) { $c = new Categorie($db); - $result = $c->fetch($conf->global->{$constname}); + $result = $c->fetch(getDolGlobalString($constname)); if ($result < 0) { setEventMessages(null, $c->errors, 'errors'); } @@ -353,25 +353,25 @@ if ($action == 'edit') { print '
    ' . implode(' ', $toprint) . '
'; } } elseif (preg_match('/thirdparty_type/', $val['type'])) { - if ($conf->global->{$constname}==2) { + if (getDolGlobalString($constname)==2) { print $langs->trans("Prospect"); - } elseif ($conf->global->{$constname}==3) { + } elseif (getDolGlobalString($constname)==3) { print $langs->trans("ProspectCustomer"); - } elseif ($conf->global->{$constname}==1) { + } elseif (getDolGlobalString($constname)==1) { print $langs->trans("Customer"); - } elseif ($conf->global->{$constname}==0) { + } elseif (getDolGlobalString($constname)==0) { print $langs->trans("NorProspectNorCustomer"); } } elseif ($val['type'] == 'product') { $product = new Product($db); - $resprod = $product->fetch($conf->global->{$constname}); + $resprod = $product->fetch(getDolGlobalString($constname)); if ($resprod > 0) { print $product->getNomUrl(1); } elseif ($resprod < 0) { setEventMessages(null, $object->errors, "errors"); } } else { - print $conf->global->{$constname}; + print getDolGlobalString($constname); } print ''; } From 01484757aa730c3c4a1a6c8b31b95c97b089a003 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Aug 2022 11:31:40 +0200 Subject: [PATCH 3/4] Debug v16 --- htdocs/admin/eventorganization.php | 2 +- htdocs/website/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index bb1f0d87f15..f91f8ef13f1 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -368,7 +368,7 @@ if ($action == 'edit') { if ($resprod > 0) { print $product->getNomUrl(1); } elseif ($resprod < 0) { - setEventMessages(null, $object->errors, "errors"); + setEventMessages($product->error, $product->errors, "errors"); } } else { print getDolGlobalString($constname); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 933f1f73687..4ab8f99029e 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3420,7 +3420,7 @@ if ($action == 'editcss') { $maxfilesizearray = getMaxFileSizeArray(); $maxmin = $maxfilesizearray['maxmin']; if ($maxmin > 0) { - $texte .= ''; // MAX_FILE_SIZE must precede the field type=file + print ''; // MAX_FILE_SIZE must precede the field type=file } print ''; print ''; From 110f7a473681fd5c2967acfe45d6f8d65a37877b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Aug 2022 12:17:49 +0200 Subject: [PATCH 4/4] Debug v16 --- htdocs/adherents/card.php | 4 ++-- htdocs/adherents/class/adherent.class.php | 4 ++-- .../adherents/class/adherent_type.class.php | 1 + htdocs/adherents/type.php | 22 +++++++++++++------ htdocs/adherents/type_translation.php | 9 ++++++-- .../comm/action/class/cactioncomm.class.php | 4 +++- htdocs/contact/consumption.php | 7 ++++-- htdocs/contact/project.php | 6 ++++- htdocs/contact/vcard.php | 3 +-- htdocs/core/class/html.form.class.php | 2 +- 10 files changed, 42 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index aef5789549e..01dad4f08fa 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1543,7 +1543,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Create form popup $formquestion = array(); if ($object->email) { - $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false)); + $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (getDolGlobalString('ADHERENT_DEFAULT_SENDINFOBYMAIL') ? true : false)); } if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) { $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>''); @@ -1574,7 +1574,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $outputlangs->loadLangs(array("main", "members")); // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; + $labeltouse = getDolGlobalString('ADHERENT_EMAIL_TEMPLATE_CANCELATION'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c860a19d588..9a7e6d4466b 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -961,10 +961,10 @@ class Adherent extends CommonObject } /** - * Fonction qui supprime l'adherent et les donnees associees + * Fonction to delete a member and its data * * @param int $rowid Id of member to delete - * @param User $user User object + * @param User $user User object * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, 0=nothing to do, >0 if OK */ diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 3f857ce827b..10c57ea7afe 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -434,6 +434,7 @@ class AdherentType extends CommonObject /** * Function to delete the member's status + * TODO Add param "User $user" * * @return int > 0 if OK, 0 if not found, < 0 if KO */ diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index f336530ff4e..c987878e488 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -41,6 +41,7 @@ $langs->load("members"); $rowid = GETPOST('rowid', 'int'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $sall = GETPOST("sall", "alpha"); @@ -200,7 +201,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) { exit; } -if ($action == 'confirm_delete' && $user->rights->adherent->configurer) { +if ($action == 'confirm_delete' && !empty($user->rights->adherent->configurer)) { $object->fetch($rowid); $res = $object->delete(); @@ -439,7 +440,7 @@ if ($rowid > 0) { print '
'; print '
'; - print ''; + print '
'; // Morphy print ''; @@ -669,20 +670,23 @@ if ($rowid > 0) { print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; - while ($i < $num && $i < $conf->liste_limit) { + $adh = new Adherent($db); + + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { $objp = $db->fetch_object($resql); $datefin = $db->jdate($objp->datefin); - $adh = new Adherent($db); $adh->lastname = $objp->lastname; $adh->firstname = $objp->firstname; $adh->datefin = $datefin; $adh->need_subscription = $objp->subscription; $adh->statut = $objp->status; - // Lastname print ''; + + // Lastname if ($objp->company != '') { print ''."\n"; } else { @@ -690,7 +694,7 @@ if ($rowid > 0) { } // Login - print "\n"; + print "\n"; // Type /*print ''; + } + print "
'.$langs->trans("MembersNature").''.$object->getmorphylib($object->morphy).'
'.img_object($langs->trans("ShowMember"), "user", 'class="paddingright"').$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->company, 12).'".$objp->login."".dol_escape_htmltag($objp->login)."'; @@ -747,11 +751,15 @@ if ($rowid > 0) { $i++; } + if ($i == 0) { + print '
'.$langs->trans("None").'
\n"; print '
'; print ''; - if ($num > $conf->liste_limit) { + if ($num > $limit) { print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); } } else { diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 72976d4e65f..d7d062a1e5f 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; // Load translation files required by the page $langs->loadLangs(array('members', 'languages')); -$id = GETPOST('rowid', 'int'); +$id = GETPOST('rowid', 'int') ? GETPOST('rowid', 'int') : GETPOST('id', 'int'); $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); $ref = GETPOST('ref', 'alphanohtml'); @@ -61,7 +61,12 @@ if ($cancel == $langs->trans("Cancel")) { if ($action == 'delete' && GETPOST('langtodelete', 'alpha')) { $object = new AdherentType($db); $object->fetch($id); - $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); + $result = $object->delMultiLangs(GETPOST('langtodelete', 'alpha'), $user); + if ($result > 0) { + setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); + header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); + exit; + } } // Add translation diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index db62dfe6a9f..75cbefec3ec 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -216,7 +216,9 @@ class CActionComm if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) { $qualified = 1; } - if (preg_split("/@/", $obj->module, -1)[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) { + // For case module = 'myobject@eventorganization' + $tmparray = preg_split("/@/", $obj->module, -1); + if (count($tmparray) > 1 && $tmparray[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) { $qualified = 1; } // For the generic case with type = 'module...' and module = 'myobject@mymodule' diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 0ba88228666..f19c3e03684 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -33,6 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $id = GETPOST('id', 'int'); @@ -46,7 +47,7 @@ if (empty($object->thirdparty)) { $socid = $object->thirdparty->id; // Sort & Order fields -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -230,7 +231,7 @@ if ($type_element == 'fichinter') { // Customer : show products from invoices $tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid AND ec.fk_socpeople = '.((int) $object->id); $tables_from .= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)"; $where = ' WHERE c.entity IN ('.getEntity('propal').')'; - $datePrint = 'c.datep'; + $dateprint = 'c.datep'; $doc_number = 'c.ref'; $thirdTypeSelect = 'customer'; } elseif ($type_element == 'order') { @@ -443,6 +444,8 @@ if ($sql_select) { $i = 0; + $total_qty = 0; + $total_ht = 0; while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit)) { $documentstatic->id = $objp->doc_id; $documentstatic->ref = $objp->doc_number; diff --git a/htdocs/contact/project.php b/htdocs/contact/project.php index b05709f019a..e88c056af37 100644 --- a/htdocs/contact/project.php +++ b/htdocs/contact/project.php @@ -76,7 +76,11 @@ if ($id) { $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
'; + $morehtmlref = ''; + $morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"'); + $morehtmlref .= ''; + + $morehtmlref .= '
'; if (empty($conf->global->SOCIETE_DISABLE_CONTACTS) && !empty($socid)) { $object->thirdparty->fetch($socid); // Thirdparty diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 1fba506e910..256039fa96f 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -44,7 +44,6 @@ if ($result <= 0) { exit; } -$physicalperson = 1; $company = new Societe($db); if ($contact->socid) { @@ -107,7 +106,7 @@ if ($company->id) { } // Si contact lie a un tiers non de type "particulier" - if ($contact->typent_code != 'TE_PRIVATE') { + if ($company->typent_code != 'TE_PRIVATE') { $v->setOrg($company->name); } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 50858391da3..7c34411306b 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5026,7 +5026,7 @@ class Form $more .= '
 
'; } $more .= '