Merge pull request #21600 from ymollard/eventorg-fixes

FIX: EventOrganization Missing databases entries and labels
This commit is contained in:
Laurent Destailleur 2022-07-29 15:40:21 +02:00 committed by GitHub
commit ab2afd772b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 30 additions and 11 deletions

View File

@ -332,6 +332,7 @@ class Categorie extends CommonObject
// Check parameters
if (empty($id) && empty($label) && empty($ref_ext)) {
$this->error = "No category to search for";
return -1;
}
if (!is_null($type) && !is_numeric($type)) {
@ -389,6 +390,7 @@ class Categorie extends CommonObject
return 1;
} else {
$this->error = "No category found";
return 0;
}
} else {

View File

@ -216,6 +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)) {
$qualified = 1;
}
// For the generic case with type = 'module...' and module = 'myobject@mymodule'
$regs = array();
if (preg_match('/^module/', $obj->type)) {

View File

@ -8329,8 +8329,8 @@ abstract class CommonObject
/**
* Get buy price to use for margin calculation. This function is called when buy price is unknown.
* Set buy price = sell price if ForceBuyingPriceIfNull configured,
* else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
* else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
* elseif calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice
* elseif calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice
* else set min buy price as buy price
*
* @param float $unitPrice Product unit price
@ -8684,7 +8684,7 @@ abstract class CommonObject
public function isInt($info)
{
if (is_array($info)) {
if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) {
if (isset($info['type']) && (preg_match('/(^int|int$)/i', $info['type']))) {
return true;
} else {
return false;
@ -8943,6 +8943,8 @@ abstract class CommonObject
return 'NULL';
} elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) {
return price2num("$value");
} elseif (preg_match('/int$/i', $fieldsentry['type'])) {
return (int) $value;
} elseif ($fieldsentry['type'] == 'boolean') {
if ($value) {
return 'true';

View File

@ -24,6 +24,7 @@
* \brief Description and activation file for the EventOrganization
*/
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
/**
* Description and activation class for module EventOrganization
@ -367,7 +368,9 @@ class modEventOrganization extends DolibarrModules
}
}
return $this->_init($sql, $options);
$init = $this->_init($sql, $options);
return $init;
}
/**

View File

@ -105,8 +105,8 @@ class ConferenceOrBooth extends ActionComm
public $fields = array(
'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"Help text", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width300'),

View File

@ -60,6 +60,8 @@ ConferenceOrBoothTab = Conference Or Booth
AmountPaid = Amount paid
DateOfRegistration = Date of registration
ConferenceOrBoothAttendee = Conference Or Booth Attendee
ApplicantOrVisitor=Applicant or visitor
Speaker=Speaker
#
# Template Mail
@ -139,6 +141,7 @@ OrganizationEventPaymentOfRegistrationWasReceived=Your payment for your event re
OrganizationEventBulkMailToAttendees=This is a remind about your participation in the event as an attendee
OrganizationEventBulkMailToSpeakers=This is a reminder on your participation in the event as a speaker
OrganizationEventLinkToThirdParty=Link to third party (customer, supplier or partner)
OrganizationEvenLabelName=Public name of the conference or booth
NewSuggestionOfBooth=Application for a booth
NewSuggestionOfConference=Application for a conference

View File

@ -118,7 +118,7 @@ class MyObject extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1),
'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1),
'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),

View File

@ -60,6 +60,7 @@ global $dolibarr_main_url_root;
// Init vars
$errmsg = '';
$errors = array();
$error = 0;
$backtopage = GETPOST('backtopage', 'alpha');
$action = GETPOST('action', 'aZ09');
@ -90,6 +91,7 @@ if ($type == 'conf') {
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
$errors = array_merge($errors, $project->errors);
}
}
@ -99,6 +101,7 @@ if ($type == 'global') {
if ($resultproject < 0) {
$error++;
$errmsg .= $project->error;
$errors = array_merge($errors, $project->errors);
} else {
$sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet";
$sql .= " WHERE ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee = ".((int) $project->id);
@ -279,6 +282,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($resultconfattendee < 0) {
$error++;
$errmsg .= $confattendee->error;
$errors = array_merge($errors, $confattendee->errors);
}
}
@ -403,6 +407,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
// If an error was found
$error++;
$errmsg .= $thirdparty->error;
$errors = array_merge($errors, $thirdparty->errors);
} elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected
// Creation of a new thirdparty
if (!empty($societe)) {
@ -441,6 +446,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($readythirdparty < 0) {
$error++;
$errmsg .= $thirdparty->error;
$errors = array_merge($errors, $thirdparty->errors);
} else {
$thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs);
$thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs);
@ -472,6 +478,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen
if ($resultprod < 0) {
$error++;
$errmsg .= $productforinvoicerow->error;
$errors = array_merge($errors, $productforinvoicerow->errors);
} else {
$facture = new Facture($db);
if (empty($confattendee->fk_invoice)) {
@ -668,7 +675,7 @@ if ($maxattendees && $currentnbofattendees >= $maxattendees) {
print '<br>';
dol_htmloutput_errors($errmsg);
dol_htmloutput_errors($errmsg, $errors);
if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS_CONFIRMED) || (!empty($project->id) && $project->status == Project::STATUS_VALIDATED)) {
if (empty($maxattendees) || $currentnbofattendees < $maxattendees) {

View File

@ -463,8 +463,7 @@ print '<div align="center">';
print '<div id="divsubscribe">';
print '<div class="center subscriptionformhelptext justify">';
dol_htmloutput_errors($errmsg);
dol_htmloutput_errors($errmsg, $errors);
// Print form
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";

View File

@ -265,7 +265,7 @@ class Ticket extends CommonObject
'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'),
'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100 tdoverflowmax200'),
'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'),
'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"),
//'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ?