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

Conflicts:
	htdocs/modulebuilder/template/myobject_list.php
This commit is contained in:
Laurent Destailleur 2022-03-11 17:04:23 +01:00
commit 06804c3547
21 changed files with 302 additions and 186 deletions

View File

@ -1719,8 +1719,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
print '</td></tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
@ -1737,9 +1735,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($user->admin) {
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
}
print '<span class="opacitymedium"'.$langs->trans("Hidden").'</span>';
print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore)
$langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
@ -1778,7 +1776,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield tableforfield centpercent">';
print '<table class="border tableforfield centpercent">';
// Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
@ -1853,18 +1851,6 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
print '</td></tr>';
// VCard
/*
print '<tr><td>';
print $langs->trans("VCard").'</td><td colspan="3">';
print '<a href="'.DOL_URL_ROOT.'/adherents/vcard.php?id='.$object->id.'">';
print img_picto($langs->trans("Download").' vcard', 'vcard.png', 'class="paddingrightonly"');
print $langs->trans("Download");
print img_picto($langs->trans("Download").' vcard', 'download', 'class="paddingleft"');
print '</a>';
print '</td></tr>';
*/
print "</table>\n";
print "</div></div>\n";

View File

@ -501,7 +501,7 @@ if ($rowid > 0) {
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.dol_escape_htmltag($object->login).'</td></tr>';
}
// Type
@ -512,25 +512,24 @@ if ($rowid > 0) {
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->company.'</td></tr>';
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.dol_escape_htmltag($object->company).'</td></tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'</td>';
print '</tr>';
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $object->pass);
print '<tr><td>'.$langs->trans("Password").'</td><td>';
if ($object->pass) {
print preg_replace('/./i', '*', $object->pass);
} else {
if ($user->admin) {
print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted;
} else {
print $langs->trans("Hidden");
print '<!-- '.$langs->trans("Crypted").': '.$object->pass_indatabase_crypted.' -->';
}
print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
}
if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) {
if (!empty($object->pass_indatabase) && empty($object->user_id)) { // Show warning only for old password still in clear (does not happen anymore)
$langs->load("errors");
$htmltext = $langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext, 1, 'warning');
@ -546,15 +545,17 @@ if ($rowid > 0) {
print " ".img_warning($langs->trans("Late"));
}
} else {
if (!$adht->subscription) {
if ($object->need_subscription == 0) {
print $langs->trans("SubscriptionNotNeeded");
} elseif (!$adht->subscription) {
print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
if (Adherent::STATUS_VALIDATED == $object->statut) {
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
}
} else {
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) {
print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled
if (Adherent::STATUS_VALIDATED == $object->statut) {
print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft, not excluded and not resiliated
}
}
}
@ -563,18 +564,13 @@ if ($rowid > 0) {
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="fichehalfright">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Birthday
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Categories
// Tags / Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
@ -582,6 +578,12 @@ if ($rowid > 0) {
print '</td></tr>';
}
// Birth Date
print '<tr><td class="titlefield">'.$langs->trans("DateOfBirth").'</td><td class="valeur">'.dol_print_date($object->birth, 'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
@ -663,8 +665,6 @@ if ($rowid > 0) {
print dol_get_fiche_end();
print '</form>';
/*
* Action bar

View File

@ -50,7 +50,7 @@ $substitutionarrayfortest = array(
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__LOGIN__' => 'RecipientLogin',
'__LOGIN__' => $user->login,
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
'__ADDRESS__'=> 'RecipientAddress',
@ -662,7 +662,7 @@ if ($action == 'edit') {
print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_EMAIL_DKIM_ENABLED").'</td><td>';
if (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('swiftmailer'))) {
if (function_exists('openssl_open')) {
print yn($conf->global->MAIN_MAIL_EMAIL_DKIM_ENABLED);
print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_DKIM_ENABLED'));
} else {
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
@ -887,7 +887,6 @@ if ($action == 'edit') {
}
setEventMessages($errormsg, null, 'errors');
print $errormsg;
}
print '<br>';
}

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$cancel = GETPOST('cancel', 'aZ09');
if (!$user->admin) {
accessforbidden();
@ -40,17 +40,22 @@ if (!$user->admin) {
$usersignature = $user->signature;
// For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
if ($action == 'test' || $action == 'send') {
$usersignature = dol_string_nohtmltag($usersignature);
$usersignature = dol_string_nohtmltag($usersignature, 2);
}
$substitutionarrayfortest = array(
'__LOGIN__' => $user->login,
'__ID__' => 'TESTIdRecord',
'__EMAIL__' => 'TESTEMail',
'__LASTNAME__' => 'TESTLastname',
'__FIRSTNAME__' => 'TESTFirstname',
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''),
//'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet
'__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
'__ID__' => 'RecipientIdRecord',
//'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
'__CHECK_READ__' => (!empty($object) && is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '',
'__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
'__LOGIN__' => $user->login,
'__LASTNAME__' => 'RecipientLastname',
'__FIRSTNAME__' => 'RecipientFirstname',
'__ADDRESS__'=> 'RecipientAddress',
'__ZIP__'=> 'RecipientZip',
'__TOWN_'=> 'RecipientTown',
'__COUNTRY__'=> 'RecipientCountry'
);
complete_substitutions_array($substitutionarrayfortest, $langs);
@ -86,10 +91,10 @@ $trackid = (($action == 'testhtml') ? "testhtml" : "test");
$sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
if ($action == 'presend' && GETPOST('trackid') == 'test') {
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
$action = 'test';
}
if ($action == 'presend' && GETPOST('trackid') == 'testhtml') {
if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
$action = 'testhtml';
}
@ -271,12 +276,15 @@ if ($action == 'edit') {
// Host server
print '<tr class="oddeven hideifdefault"><td>';
print '<tr class="oddeven hideifdefault">';
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
print '<td>';
print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup");
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print '</td>';
} else {
print '<td>';
$mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
$smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
if ($linuxlike) {
@ -287,17 +295,19 @@ if ($action == 'edit') {
print '</td><td>';
// SuperAdministrator access only
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="'.$mainserver.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="'.$mainserver.'">';
print '<span id="smtp_server_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print ' <span class="opacitymedium smtp_method">'.$langs->trans("SeeLinkToOnlineDocumentation").'</span>';
} else {
$text = !empty($mainserver) ? $mainserver : $smtpserver;
$htmltext = $langs->trans("ContactSuperAdminForChange");
print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="'.$mainserver.'">';
}
print '</td>';
}
print '</td></tr>';
print '</tr>';
// Port
@ -305,7 +315,7 @@ if ($action == 'edit') {
if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
print '</td><td>';
print $langs->trans("SeeLocalSendMailSetup");
print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} else {
$mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
$smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
@ -319,7 +329,7 @@ if ($action == 'edit') {
if (empty($conf->multicompany->enabled) || ($user->admin && !$user->entity)) {
print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="'.$mainport.'">';
print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="'.$mainport.'">';
print '<span id="smtp_port_mess">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
} else {
$text = (!empty($mainport) ? $mainport : $smtpport);
$htmltext = $langs->trans("ContactSuperAdminForChange");
@ -360,7 +370,6 @@ if ($action == 'edit') {
}
// TLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
if (function_exists('openssl_open')) {
@ -374,7 +383,6 @@ if ($action == 'edit') {
print '</td></tr>';
// STARTTLS
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
if (function_exists('openssl_open')) {
@ -388,7 +396,6 @@ if ($action == 'edit') {
print '</td></tr>';
// SMTP_ALLOW_SELF_SIGNED_EMAILING
print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
if (function_exists('openssl_open')) {
@ -414,6 +421,7 @@ if ($action == 'edit') {
print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
print "<br><br>\n";
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
@ -460,7 +468,7 @@ if ($action == 'edit') {
print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
}
} else {
print yn(0).' ('.$langs->trans("NotSupported").')';
print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
}
print '</td></tr>';
@ -492,6 +500,7 @@ if ($action == 'edit') {
}
print '</table>';
print '</div>';
print dol_get_fiche_end();
@ -543,6 +552,7 @@ if ($action == 'edit') {
// Run the test to connect
if ($action == 'testconnect') {
print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
print load_fiche_titre($langs->trans("DoTestServerAvailability"));
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
@ -573,16 +583,18 @@ if ($action == 'edit') {
// Cree l'objet formulaire mail
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
$formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
$formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
$formmail->fromid = $user->id;
$formmail->fromalsorobot = 1;
$formmail->withfromreadonly = 0;
$formmail->withsubstit = 0;
$formmail->withfrom = 1;
$formmail->witherrorsto = 1;
$formmail->withto = (!GETPOST('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
$formmail->withtocc = (!GETPOST(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
$formmail->withtoccc = (!GETPOST(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
$formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
$formmail->withtocc = (GETPOSTISSET(['sendtocc']) ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
$formmail->withtoccc = (GETPOSTISSET(['sendtoccc']) ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
$formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
$formmail->withtopicreadonly = 0;
$formmail->withfile = 2;
@ -601,7 +613,7 @@ if ($action == 'edit') {
$formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
// Init list of files
if (GETPOST("mode") == 'init') {
if (GETPOST("mode", "aZ09") == 'init') {
$formmail->clear_attached_files();
}

View File

@ -848,8 +848,13 @@ class Utils
$resarray = $utils->executeCLI($command, $outfile);
if ($resarray['result'] != '0') {
$this->error = $resarray['error'].' '.$resarray['output'];
$this->errors[] = $this->error;
}
$result = ($resarray['result'] == 0) ? 1 : 0;
if ($result < 0 && empty($this->errors)) {
$this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOC);
$this->errors[] = $this->error;
}
// Build PDF doc
$command = $conf->global->MODULEBUILDER_ASCIIDOCTORPDF.' '.$destfile.' -n -o '.$dirofmoduledoc.'/'.$FILENAMEDOCPDF;
@ -857,8 +862,13 @@ class Utils
$resarray = $utils->executeCLI($command, $outfile);
if ($resarray['result'] != '0') {
$this->error = $resarray['error'].' '.$resarray['output'];
$this->errors[] = $this->error;
}
$result = ($resarray['result'] == 0) ? 1 : 0;
if ($result < 0 && empty($this->errors)) {
$this->error = $langs->trans("ErrorFailToGenerateFile", $FILENAMEDOCPDF);
$this->errors[] = $this->error;
}
chdir($currentdir);
} else {
@ -869,8 +879,6 @@ class Utils
return 1;
} else {
$error++;
$langs->load("errors");
$this->error = $langs->trans("ErrorFailToGenerateFile", $outputfiledoc);
}
} else {
$error++;

View File

@ -18,17 +18,7 @@
/**
* \file core/triggers/interface_99_modZapier_ZapierTriggers.class.php
* \ingroup zapier
* \brief Example trigger.
*
*
* \remarks You can create other triggers by copying this one.
* - File name should be either:
* - interface_99_modZapier_MyTrigger.class.php
* - interface_99_all_MyTrigger.class.php
* - The file must stay in core/triggers
* - The class name must be InterfaceMytrigger
* - The constructor method must be named InterfaceMytrigger
* - The name property name must be MyTrigger
* \brief File for Zappier Triggers.
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';

View File

@ -94,7 +94,7 @@ LanguageDefDesc=Enter in this files, all the key and the translation for each la
MenusDefDesc=Define here the menus provided by your module
DictionariesDefDesc=Define here the dictionaries provided by your module
PermissionsDefDesc=Define here the new permissions provided by your module
MenusDefDescTooltip=The menus provided by your module/application are defined into the array <strong>$this->menus</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), menus are also visible into the menu editor available to administrator users on %s.
MenusDefDescTooltip=The menus provided by your module/application are defined into the array <strong>$this->menus</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and the module re-activated), the menus are also visible into the menu editor available to administrator users on %s.
DictionariesDefDescTooltip=The dictionaries provided by your module/application are defined into the array <strong>$this->dictionaries</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), dictionaries are also visible into the setup area to administrator users on %s.
PermissionsDefDescTooltip=The permissions provided by your module/application are defined into the array <strong>$this->rights</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.<br><br>Note: Once defined (and module re-activated), permissions are visible into the default permissions setup %s.
HooksDefDesc=Define in the <b>module_parts['hooks']</b> property, in the module descriptor, the context of hooks you want to manage (list of contexts can be found by a search on '<b>initHooks(</b>' in core code).<br>Edit the hook file to add code of your hooked functions (hookable functions can be found by a search on '<b>executeHooks</b>' in core code).
@ -110,7 +110,7 @@ DropTableIfEmpty=(Destroy table if empty)
TableDoesNotExists=The table %s does not exists
TableDropped=Table %s deleted
InitStructureFromExistingTable=Build the structure array string of an existing table
UseAboutPage=Disable the about page
UseAboutPage=Do not generate the About page
UseDocFolder=Disable the documentation folder
UseSpecificReadme=Use a specific ReadMe
ContentOfREADMECustomized=Note: The content of the README.md file has been replaced with the specific value defined into setup of ModuleBuilder.
@ -138,10 +138,12 @@ CSSViewClass=CSS for read form
CSSListClass=CSS for list
NotEditable=Not editable
ForeignKey=Foreign key
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]] ('1' means we add a + button after the combo to create the record, 'filter' can be 'status=1 AND fk_user = __USER_ID AND entity IN (__SHARED_ENTITIES__)' for example)
TypeOfFieldsHelp=Type of fields:<br>varchar(99), double(24,8), real, text, html, datetime, timestamp, integer, integer:ClassName:relativepath/to/classfile.class.php[:1[:filter]]<br>'1' means we add a + button after the combo to create the record<br>'filter' is a sql condition, example: 'status=1 AND fk_user=__USER_ID__ AND entity IN (__SHARED_ENTITIES__)'
AsciiToHtmlConverter=Ascii to HTML converter
AsciiToPdfConverter=Ascii to PDF converter
TableNotEmptyDropCanceled=Table not empty. Drop has been canceled.
ModuleBuilderNotAllowed=The module builder is available but not allowed to your user.
ImportExportProfiles=Import and export profiles
ValidateModBuilderDesc=Put 1 if this field need to be validated with $this->validateField() or 0 if validation required
WarningDatabaseIsNotUpdated=Warning: The database is not updated automatically, you must destroy tables and disable-enable the module to have tables recreated
LinkToParentMenu=Parent menu (fk_xxxxmenu)

View File

@ -120,7 +120,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseAboutPage").'</td>';
print '<td class="center">';
print '<td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MODULEBUILDER_USE_ABOUT');
} else {

View File

@ -955,6 +955,21 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($fieldname == 'entity') {
$index = 1;
}
// css
$css = '';
$cssview = '';
$csslist = '';
if (preg_match('/^fk_/', $fieldname)) {
$css = 'maxwidth500 widthcentpercentminusxx';
}
if ($fieldname == 'label') {
$css = 'minwidth300';
$cssview = 'wordbreak';
}
if (in_array($fieldname, array('note_public', 'note_private'))) {
$cssview = 'wordbreak';
}
$string .= "'".$obj->Field."' =>array('type'=>'".$type."', 'label'=>'".$label."',";
if ($default != '') {
@ -972,6 +987,15 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($index) {
$string .= ", 'index'=>".$index;
}
if ($css) {
$string .= ", 'css'=>".$css;
}
if ($cssview) {
$string .= ", 'cssview'=>".$cssview;
}
if ($csslist) {
$string .= ", 'csslist'=>".$csslist;
}
$string .= "),\n";
$string .= "<br>";
$i += 5;
@ -1307,33 +1331,33 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
}
}
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'aZ09'),
'cssview'=>GETPOST('propcssview', 'aZ09'),
'csslist'=>GETPOST('propcsslist', 'aZ09'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
);
if (!$error) {
$addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),
'label'=>GETPOST('proplabel', 'alpha'),
'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),
'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),
'notnull'=>GETPOST('propnotnull', 'int'),
'index'=>GETPOST('propindex', 'int'),
'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'),
'comment'=>GETPOST('propcomment', 'alpha'),
'help'=>GETPOST('prophelp', 'alpha'),
'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example
'cssview'=>GETPOST('propcssview', 'alpha'),
'csslist'=>GETPOST('propcsslist', 'alpha'),
'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'validate' => GETPOST('propvalidate', 'int')
);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) {
$addfieldentry['arrayofkeyval'] = json_decode($addfieldentry['arrayofkeyval'], true);
}
}
}
@ -1346,8 +1370,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
// Edit the class file to write properties
if (!$error) {
$moduletype = 'external';
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
if (is_numeric($object) && $object <= 0) {
$error++;
}
@ -1366,6 +1390,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
if (!$error) {
setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null);
setEventMessages($langs->trans('WarningDatabaseIsNotUpdated'), null);
clearstatcache(true);
// Make a redirect to reload all data
@ -1940,6 +1966,11 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'description';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Objects");
$head2[$h][2] = 'objects';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Languages");
$head2[$h][2] = 'languages';
@ -1950,11 +1981,6 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'dictionaries';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Objects");
$head2[$h][2] = 'objects';
$h++;
$head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread ? '@'.$dirread : '');
$head2[$h][1] = $langs->trans("Permissions");
$head2[$h][2] = 'permissions';
@ -2537,8 +2563,9 @@ if ($module == 'initmodule') {
$pathtoapi = strtolower($module).'/class/api_'.strtolower($module).'s.class.php';
$realpathtoapi = $dirread.'/'.$pathtoapi;
}
$urloflist = $dirread.'/'.$pathtolist;
$urlofcard = $dirread.'/'.$pathtocard;
$urloflist = dol_buildpath('/'.$pathtolist, 1);
$urlofcard = dol_buildpath('/'.$pathtocard, 1);
print '<div class="fichehalfleft smallxxx">';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.($realpathtoclass ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).($realpathtoclass ? '' : '</strike>').'</strong>';
@ -2699,7 +2726,7 @@ if ($module == 'initmodule') {
print '<div class="div-table-responsive">';
print '<table class="noborder small">';
print '<tr class="liste_titre">';
print '<th class="thsticky">'.$langs->trans("Property");
print '<th class="thsticky thstickygray">'.$langs->trans("Property");
print ' (<a class="" href="https://wiki.dolibarr.org/index.php/Language_and_development_rules#Table_and_fields_structures" target="_blank" rel="noopener noreferrer external">'.$langs->trans("SeeExamples").'</a>)';
print '</th>';
print '<th>';
@ -2725,7 +2752,7 @@ if ($module == 'initmodule') {
//print '<th class="center">'.$langs->trans("Disabled").'</th>';
print '<th>'.$form->textwithpicto($langs->trans("Validate"), $langs->trans("ValidateModBuilderDesc")).'</th>';
print '<th>'.$langs->trans("Comment").'</th>';
print '<th></th>';
print '<th class="thstickyright tdstickyghostwhite"></th>';
print '</tr>';
// We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobjet->fields may have been
@ -2736,7 +2763,7 @@ if ($module == 'initmodule') {
if (!empty($properties)) {
// Line to add a property
print '<tr>';
print '<td class="tdsticky"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>';
print '<td class="tdsticky tdstickygray"><input type="text" class="maxwidth75" name="propname" value="'.dol_escape_htmltag(GETPOST('propname', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proplabel" value="'.dol_escape_htmltag(GETPOST('proplabel', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proptype" value="'.dol_escape_htmltag(GETPOST('proptype', 'alpha')).'"></td>';
print '<td><input type="text" class="maxwidth75" name="proparrayofkeyval" value="'.dol_escape_htmltag(GETPOST('proparrayofkeyval', 'restricthtml')).'"></td>';
@ -2758,7 +2785,7 @@ if ($module == 'initmodule') {
//print '<td class="center"><input type="text" size="2" name="propdisabled" value="'.dol_escape_htmltag(GETPOST('propdisabled', 'alpha')).'"></td>';
print '<td><input type="number" step="1" min="0" max="1" class="text maxwidth100" name="propvalidate" value="'.dol_escape_htmltag(GETPOST('propvalidate', 'alpha')).'"></td>';
print '<td><input class="text maxwidth100" name="propcomment" value="'.dol_escape_htmltag(GETPOST('propcomment', 'alpha')).'"></td>';
print '<td class="center">';
print '<td class="center tdstickyright tdstickyghostwhite">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
print '</td></tr>';
@ -2803,7 +2830,7 @@ if ($module == 'initmodule') {
print '<tr class="oddeven">';
print '<td class="tdsticky">';
print '<td class="tdsticky tdstickygray">';
print dol_escape_htmltag($propname);
print '</td>';
print '<td>';
@ -2818,7 +2845,7 @@ if ($module == 'initmodule') {
print '<td class="tdoverflowmax200">';
print '<input name="proparrayofkeyval" value="';
if (isset($proparrayofkeyval)) {
print dol_escape_htmltag(json_encode($proparrayofkeyval));
print dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE));
}
print '">';
print '</input>';
@ -2874,7 +2901,7 @@ if ($module == 'initmodule') {
print '<td>';
print '<input class="maxwidth100" name="propcomment" value="'.dol_escape_htmltag($propcomment).'">';
print '</td>';
print '<td class="center">';
print '<td class="center tdstickyright tdstickyghostwhite">';
print '<input class="button smallpaddingimp" type="submit" name="edit" value="'.$langs->trans("Save").'">';
print '<input class="button button-cancel smallpaddingimp" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
@ -2884,8 +2911,8 @@ if ($module == 'initmodule') {
print '</td>';
print '<td class="tdoverflowmax200">';
if ($proparrayofkeyval) {
print '<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval)).'">';
print dol_escape_htmltag(json_encode($proparrayofkeyval));
print '<span title="'.dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE)).'">';
print dol_escape_htmltag(json_encode($proparrayofkeyval, JSON_UNESCAPED_UNICODE));
print '</span>';
}
print '</td>';
@ -2945,7 +2972,7 @@ if ($module == 'initmodule') {
print dol_escape_htmltag($propcomment);
print '</span>';
print '</td>';
print '<td class="center">';
print '<td class="center tdstickyright tdstickyghostwhite">';
if ($propname != 'rowid') {
print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editproperty&token='.newToken().'&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>';
print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deleteproperty&token='.newToken().'&propertykey='.urlencode($propname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>';
@ -3079,14 +3106,14 @@ if ($module == 'initmodule') {
print '<tr class="liste_titre">';
print_liste_field_titre("Type", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("fk_menu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("mainmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("leftmenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("URL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("RelativeURL", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("LanguageFile", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("Enabled", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre("Permission", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Target", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("UserType", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'right ');
@ -3124,15 +3151,15 @@ if ($module == 'initmodule') {
print dol_escape_htmltag($menu['langs']);
print '</td>';
print '<td>';
print '<td class="right">';
print dol_escape_htmltag($menu['position']);
print '</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
print dol_escape_htmltag($menu['enabled']);
print '</td>';
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
print dol_escape_htmltag($menu['perms']);
print '</td>';
@ -3834,8 +3861,10 @@ if ($module == 'initmodule') {
$FILENAMEDOCPDF = $modulelowercase.'.pdf';
$outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC;
$outputfiledocurl = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOC;
$outputfiledocrel = $modulelowercase.'/doc/'.$FILENAMEDOC;
$outputfiledocpdf = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocurlpdf = dol_buildpath($modulelowercase, 1).'/doc/'.$FILENAMEDOCPDF;
$outputfiledocrelpdf = $modulelowercase.'/doc/'.$FILENAMEDOCPDF;
// HTML
print '<span class="fa fa-file-o"></span> '.$langs->trans("PathToModuleDocumentation", "HTML").' : ';
@ -3848,6 +3877,7 @@ if ($module == 'initmodule') {
print '</a>';
print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($outputfiledocrel).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
@ -3862,6 +3892,7 @@ if ($module == 'initmodule') {
print '</a>';
print '</strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledocpdf), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($outputfiledocpdfrel).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
@ -3928,8 +3959,11 @@ if ($module == 'initmodule') {
$relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP;
print '<strong><a href="'.DOL_URL_ROOT.'/document.php?modulepart=packages&file='.urlencode($relativepath).'">'.$outputfilezip.'</a></strong>';
print ' <span class="opacitymedium">('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')</span>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&token='.newToken().'&format='.$format.'&file='.urlencode($relativepath).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
print '</strong><br>';
print '</strong>';
print '<br>';
print '<br>';

View File

@ -108,11 +108,11 @@ 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'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, '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'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>1, '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),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501),
//'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
@ -122,7 +122,7 @@ class MyObject extends CommonObject
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010),
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled'), 'validate'=>1),
);
/**

View File

@ -305,7 +305,7 @@ class modMyModule extends DolibarrModules
/* BEGIN MODULEBUILDER LEFTMENU MYOBJECT
$this->menu[$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Top menu entry
'type'=>'left', // This is a Left menu entry
'titre'=>'MyObject',
'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
'mainmenu'=>'mymodule',

View File

@ -28,8 +28,6 @@
* - interface_99_all_MyTrigger.class.php
* - The file must stay in core/triggers
* - The class name must be InterfaceMytrigger
* - The constructor method must be named InterfaceMytrigger
* - The name property name must be MyTrigger
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';

View File

@ -132,15 +132,24 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
@ -187,7 +196,7 @@ if ($object->id > 0) {
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'agenda', '', -1, $object->picto);
print dol_get_fiche_head($head, 'agenda', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------

View File

@ -122,12 +122,23 @@ if (empty($action) && empty($id) && empty($ref)) {
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = 1;
$permissionnote = 1;
$permissiondellink = 1;
}
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->mymodule->myobject->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->mymodule->myobject->write; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1].'/myobject';
// Security check (enable the most restrictive one)
@ -135,8 +146,8 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
@ -230,6 +241,11 @@ llxHeader('', $title, $help_url);
// Part to create
if ($action == 'create') {
if (empty($permissiontoadd)) {
accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1);
exit;
}
print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("MyObject")), '', 'object_'.$object->picto);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -78,15 +78,24 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$permission = $user->rights->mymodule->myobject->write;
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permission = $user->rights->mymodule->myobject->write;
} else {
$permissiontoread = 1;
$permission = 1;
}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
@ -152,7 +161,7 @@ if ($object->id) {
*/
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'contact', '', -1, $object->picto);
print dol_get_fiche_head($head, 'contact', $langs->trans("MyObject"), -1, $object->picto);
$linkback = '<a href="'.dol_buildpath('/mymodule/myobject_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';

View File

@ -124,15 +124,24 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object);
}
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
} else {
$permissiontoread = 1;
$permission = 1;
}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
@ -159,7 +168,7 @@ if ($object->id) {
*/
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'document', '', -1, $object->picto);
print dol_get_fiche_head($head, 'document', $langs->trans("MyObject"), -1, $object->picto);
// Build file list

View File

@ -178,13 +178,17 @@ $object->fields = dol_sort_array($object->fields, 'position');
//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
$arrayfields = dol_sort_array($arrayfields, 'position');
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
$permissiontodelete = $user->rights->mymodule->myobject->delete;
// Security check
if (empty($conf->mymodule->enabled)) {
accessforbidden('Module not enabled');
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
$permissiontodelete = $user->rights->mymodule->myobject->delete;
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
$permissiontodelete = 1;
}
// Security check (enable the most restrictive one)
@ -193,9 +197,8 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden('Moule not enabled');
if (!$permissiontoread) accessforbidden();
/*

View File

@ -101,23 +101,35 @@ if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->mymodule->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
}
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
$permissiontoadd = $user->rights->mymodule->myobject->write; // Used by the include of actions_addupdatedelete.inc.php
// There is several ways to check permission.
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
$permissiontoread = $user->rights->mymodule->myobject->read;
$permissiontoadd = $user->rights->mymodule->myobject->write;
$permissionnote = $user->rights->mymodule->myobject->write; // Used by the include of actions_setnotes.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
$permissionnote = 1;
}
// Security check (enable the most restrictive one)
//if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
//if (empty($conf->mymodule->enabled)) accessforbidden();
//if (!$permissiontoread) accessforbidden();
if (empty($conf->mymodule->enabled)) accessforbidden();
if (!$permissiontoread) accessforbidden();
/*
* Actions
*/
$reshook = $hookmanager->executeHooks('doActions', array(), $object, $action); // Note that $action and $object may have been modified by some hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
@ -141,7 +153,7 @@ if ($id > 0 || !empty($ref)) {
$head = myobjectPrepareHead($object);
print dol_get_fiche_head($head, 'note', '', -1, $object->picto);
print dol_get_fiche_head($head, 'note', $langs->trans("MyObject"), -1, $object->picto);
// Object card
// ------------------------------------------------------------

View File

@ -53,7 +53,7 @@ $nblines = $object->fetch_lines();
// Return to the results
if (GETPOST('retoursondage')) {
header('Location: results.php?id='.GETPOST('id', 'int'));
header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'int')));
exit;
}
@ -588,6 +588,7 @@ if (GETPOST('ajoutsujet')) {
$tmparray = array('checkbox'=>$langs->trans("CheckBox"), 'yesno'=>$langs->trans("YesNoList"), 'foragainst'=>$langs->trans("PourContreList"));
print $langs->trans("Type").' '.$form->selectarray("typecolonne", $tmparray, GETPOST('typecolonne')).'<br><br>';
print '<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
print '<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag($object->id_sondage).'">';
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button button-cancel" name="retoursondage" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '<br><br>'."\n";
@ -663,6 +664,7 @@ $nbcolonnes = substr_count($object->sujet, ',') + 1;
print '<form name="formulaire" action="" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page_y" value="">';
print '<div class="cadre div-table-responsive-no-min"> '."\n";
@ -851,7 +853,7 @@ while ($compteur < $num) {
print '<tr><td>'."\n";
if ($user->rights->opensurvey->write) {
print '<input type="image" name="effaceligne'.$compteur.'" src="'.img_picto('', 'delete.png', '', false, 1).'">'."\n";
print '<input type="image" class="reposition" name="effaceligne'.$compteur.'" src="'.img_picto('', 'delete.png', '', false, 1).'">'."\n";
}
// Name
@ -1012,7 +1014,7 @@ while ($compteur < $num) {
// Button edit at end of line
if ($compteur != $ligneamodifier && ($user->rights->opensurvey->write)) {
print '<td class="casevide"><input type="submit" class="button" name="modifierligne'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Edit")).'"></td>'."\n";
print '<td class="casevide"><input type="submit" class="button reposition" name="modifierligne'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Edit")).'"></td>'."\n";
}
//demande de confirmation pour modification de ligne
@ -1021,7 +1023,7 @@ while ($compteur < $num) {
if ($compteur == $i) {
print '<td class="casevide">';
print '<input type="hidden" name="idtomodify'.$compteur.'" value="'.$obj->id_users.'">';
print '<input type="submit" class="button button-save" name="validermodifier'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '<input type="submit" class="button button-save reposition" name="validermodifier'.$compteur.'" value="'.dol_escape_htmltag($langs->trans("Save")).'">';
print '</td>'."\n";
}
}

View File

@ -3543,11 +3543,24 @@ td.border, div.tagtable div div.border {
width:auto;
}
.thsticky, .tdsticky {
position: sticky;
left: 0px;
}
.thstickyright, .tdstickyright {
position: sticky;
right: 0px;
}
.thstickygray, .tdstickygray {
background-color: lightgray;
}
.thstickyghostwhite, .tdstickyghostwhite {
background-color: ghostwhite;
}
.thstickyinherit, .tdstickyinherit {
background-color: inherit;
}
/* To have left column sticky */
/*.tagtable td[data-key="ref"], .tagtable th[data-key="ref"] {

View File

@ -3599,10 +3599,24 @@ td.border, div.tagtable div div.border {
width:auto;
}
.thsticky, .tdsticky {
position: sticky;
left: 0px;
}
.thstickyright, .tdstickyright {
position: sticky;
right: 0px;
}
.thstickygray, .tdstickygray {
background-color: lightgray;
}
.thstickyghostwhite, .tdstickyghostwhite {
background-color: ghostwhite;
}
.thstickyinherit, .tdstickyinherit {
background-color: inherit;
}
<?php if (!empty($conf->global->THEME_ENABLE_STICKY_COLUMN_REF)) { ?>
/* To have left column sticky */