Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/eventorganization/conferenceorboothattendee_card.php
	htdocs/mrp/mo_list.php
This commit is contained in:
Laurent Destailleur 2021-10-06 18:30:26 +02:00
commit 96b617cb4d
17 changed files with 43 additions and 29 deletions

View File

@ -504,7 +504,7 @@ class Documents extends DolibarrApi
* Test sample for medias file: { "filename": "mynewfile.txt", "modulepart": "medias", "ref": "", "subdir": "image/mywebsite", "filecontent": "Y29udGVudCB0ZXh0Cg==", "fileencoding": "base64", "overwriteifexists": "0" }.
*
* @param string $filename Name of file to create ('FA1705-0123.txt')
* @param string $modulepart Name of module or area concerned by file upload ('facture', 'project', 'project_task', ...)
* @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...)
* @param string $ref Reference of object (This will define subdir automatically and store submited file into it)
* @param string $subdir Subdirectory (Only if ref not provided)
* @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided)

View File

@ -54,7 +54,9 @@ function bomAdminPrepareHead()
//$this->tabs = array(
// 'entity:-tabname:Title:@bom:/bom/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom');
complete_head_from_modules($conf, $langs, null, $head, $h, 'bom@mrp');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'bom@mrp', 'remove');
return $head;
}

View File

@ -129,7 +129,6 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!$error) {
$result = $object->create($user);
var_dump($object);exit;
if ($result > 0) {
// Creation OK
if ($conf->categorie->enabled && method_exists($object, 'setCategories')) {
@ -298,6 +297,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) {
}
$result = $object->delete($user);
if ($result > 0) {
// Delete OK
setEventMessages("RecordDeleted", null, 'mesgs');

View File

@ -5324,7 +5324,7 @@ abstract class CommonObject
$ecmfile->gen_or_uploaded = 'generated';
$ecmfile->description = ''; // indexed content
$ecmfile->keywords = ''; // keyword content
$ecmfile->src_object_type = $this->table_element.(empty($this->module) ? '' : '@'.$this->module);
$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
$ecmfile->src_object_id = $this->id;
$result = $ecmfile->create($user);

View File

@ -1578,7 +1578,7 @@ class FormFile
*
* @param string $upload_dir Directory that was scanned. This directory will contains files into subdirs REF/files
* @param array $filearray Array of files loaded by dol_dir_list function before calling this function
* @param string $modulepart Value for modulepart used by download wrapper
* @param string $modulepart Value for modulepart used by download wrapper. Value can be $object->table_name (that is 'myobject' or 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
* @param string $param Parameters on sort links
* @param int $forcedownload Force to open dialog box "Save As" when clicking on file
* @param string $relativepath Relative path of docs (autodefined if not provided)
@ -1742,7 +1742,8 @@ class FormFile
$id = 0;
$ref = '';
// To show ref or specific information according to view to show (defined by $module)
// To show ref or specific information according to view to show (defined by $modulepart)
// $modulepart can be $object->table_name (that is 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
$reg = array();
if ($modulepart == 'company' || $modulepart == 'tax') {
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
@ -1848,10 +1849,9 @@ class FormFile
// File
// Check if document source has external module part, if it the case use it for module part on document.php
preg_match('/^[^@]*@([^@]*)$/', $modulepart.'@expertisemedical', $modulesuffix);
print '<td>';
//print "XX".$file['name']; //$file['name'] must be utf8
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.(empty($modulesuffix) ? $modulepart : $modulesuffix[1]);
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.urlencode($modulepart);
if ($forcedownload) {
print '&attachment=1';
}
@ -1862,7 +1862,7 @@ class FormFile
//print $this->getDocumentsLink($modulepart, $modulesubdir, $filedir, '^'.preg_quote($file['name'],'/').'$');
print $this->showPreview($file, (empty($modulesuffix) ? $modulepart : $modulesuffix[1]), $file['relativename']);
print $this->showPreview($file, $modulepart, $file['relativename']);
print "</td>\n";

View File

@ -271,7 +271,6 @@ class ConferenceOrBooth extends ActionComm
*/
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
{
//TODO set percent according status
global $conf;

View File

@ -105,9 +105,9 @@ class ConferenceOrBoothAttendee extends CommonObject
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'comment'=>"Reference of object"),
'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>55, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1,),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status = 1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>40, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'),
'date_subscription' => array('type'=>'datetime', 'label'=>'DateOfRegistration', 'enabled'=>'1', 'position'=>56, 'notnull'=>1, 'visible'=>1, 'showoncombobox'=>'1',),
'fk_invoice' => array('type'=>'integer:Facture:compta/facture/class/facture.class.php', 'label'=>'Invoice', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>-1, 'index'=>0, 'picto'=>'bill', 'css'=>'tdoverflowmax150 maxwidth500'),
'amount' => array('type'=>'price', 'label'=>'AmountPaid', 'enabled'=>'1', 'position'=>57, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"AmountOfSubscriptionPaid",),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>3,),

View File

@ -57,9 +57,10 @@ $projectstatic = new Project($db);
$diroutputmassaction = $conf->eventorganization->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('conferenceorboothattendeecard', 'globalcard')); // Note that conf->hooks_modules contains array
if ($conf_or_booth_id > 0) {
$confOrBooth = new ConferenceOrBooth($db);
$result = $confOrBooth->fetch($conf_or_booth_id);
$result = $confOrBooth->fetch($id > 0 ? $id : $conf_or_booth_id);
if ($result < 0) {
setEventMessages(null, $confOrBooth->errors, 'errors');
} else {
@ -102,6 +103,10 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// Now we have loaded the attendee, we can force the project (in case value provided as parameter is wrong or value not provided)
if ($object->fk_project > 0) {
$fk_project = $object->fk_project;
}
$permissiontoread = $user->rights->eventorganization->read;
$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@ -125,7 +130,7 @@ if (empty($reshook)) {
$error = 0;
if (!empty($withproject)) {
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1';
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php?withproject=1&fk_project='.((int) $fk_project);
} else {
$backurlforlist = DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_list.php';
}
@ -151,7 +156,6 @@ if (empty($reshook)) {
$action = '';
}
$triggermodname = 'EVENTORGANIZATION_CONFERENCEORBOOTHATTENDEE_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
@ -653,14 +657,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (empty($user->socid)) {
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken().'', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').'&action=edit&token='.newToken(), '', $permissiontoadd);
// Clone
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().'&object=scrumsprint', '', $permissiontoadd);
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontoadd);
// Delete (need delete permission, or if draft, just need create/modify permission)
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().'', '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken().(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:''), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
}
print '</div>'."\n";
}

View File

@ -699,7 +699,8 @@ print '<input type="hidden" name="withproject" value="'.$withproject.'">';
print '<input type="hidden" name="fk_project" value="'.$fk_project.'">';
print '<input type="hidden" name="page_y" value="">';
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd);
$params = array('morecss'=>'reposition');
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/eventorganization/conferenceorboothattendee_card.php?action=create'.(!empty($confOrBooth->id)?'&conforboothid='.$confOrBooth->id:'').(!empty($projectstatic->id)?'&fk_project='.$projectstatic->id:'').$withProjectUrl.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.(empty($confOrBooth->id) ? '' : '&conforboothid='.$confOrBooth->id).$withProjectUrl), '', $permissiontoadd, $params);
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, $object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);

View File

@ -136,6 +136,7 @@ OrganizationEventPaymentOfBoothWasReceived=Your payment for your booth has been
OrganizationEventPaymentOfRegistrationWasReceived=Your payment for your event registration has been recorded
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)
#
# Vote page
@ -153,7 +154,7 @@ ConfAttendeeSubscriptionConfirmation = Confirmation of your subscription to an e
Attendee = Attendee
PaymentConferenceAttendee = Conference attendee payment
PaymentBoothLocation = Booth location payment
DeleteConferenceOrBoothAttendee=Remove attendee
RegistrationAndPaymentWereAlreadyRecorder=A registration and a payment were already recorded for the email <b>%s</b>
EmailAttendee=Attendee email
EmailCompanyForInvoice=Company email (for invoice, if different of attendee email)

View File

@ -1157,3 +1157,4 @@ RecordsApproved=%s Record(s) approved
Properties=Properties
hasBeenValidated=%s has been validated
ClientTZ=Client Time Zone (user)
NotClosedYet=Not yet closed

View File

@ -60,7 +60,9 @@ function mymoduleAdminPrepareHead()
//$this->tabs = array(
// 'entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
//); // to remove a tab
complete_head_from_modules($conf, $langs, null, $head, $h, 'mymodule');
complete_head_from_modules($conf, $langs, null, $head, $h, 'mymodule@mymodule');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'mymodule@mymodule', 'remove');
return $head;
}

View File

@ -106,5 +106,7 @@ function moPrepareHead($object)
complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp', 'remove');
complete_head_from_modules($conf, $langs, $object, $head, $h, 'mo@mrp', 'remove');
return $head;
}

View File

@ -207,7 +207,7 @@ $sql .= $object->getFieldList('t');
// Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : '');
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.' ' : '');
}
}
// Add fields from hooks

View File

@ -926,8 +926,8 @@ if ($action == 'create' && $user->rights->projet->creer) {
print '<td>';
print $formproject->selectOpportunityStatus('opp_status', $object->opp_status, 1, 0, 0, 0, 'inline-block valignmiddle', 0, 1);
print '<div id="divtocloseproject" class="inline-block valign" style="display: none;"> &nbsp; &nbsp; ';
print '<input type="checkbox" id="inputcloseproject" name="closeproject" /> ';
print $langs->trans("AlsoCloseAProject");
print '<input type="checkbox" id="inputcloseproject" name="closeproject" />';
print '<label for="inputcloseproject">'.$langs->trans("AlsoCloseAProject").'</label>';
print '</div>';
print '</td>';
print '</tr>';
@ -948,11 +948,11 @@ if ($action == 'create' && $user->rights->projet->creer) {
// Date start
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
print $form->selectDate($object->date_start ? $object->date_start : -1, 'projectstart', 0, 0, 0, '', 1, 0);
print ' &nbsp; &nbsp; <input type="checkbox" class="valignmiddle" name="reportdate" value="yes" ';
print ' &nbsp; &nbsp; <input type="checkbox" class="valignmiddle" id="reportdate" name="reportdate" value="yes" ';
if ($comefromclone) {
print ' checked ';
}
print '/> '.$langs->trans("ProjectReportDate");
print '/><label for="reportdate">'.$langs->trans("ProjectReportDate").'</label>';
print '</td></tr>';
// Date end

View File

@ -83,6 +83,9 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$code = dol_getIdFromCode($db, $status, 'c_lead_status', 'rowid', 'code');
if ($code) {
$labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code);
if ($code == 'WON' || $code == 'LOST') {
$labelStatus = $langs->transnoentitiesnoconv("OppStatus".$code).' ('.$langs->transnoentitiesnoconv("NotClosedYet").")";
}
}
if (empty($labelStatus)) {
$labelStatus = $listofopplabel[$status];

View File

@ -152,7 +152,7 @@ if ($resql) {
while ($i < $num) {
$objp = $db->fetch_object($resql);
$listofoppstatus[$objp->rowid] = $objp->percent;
$listofopplabel[$objp->rowid] = $objp->label;
$listofopplabel[$objp->rowid] = $objp->label; // default label if translation from "OppStatus".code not found.
$listofoppcode[$objp->rowid] = $objp->code;
switch ($objp->code) {
case 'PROSP':