Merge branch 'Dolibarr:develop' into develop

This commit is contained in:
thibdrev 2022-09-27 18:43:06 +02:00 committed by GitHub
commit 1cb8012ba6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 582 additions and 391 deletions

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -84,7 +84,7 @@ const getFallbackRealAction = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/actions', // url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/actions',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealContact = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -94,7 +94,7 @@ const getFallbackRealContact = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealMember = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -94,7 +94,7 @@ const getFallbackRealMember = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -74,7 +74,7 @@ const getFallbackRealOrder = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/orders', // url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/orders',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -83,7 +83,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -102,7 +102,7 @@ const getFallbackRealThirdparty = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -76,7 +76,7 @@ const getFallbackRealTicket = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -97,7 +97,7 @@ const getFallbackRealTicket = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => {
action: bundle.inputData.action action: bundle.inputData.action
}; };
const url = bundle.authData.url + '/api/index.php/zapierapi/hook'; const url = bundle.authData.url + '/api/index.php/zapier/hook';
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
@ -32,7 +32,7 @@ const unsubscribeHook = (z, bundle) => {
// You can build requests and our client will helpfully inject all the variables // You can build requests and our client will helpfully inject all the variables
// you need to complete. You can also register middleware to control this. // you need to complete. You can also register middleware to control this.
const options = { const options = {
url: bundle.authData.url + '/api/index.php/zapierapi/hook/' + bundle.subscribeData.id, url: bundle.authData.url + '/api/index.php/zapier/hook/' + bundle.subscribeData.id,
method: 'DELETE', method: 'DELETE',
}; };
@ -73,7 +73,7 @@ const getFallbackRealUser = (z, bundle) => {
// const getModulesChoices = (z/*, bundle*/) => { // const getModulesChoices = (z/*, bundle*/) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const options = { // const options = {
// url: bundle.authData.url + '/api/index.php/zapierapi/getmoduleschoices', // url: bundle.authData.url + '/api/index.php/zapier/getmoduleschoices',
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));
@ -93,7 +93,7 @@ const getFallbackRealUser = (z, bundle) => {
// // For the test poll, you should get some real data, to aid the setup process. // // For the test poll, you should get some real data, to aid the setup process.
// const module = bundle.inputData.module; // const module = bundle.inputData.module;
// const options = { // const options = {
// url: url: bundle.authData.url + '/api/index.php/zapierapi/getactionschoices/thirparty`, // url: url: bundle.authData.url + '/api/index.php/zapier/getactionschoices/thirparty`,
// }; // };
// return z.request(options).then((response) => JSON.parse(response.content)); // return z.request(options).then((response) => JSON.parse(response.content));

View File

@ -139,7 +139,7 @@ $formldap = new FormLdap($db);
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'ldap', '', -1);
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@ -245,7 +245,8 @@ print '</td><td class="maxwidthhalf"><span class="opacitymedium">'.$langs->trans
// Pass // Pass
print '<!-- LDAP_ADMIN_PASS -->'; print '<!-- LDAP_ADMIN_PASS -->';
print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>'; print '<tr class="oddeven"><td>'.$langs->trans("LDAPPassword").'</td><td>';
print '<input class="minwidth150" type="password" name="pass" value="'.dol_escape_htmltag($conf->global->LDAP_ADMIN_PASS).'">'; print '<input class="minwidth150" type="password" name="pass" value="'.dol_escape_htmltag(getDolGlobalString('LDAP_ADMIN_PASS')).'">';
print showValueWithClipboardCPButton(getDolGlobalString('LDAP_ADMIN_PASS'), 0, '&nbsp;');
print '</td><td><span class="opacitymedium">'.$langs->trans('Password').' (ex: secret)</span></td></tr>'; print '</td><td><span class="opacitymedium">'.$langs->trans('Password').' (ex: secret)</span></td></tr>';
print '</table>'; print '</table>';

View File

@ -140,7 +140,7 @@ if (!function_exists("ldap_connect")) {
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'contacts', '', -1);
print '<span class="opacitymedium">'.$langs->trans("LDAPDescContact").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescContact").'</span><br>';

View File

@ -114,7 +114,7 @@ if (!function_exists("ldap_connect")) {
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print dol_get_fiche_head($head, 'groups', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'groups', '', -1);
print '<span class="opacitymedium">'.$langs->trans("LDAPDescGroups").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescGroups").'</span><br>';

View File

@ -188,7 +188,7 @@ if (!function_exists("ldap_connect")) {
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&token='.newToken().'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'members', '', -1);
print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembers").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembers").'</span><br>';

View File

@ -106,7 +106,7 @@ if (!function_exists("ldap_connect")) {
setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors');
} }
print dol_get_fiche_head($head, 'memberstypes', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'memberstypes', '', -1);
print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembersTypes").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescMembersTypes").'</span><br>';

View File

@ -178,7 +178,7 @@ print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=setvalue&toke
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1); print dol_get_fiche_head($head, 'users', '', -1);
print '<span class="opacitymedium">'.$langs->trans("LDAPDescUsers").'</span><br>'; print '<span class="opacitymedium">'.$langs->trans("LDAPDescUsers").'</span><br>';
print '<br>'; print '<br>';

View File

@ -411,7 +411,7 @@ foreach ($configfileparameters as $key => $value) {
} elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) { } elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) {
print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
} elseif ($newkey == 'dolibarr_main_document_root_alt') { } elseif ($newkey == 'dolibarr_main_document_root_alt') {
$tmparray = explode(',', ${$newkey}); $tmparray = explode(',', $dolibarr_main_document_root_alt);
$i = 0; $i = 0;
foreach ($tmparray as $value2) { foreach ($tmparray as $value2) {
if ($i > 0) { if ($i > 0) {
@ -429,7 +429,7 @@ foreach ($configfileparameters as $key => $value) {
global $dolibarr_main_cookie_cryptkey, $dolibarr_main_instance_unique_id; global $dolibarr_main_cookie_cryptkey, $dolibarr_main_instance_unique_id;
$valuetoshow = $dolibarr_main_instance_unique_id ? $dolibarr_main_instance_unique_id : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey $valuetoshow = $dolibarr_main_instance_unique_id ? $dolibarr_main_instance_unique_id : $dolibarr_main_cookie_cryptkey; // Use $dolibarr_main_instance_unique_id first then $dolibarr_main_cookie_cryptkey
if (empty($dolibarr_main_prod)) { if (empty($dolibarr_main_prod)) {
print '<!-- '.${$newkey}.' -->'; print '<!-- '.$dolibarr_main_instance_unique_id.' -->';
print showValueWithClipboardCPButton($valuetoshow, 0, '********'); print showValueWithClipboardCPButton($valuetoshow, 0, '********');
} else { } else {
print '**********'; print '**********';

View File

@ -1283,9 +1283,9 @@ if ($resql) {
if ($massaction == 'createbills') { if ($massaction == 'createbills') {
print '<input type="hidden" name="massaction" value="confirm_createbills">'; print '<input type="hidden" name="massaction" value="confirm_createbills">';
print '<table class="noborder" width="100%" >'; print '<table class="noborder centpercent">';
print '<tr>'; print '<tr>';
print '<td class="titlefield">'; print '<td>';
print $langs->trans('DateInvoice'); print $langs->trans('DateInvoice');
print '</td>'; print '</td>';
print '<td>'; print '<td>';
@ -1320,12 +1320,11 @@ if ($resql) {
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>';
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> '; print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomer').'"> ';
print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>'; print '</div>';
print '<br>'; print '<br><br>';
} }
if ($sall) { if ($sall) {

View File

@ -4453,7 +4453,7 @@ if ($action == 'create') {
if ($result > 0) { if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">'; print ' <span class="opacitymediumbycolor paddingleft">';
$s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}'); $s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}');
$s = str_replace('{s1}', $object->getLibType(1), $s); $s = str_replace('{s1}', $object->getLibType(0), $s);
$s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s); $s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s);
print $s; print $s;
print '</span><br>'; print '</span><br>';

View File

@ -300,8 +300,34 @@ if ($action == 'update' && !empty($permissiontoadd)) {
} }
} }
// Action to update one modulebuilder field
$reg = array();
if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
$object->fetch(GETPOST('id', 'int'));
$keyforfield = $reg[1];
if (property_exists($object, $keyforfield)) {
if (!empty($object->fields[$keyforfield]) && in_array($object->fields[$keyforfield]['type'], array('date', 'datetime', 'timestamp'))) {
$object->$keyforfield = dol_mktime(GETPOST($keyforfield.'hour'), GETPOST($keyforfield.'min'), GETPOST($keyforfield.'sec'), GETPOST($keyforfield.'month'), GETPOST($keyforfield.'day'), GETPOST($keyforfield.'year'));
} else {
$object->$keyforfield = GETPOST($keyforfield);
}
$result = $object->update($user);
if ($result > 0) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
$action = 'view';
} else {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit'.$reg[1];
}
}
}
// Action to update one extrafield // Action to update one extrafield
if ($action == "update_extras" && !empty($permissiontoadd)) { if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
$object->fetch(GETPOST('id', 'int')); $object->fetch(GETPOST('id', 'int'));
$attributekey = GETPOST('attribute', 'alpha'); $attributekey = GETPOST('attribute', 'alpha');

View File

@ -211,7 +211,21 @@ class Form
// Check parameters // Check parameters
if (empty($typeofdata)) { if (empty($typeofdata)) {
return 'ErrorBadParameter'; return 'ErrorBadParameter typeofdata is empty';
}
// Clean paramater $typeofdata
if ($typeofdata == 'datetime') {
$typeofdata = 'dayhour';
}
$reg = array();
if (preg_match('/^(\w+)\((\d+)\)$/', $typeofdata, $reg)) {
if ($reg[1] == 'varchar') {
$typeofdata = 'string';
} elseif ($reg[1] == 'int') {
$typeofdata = 'numeric';
} else {
return 'ErrorBadParameter '.$typeofdata;
}
} }
// When option to edit inline is activated // When option to edit inline is activated

View File

@ -1782,6 +1782,8 @@ class FormFile
$result = 0; $result = 0;
if (is_object($object_instance)) { if (is_object($object_instance)) {
$object_instance->id = 0;
$object_instance->ref = '';
if ($id) { if ($id) {
$result = $object_instance->fetch($id); $result = $object_instance->fetch($id);
} else { } else {

View File

@ -2970,7 +2970,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1; $accessallowed = 1;
} }
$original_file = $conf->resource->dir_output.'/'.$original_file; $original_file = $conf->resource->dir_output.'/'.$original_file;
} elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { } elseif (($modulepart == 'remisecheque' || $modulepart == 'chequereceipt') && !empty($conf->bank->dir_output)) {
// Wrapping pour les remises de cheques // Wrapping pour les remises de cheques
if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) { if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1; $accessallowed = 1;

View File

@ -95,7 +95,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
// Edit class files // Edit class files
$contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); $contentclass = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r');
// Update ->fields (add or remove entries) // Update ->fields (to add or remove entries defined into $addfieldentry)
if (count($object->fields)) { if (count($object->fields)) {
if (is_array($addfieldentry) && count($addfieldentry)) { if (is_array($addfieldentry) && count($addfieldentry)) {
$name = $addfieldentry['name']; $name = $addfieldentry['name'];
@ -133,6 +133,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
if (!empty($val['noteditable'])) { if (!empty($val['noteditable'])) {
$texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',";
} }
if (!empty($val['alwayseditable'])) {
$texttoinsert .= " 'alwayseditable'=>'".$val['alwayseditable']."',";
}
if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) { if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) {
$texttoinsert .= " 'default'=>'".$val['default']."',"; $texttoinsert .= " 'default'=>'".$val['default']."',";
} }
@ -189,6 +192,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
} }
$texttoinsert .= "),\n"; $texttoinsert .= "),\n";
//print $texttoinsert;
} }
} }
@ -212,14 +216,16 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES'; $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES';
//print($texttoinsert);exit; //print($texttoinsert);
$contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass); $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass);
//print $contentclass;
dol_mkdir(dirname($pathoffiletoedittarget)); dol_mkdir(dirname($pathoffiletoedittarget));
//file_put_contents($pathoffiletoedittmp, $contentclass); //file_put_contents($pathoffiletoedittmp, $contentclass);
$result = file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass); $result = file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
if ($result) { if ($result) {
@chmod($pathoffiletoedittarget, octdec($newmask)); @chmod($pathoffiletoedittarget, octdec($newmask));
} else { } else {

View File

@ -64,15 +64,23 @@ foreach ($object->fields as $key => $val) {
print ' tdtop'; print ' tdtop';
} }
print '">'; print '">';
$labeltoshow = '';
if (!empty($val['help'])) { if (!empty($val['help'])) {
print $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); $labeltoshow .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
} else { } else {
if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 1) { if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 1) {
print showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($val['label'])); $labeltoshow .= showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($val['label']));
} else { } else {
print $langs->trans($val['label']); $labeltoshow .= $langs->trans($val['label']);
} }
} }
if (empty($val['alwayseditable'])) {
print $labeltoshow;
} else {
print $form->editfieldkey($labeltoshow, $key, $value, $object, 1, $val['type']);
}
print '</td>'; print '</td>';
print '<td class="valuefield fieldname_'.$key; print '<td class="valuefield fieldname_'.$key;
if ($val['type'] == 'text') { if ($val['type'] == 'text') {
@ -82,6 +90,7 @@ foreach ($object->fields as $key => $val) {
print ' '.$val['cssview']; print ' '.$val['cssview'];
} }
print '">'; print '">';
if (empty($val['alwayseditable'])) {
if (in_array($val['type'], array('text', 'html'))) { if (in_array($val['type'], array('text', 'html'))) {
print '<div class="longmessagecut">'; print '<div class="longmessagecut">';
} }
@ -102,6 +111,9 @@ foreach ($object->fields as $key => $val) {
if (in_array($val['type'], array('text', 'html'))) { if (in_array($val['type'], array('text', 'html'))) {
print '</div>'; print '</div>';
} }
} else {
print $form->editfieldval($labeltoshow, $key, $value, $object, 1, $val['type']);
}
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -144,10 +156,20 @@ foreach ($object->fields as $key => $val) {
$rightpart .= ' tdtop'; $rightpart .= ' tdtop';
} }
$rightpart.= '">'; $rightpart.= '">';
$labeltoshow = '';
if (!empty($val['help'])) { if (!empty($val['help'])) {
$rightpart .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help'])); $labeltoshow .= $form->textwithpicto($langs->trans($val['label']), $langs->trans($val['help']));
} else { } else {
$rightpart .= $langs->trans($val['label']); if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 1) {
$labeltoshow .= showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($val['label']));
} else {
$labeltoshow .= $langs->trans($val['label']);
}
}
if (empty($val['alwayseditable'])) {
$rightpart .= $labeltoshow;
} else {
$rightpart .= $form->editfieldkey($labeltoshow, $key, $value, $object, 1, $val['type']);
} }
$rightpart .= '</td>'; $rightpart .= '</td>';
$rightpart .= '<td class="valuefield fieldname_'.$key; $rightpart .= '<td class="valuefield fieldname_'.$key;
@ -158,14 +180,31 @@ foreach ($object->fields as $key => $val) {
$rightpart .= ' '.$val['cssview']; $rightpart .= ' '.$val['cssview'];
} }
$rightpart .= '">'; $rightpart .= '">';
if (empty($val['alwayseditable'])) {
if (in_array($val['type'], array('text', 'html'))) { if (in_array($val['type'], array('text', 'html'))) {
$rightpart .= '<div class="longmessagecut">'; $rightpart .= '<div class="longmessagecut">';
} }
$rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); if ($key == 'lang') {
//$rightpart .= dol_escape_htmltag($object->$key, 1, 1); $langs->load("languages");
$labellang = ($value ? $langs->trans('Language_'.$value) : '');
$rightpart .= picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"');
$rightpart .= $labellang;
} else {
if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 2) {
$out = $object->showOutputField($val, $key, $value, '', '', '', 0);
$rightpart .= showValueWithClipboardCPButton($out, 0, $out);
} else {
$rightpart.= $object->showOutputField($val, $key, $value, '', '', '', 0);
}
}
if (in_array($val['type'], array('text', 'html'))) { if (in_array($val['type'], array('text', 'html'))) {
$rightpart .= '</div>'; $rightpart .= '</div>';
} }
} else {
$rightpart .= $form->editfieldval($labeltoshow, $key, $value, $object, 1, $val['type']);
}
$rightpart .= '</td>'; $rightpart .= '</td>';
$rightpart .= '</tr>'; $rightpart .= '</tr>';
} }

View File

@ -294,6 +294,7 @@ ErrorFailedToLoadThirdParty=Failed to find/load thirdparty from id=%s, email=%s,
ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account ErrorThisPaymentModeIsNotSepa=This payment mode is not a bank account
ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first. ErrorStripeCustomerNotFoundCreateFirst=Stripe customer is not set for this thirdparty (or set to a value deleted on Stripe side). Create (or re-attach) it first.
ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character + ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character +
ErrorTableNotFound=Table <b>%s</b> not found
# Warnings # Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@ -133,11 +133,11 @@ UseSpecificEditorURL = Use a specific editor URL
UseSpecificFamily = Use a specific family UseSpecificFamily = Use a specific family
UseSpecificAuthor = Use a specific author UseSpecificAuthor = Use a specific author
UseSpecificVersion = Use a specific initial version UseSpecificVersion = Use a specific initial version
IncludeRefGeneration=The reference of object must be generated automatically by custom numbering rules IncludeRefGeneration=The reference of this object must be generated automatically by custom numbering rules
IncludeRefGenerationHelp=Check this if you want to include code to manage the generation of the reference automatically using custom numbering rules IncludeRefGenerationHelp=Check this if you want to include code to manage the generation of the reference automatically using custom numbering rules
IncludeDocGeneration=I want to generate some documents from templates for the object IncludeDocGeneration=I want the feature to generate some documents (PDF, ODT) from templates for this object
IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record. IncludeDocGenerationHelp=If you check this, some code will be generated to add a "Generate document" box on the record.
ShowOnCombobox=Show value into combobox ShowOnCombobox=Show value into combo boxes
KeyForTooltip=Key for tooltip KeyForTooltip=Key for tooltip
CSSClass=CSS for edit/create form CSSClass=CSS for edit/create form
CSSViewClass=CSS for read form CSSViewClass=CSS for read form
@ -157,3 +157,6 @@ ListOfTabsEntries=List of tab entries
TabsDefDesc=Define here the tabs provided by your module TabsDefDesc=Define here the tabs provided by your module
TabsDefDescTooltip=The tabs provided by your module/application are defined into the array <strong>$this->tabs</strong> into the module descriptor file. You can edit manually this file or use the embedded editor. TabsDefDescTooltip=The tabs provided by your module/application are defined into the array <strong>$this->tabs</strong> into the module descriptor file. You can edit manually this file or use the embedded editor.
BadValueForType=Bad value for type %s BadValueForType=Bad value for type %s
DefinePropertiesFromExistingTable=Define properties from an existing table
DefinePropertiesFromExistingTableDesc=If a table in the database (for the object to create) already exists, you can use it to define the properties of the object.
DefinePropertiesFromExistingTableDesc2=Keep empty if the table does not exist yet. The code generator will use different kinds of fields to build an example of table that you can edit later.

View File

@ -202,10 +202,10 @@ foreach ($dirsrootforscan as $dirread) {
} }
$textforlistofdirs .= '<strong class="wordbreakimp">'.$dirread.'</strong>'; $textforlistofdirs .= '<strong class="wordbreakimp">'.$dirread.'</strong>';
if ($dirread == DOL_DOCUMENT_ROOT) { if ($dirread == DOL_DOCUMENT_ROOT) {
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MAIN_FEATURES_LEVEL")); $textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MAIN_FEATURES_LEVEL"));
} }
if (!empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT)) { if (getDolGlobalString('MODULEBUILDER_ADD_DOCUMENT_ROOT')) {
$textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MODULEBUILDER_ADD_DOCUMENT_ROOT")); $textforlistofdirs .= $form->textwithpicto('', $langs->trans("ConstantIsOn", "MODULEBUILDER_ADD_DOCUMENT_ROOT"));
} }
} }
@ -317,7 +317,6 @@ if ($dirins && $action == 'initmodule' && $modulename) {
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.sql');
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject.key.sql');
dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql'); dol_delete_file($destdir.'/sql/llx_'.strtolower($modulename).'_myobject_extrafields.key.sql');
dol_delete_file($destdir.'/img/object_myobject.png');
dol_delete_file($destdir.'/class/myobject.class.php'); dol_delete_file($destdir.'/class/myobject.class.php');
dol_delete_dir($destdir.'/class', 1); dol_delete_dir($destdir.'/class', 1);
@ -895,12 +894,58 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) {
} }
} }
// Init an object
if ($dirins && $action == 'initobject' && $module && $objectname) {
$objectname = ucfirst($objectname);
// Build the $fields array from SQL table (initfromtablename) $dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', 'alpha')) { $moduletype = $listofmodules[strtolower($module)]['moduletype'];
if (preg_match('/[^a-z0-9_]/i', $objectname)) {
$error++;
setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors');
$tabobj = 'newobject';
}
if (class_exists($objectname)) {
// TODO Add a more efficient detection. Scan disk ?
$error++;
setEventMessages($langs->trans("AnObjectWithThisClassNameAlreadyExists"), null, 'errors');
$tabobj = 'newobject';
}
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
$destdir = $dirins.'/'.strtolower($module);
// The dir was not created by init
dol_mkdir($destdir.'/class');
dol_mkdir($destdir.'/img');
dol_mkdir($destdir.'/lib');
dol_mkdir($destdir.'/scripts');
dol_mkdir($destdir.'/sql');
// Scan dir class to find if an object with same name already exists.
if (!$error) {
$dirlist = dol_dir_list($destdir.'/class', 'files', 0, '\.txt$');
$alreadyfound = false;
foreach ($dirlist as $key => $val) {
$filefound = preg_replace('/\.txt$/', '', $val['name']);
if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
$alreadyfound = true;
$error++;
setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors');
break;
}
}
}
// If we must reuse a table for properties, define $stringforproperties
$stringforproperties = '';
$tablename = GETPOST('initfromtablename', 'alpha'); $tablename = GETPOST('initfromtablename', 'alpha');
if ($tablename) {
$_results = $db->DDLDescTable($tablename); $_results = $db->DDLDescTable($tablename);
if (empty($_results)) { if (empty($_results)) {
$error++;
$langs->load("errors");
setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors'); setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors');
} else { } else {
/** /**
@ -913,6 +958,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0) * 'noteditable' says if field is not editable (1 or 0)
* 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0')
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database. * 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
@ -933,7 +979,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'), 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'alwayseditable'=>'1'),
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'), 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirdparty'), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>'LinkToThirdparty'),
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60), 'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
@ -949,8 +995,8 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')), 'status' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Active', -1=>'Cancel')),
);*/ );*/
$string = 'public $fields=array('."\n"; $stringforproperties = '// BEGIN MODULEBUILDER PROPERTIES'."\n";
$string .= "<br>"; $stringforproperties .= 'public $fields=array('."\n";
$i = 10; $i = 10;
while ($obj = $db->fetch_object($_results)) { while ($obj = $db->fetch_object($_results)) {
// fieldname // fieldname
@ -1057,6 +1103,10 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if ($fieldname == 'import_key') { if ($fieldname == 'import_key') {
$position = 900; $position = 900;
} }
// $alwayseditable
if ($fieldname == 'label') {
$alwayseditable = 1;
}
// index // index
$index = 0; $index = 0;
if ($fieldname == 'entity') { if ($fieldname == 'entity') {
@ -1076,6 +1126,9 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
if (in_array($fieldname, array('note_public', 'note_private'))) { if (in_array($fieldname, array('note_public', 'note_private'))) {
$cssview = 'wordbreak'; $cssview = 'wordbreak';
} }
if (in_array($fieldname, array('ref', 'label')) || preg_match('/integer:/', $type)) {
$csslist = 'tdoverflowmax150';
}
// type // type
$picto = $obj->Picto; $picto = $obj->Picto;
@ -1087,85 +1140,42 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
} }
// Build the property string // Build the property string
$string .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',"; $stringforproperties .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',";
if ($default != '') { if ($default != '') {
$string .= " 'default'=>".$default.","; $stringforproperties .= " 'default'=>".$default.",";
} }
$string .= " 'enabled'=>".$enabled.","; $stringforproperties .= " 'enabled'=>".$enabled.",";
$string .= " 'visible'=>".$visible; $stringforproperties .= " 'visible'=>".$visible;
if ($notnull) { if ($notnull) {
$string .= ", 'notnull'=>".$notnull; $stringforproperties .= ", 'notnull'=>".$notnull;
}
if ($alwayseditable) {
$stringforproperties .= ", 'alwayseditable'=>1";
} }
if ($fieldname == 'ref' || $fieldname == 'code') { if ($fieldname == 'ref' || $fieldname == 'code') {
$string .= ", 'showoncombobox'=>1"; $stringforproperties .= ", 'showoncombobox'=>1";
} }
$string .= ", 'position'=>".$position; $stringforproperties .= ", 'position'=>".$position;
if ($index) { if ($index) {
$string .= ", 'index'=>".$index; $stringforproperties .= ", 'index'=>".$index;
} }
if ($picto) { if ($picto) {
$string .= ", 'picto'=>'".$picto."'"; $stringforproperties .= ", 'picto'=>'".$picto."'";
} }
if ($css) { if ($css) {
$string .= ", 'css'=>".$css; $stringforproperties .= ", 'css'=>'".$css."'";
} }
if ($cssview) { if ($cssview) {
$string .= ", 'cssview'=>".$cssview; $stringforproperties .= ", 'cssview'=>'".$cssview."'";
} }
if ($csslist) { if ($csslist) {
$string .= ", 'csslist'=>".$csslist; $stringforproperties .= ", 'csslist'=>'".$csslist."'";
} }
$string .= "),\n"; $stringforproperties .= "),\n";
$string .= "<br>";
$i += 5; $i += 5;
} }
$string .= ');'."\n"; $stringforproperties .= ');'."\n";
$string .= "<br>"; $stringforproperties .= '// END MODULEBUILDER PROPERTIES'."\n";
print $string;
exit;
}
}
if ($dirins && $action == 'initobject' && $module && $objectname) {
$objectname = ucfirst($objectname);
$dirins = $dirread = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
$moduletype = $listofmodules[strtolower($module)]['moduletype'];
if (preg_match('/[^a-z0-9_]/i', $objectname)) {
$error++;
setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors');
$tabobj = 'newobject';
}
if (class_exists($objectname)) {
// TODO Add a more efficient detection. Scan disk ?
$error++;
setEventMessages($langs->trans("AnObjectWithThisClassNameAlreadyExists"), null, 'errors');
$tabobj = 'newobject';
}
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
$destdir = $dirins.'/'.strtolower($module);
// The dir was not created by init
dol_mkdir($destdir.'/class');
dol_mkdir($destdir.'/img');
dol_mkdir($destdir.'/lib');
dol_mkdir($destdir.'/scripts');
dol_mkdir($destdir.'/sql');
// Scan dir class to find if an object with same name already exists.
if (!$error) {
$dirlist = dol_dir_list($destdir.'/class', 'files', 0, '\.txt$');
$alreadyfound = false;
foreach ($dirlist as $key => $val) {
$filefound = preg_replace('/\.txt$/', '', $val['name']);
if (strtolower($objectname) == strtolower($filefound) && $objectname != $filefound) {
$alreadyfound = true;
$error++;
setEventMessages($langs->trans("AnObjectAlreadyExistWithThisNameAndDiffCase"), null, 'errors');
break;
}
} }
} }
@ -1186,7 +1196,6 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql', 'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
//'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php', //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php', //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
); );
@ -1210,6 +1219,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
); );
} }
if (!$error) {
foreach ($filetogenerate as $srcfile => $destfile) { foreach ($filetogenerate as $srcfile => $destfile) {
$result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0);
if ($result <= 0) { if ($result <= 0) {
@ -1223,6 +1234,17 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
} }
} }
} }
}
// Replace property section with $stringforproperties
if (!$error && $stringforproperties) {
//var_dump($stringforproperties);exit;
$arrayreplacement = array(
'/\/\/ BEGIN MODULEBUILDER PROPERTIES.*\/\/ END MODULEBUILDER PROPERTIES/ims' => $stringforproperties
);
dolReplaceInFile($destdir.'/class/'.strtolower($objectname).'.class.php', $arrayreplacement, '', 0, 0, 1);
}
// Edit the class 'class/'.strtolower($objectname).'.class.php' // Edit the class 'class/'.strtolower($objectname).'.class.php'
if (GETPOST('includerefgeneration', 'aZ09')) { if (GETPOST('includerefgeneration', 'aZ09')) {
@ -1386,14 +1408,19 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
if (!$error) { if (!$error) {
// Edit the class file to write properties // Edit the class file to write properties
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask); $object = rebuildObjectClass($destdir, $module, $objectname, $newmask);
if (is_numeric($object) && $object < 0) {
if (is_numeric($object) && $object <= 0) {
$pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++; $error++;
} }
} }
if (!$error) { if (!$error) {
// Edit sql with new properties // Edit sql with new properties
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object);
if ($result < 0) {
if ($result <= 0) {
setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null);
$error++; $error++;
} }
} }
@ -1401,6 +1428,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
if (!$error) { if (!$error) {
setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null);
$tabobj = $objectname; $tabobj = $objectname;
} else {
$tabobj = 'newobject';
} }
} }
@ -1503,6 +1532,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
'csslist'=>GETPOST('propcsslist', 'alpha'), 'csslist'=>GETPOST('propcsslist', 'alpha'),
'default'=>GETPOST('propdefault', 'restricthtml'), 'default'=>GETPOST('propdefault', 'restricthtml'),
'noteditable'=>intval(GETPOST('propnoteditable', 'int')), 'noteditable'=>intval(GETPOST('propnoteditable', 'int')),
'alwayseditable'=>intval(GETPOST('propalwayseditable', 'int')),
'validate' => GETPOST('propvalidate', 'int') 'validate' => GETPOST('propvalidate', 'int')
); );
@ -1528,6 +1558,8 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype); $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry, $moduletype);
if (is_numeric($object) && $object <= 0) { if (is_numeric($object) && $object <= 0) {
$pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++; $error++;
} }
} }
@ -1537,6 +1569,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype); $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype);
if ($result <= 0) { if ($result <= 0) {
setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors');
$error++; $error++;
} }
} }
@ -1568,7 +1601,10 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) {
// Edit the class file to write properties // Edit the class file to write properties
if (!$error) { if (!$error) {
$object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey);
if (is_numeric($object) && $object <= 0) { if (is_numeric($object) && $object <= 0) {
$pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php';
setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors');
$error++; $error++;
} }
} }
@ -1576,7 +1612,9 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) {
// Edit sql with new properties // Edit sql with new properties
if (!$error) { if (!$error) {
$result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object);
if ($result <= 0) { if ($result <= 0) {
setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors');
$error++; $error++;
} }
} }
@ -1655,7 +1693,6 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql', 'sql/llx_mymodule_myobject_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql',
'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php', 'scripts/myobject.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php', 'class/api_myobject.class.php'=>'class/api_'.strtolower($module).'.class.php',
'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php', 'core/modules/mymodule/mod_myobject_advanced.php'=>'core/modules/'.strtolower($module).'/mod_'.strtolower($objectname).'_advanced.php',
@ -1934,7 +1971,7 @@ if ($message) {
} }
//print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>'; //print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'<br>';
$infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto('<span class="opacitymedium hideonsmartphone">'.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).'</span>', $langs->trans("ModuleBuilderDesc4", $FILEFLAG).'<br>'.$textforlistofdirs).'</div>'; $infomodulesfound = '<div style="padding: 12px 9px 12px">'.$form->textwithpicto('', $langs->trans("ModuleBuilderDesc3", count($listofmodules)).'<br><br>'.$langs->trans("ModuleBuilderDesc4", $FILEFLAG).'<br>'.$textforlistofdirs).'</div>';
// Load module descriptor // Load module descriptor
@ -2013,8 +2050,10 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
} }
$urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>'; $urltomodulesetup = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword='.urlencode($module).'">'.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").'</a>';
if (!empty($conf->global->$const_name)) { // If module is already activated
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&value=mod'.$module.$param.'">'; // Define $linktoenabledisable to show after module title
if (isModEnabled($modulelowercase)) { // If module is already activated
$linktoenabledisable .= '<a class="reposition asetresetmodule valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=reset&token='.newToken().'&value=mod'.$module.$param.'">';
$linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1); $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1);
$linktoenabledisable .= '</a>'; $linktoenabledisable .= '</a>';
@ -2074,7 +2113,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
} }
$head[$h][0] = $_SERVER["PHP_SELF"].'?module=deletemodule'; $head[$h][0] = $_SERVER["PHP_SELF"].'?module=deletemodule';
$head[$h][1] = $langs->trans("DangerZone"); $head[$h][1] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("DangerZone");
$head[$h][2] = 'deletemodule'; $head[$h][2] = 'deletemodule';
$h++; $h++;
@ -2271,6 +2310,8 @@ if ($module == 'initmodule') {
$head2[$h][2] = 'buildpackage'; $head2[$h][2] = 'buildpackage';
$h++; $h++;
$MAXTABFOROBJECT = 15;
print '<!-- Section for a given module -->'; print '<!-- Section for a given module -->';
// Note module is inside $dirread // Note module is inside $dirread
@ -2282,7 +2323,7 @@ if ($module == 'initmodule') {
$pathtochangelog = $modulelowercase.'/ChangeLog.md'; $pathtochangelog = $modulelowercase.'/ChangeLog.md';
if ($action != 'editfile' || empty($file)) { if ($action != 'editfile' || empty($file)) {
print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix'); // Description - level 2 print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', $MAXTABFOROBJECT, 'formodulesuffix'); // Description - level 2
print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc".$tab).'</span>'; print '<span class="opacitymedium">'.$langs->trans("ModuleBuilderDesc".$tab).'</span>';
$infoonmodulepath = ''; $infoonmodulepath = '';
@ -2442,7 +2483,7 @@ if ($module == 'initmodule') {
print '</form>'; print '</form>';
} }
} else { } else {
print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix'); // Level 2 print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', $MAXTABFOROBJECT, 'formodulesuffix'); // Level 2
} }
if ($tab == 'languages') { if ($tab == 'languages') {
@ -2563,7 +2604,7 @@ if ($module == 'initmodule') {
if ($h > 1) { if ($h > 1) {
$head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject'; $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj=deleteobject';
$head3[$h][1] = $langs->trans("DangerZone"); $head3[$h][1] =img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("DangerZone");
$head3[$h][2] = 'deleteobject'; $head3[$h][2] = 'deleteobject';
$h++; $h++;
} }
@ -2589,12 +2630,38 @@ if ($module == 'initmodule') {
print '<span class="opacitymedium">'.$langs->trans("EnterNameOfObjectDesc").'</span><br><br>'; print '<span class="opacitymedium">'.$langs->trans("EnterNameOfObjectDesc").'</span><br><br>';
print '<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(GETPOST('objectname', 'alpha') ? GETPOST('objectname', 'alpha') : $modulename).'" placeholder="'.dol_escape_htmltag($langs->trans("ObjectKey")).'" autofocus><br>'; print '<div class="tagtable">';
print '<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label for="includerefgeneration">'.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'</label><br>';
print '<div class="tagtr"><div class="tagtd">';
print '<span class="opacitymedium">'.$langs->trans("ObjectKey").'</span> &nbsp; ';
print '</div><div class="tagtd">';
print '<input type="text" name="objectname" maxlength="64" value="'.dol_escape_htmltag(GETPOST('objectname', 'alpha') ? GETPOST('objectname', 'alpha') : $modulename).'" autofocus><br>';
print '</div></div>';
print '<div class="tagtr"><div class="tagtd">';
print '<span class="opacitymedium">'.$langs->trans("Picto").'</span> &nbsp; ';
print '</div><div class="tagtd">';
print '<input type="text" name="idpicto" value="fa-generic" placeholder="'.dol_escape_htmltag($langs->trans("Picto")).'">';
print $form->textwithpicto('', $langs->trans("Example").': fa-generic, fa-globe, ... any font awesome code.<br>Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]');
print '</div></div>';
print '<div class="tagtr"><div class="tagtd">';
print '<span class="opacitymedium">'.$langs->trans("DefinePropertiesFromExistingTable").'</span> &nbsp; ';
print '</div><div class="tagtd">';
print '<input type="text" name="initfromtablename" value="'.GETPOST('initfromtablename').'" placeholder="'.$langs->trans("TableName").'">';
print $form->textwithpicto('', $langs->trans("DefinePropertiesFromExistingTableDesc").'<br>'.$langs->trans("DefinePropertiesFromExistingTableDesc2"));
print '</div></div>';
print '</div>';
print '<br>';
print '<input type="checkbox" name="includerefgeneration" id="includerefgeneration" value="includerefgeneration"> <label class="margintoponly" for="includerefgeneration">'.$form->textwithpicto($langs->trans("IncludeRefGeneration"), $langs->trans("IncludeRefGenerationHelp")).'</label><br>';
print '<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'</label><br>'; print '<input type="checkbox" name="includedocgeneration" id="includedocgeneration" value="includedocgeneration"> <label for="includedocgeneration">'.$form->textwithpicto($langs->trans("IncludeDocGeneration"), $langs->trans("IncludeDocGenerationHelp")).'</label><br>';
print '<input type="submit" class="button smallpaddingimp" name="create" value="'.dol_escape_htmltag($langs->trans("GenerateCode")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; print '<br>';
print '<input type="submit" class="button small" name="create" value="'.dol_escape_htmltag($langs->trans("GenerateCode")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
/*
print '<br>'; print '<br>';
print '<span class="opacitymedium">'.$langs->trans("or").'</span>'; print '<span class="opacitymedium">'.$langs->trans("or").'</span>';
print '<br>'; print '<br>';
@ -2604,6 +2671,7 @@ if ($module == 'initmodule') {
print '<input type="text" name="initfromtablename" value="" placeholder="'.$langs->trans("TableName").'">'; print '<input type="text" name="initfromtablename" value="" placeholder="'.$langs->trans("TableName").'">';
print '<input type="submit" class="button smallpaddingimp" name="createtablearray" value="'.dol_escape_htmltag($langs->trans("GenerateCode")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; print '<input type="submit" class="button smallpaddingimp" name="createtablearray" value="'.dol_escape_htmltag($langs->trans("GenerateCode")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '<br>'; print '<br>';
*/
print '</form>'; print '</form>';
} elseif ($tabobj == 'deleteobject') { } elseif ($tabobj == 'deleteobject') {
@ -2665,7 +2733,7 @@ if ($module == 'initmodule') {
} }
if (class_exists($tabobj)) { if (class_exists($tabobj)) {
try { try {
$tmpobjet = @new $tabobj($db); $tmpobject = @new $tabobj($db);
} catch (Exception $e) { } catch (Exception $e) {
dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING);
} }
@ -2738,13 +2806,22 @@ if ($module == 'initmodule') {
$urlofcard = dol_buildpath('/'.$pathtocard, 1); $urlofcard = dol_buildpath('/'.$pathtocard, 1);
print '<!-- section for object -->';
print '<div class="fichehalfleft smallxxx">'; print '<div class="fichehalfleft smallxxx">';
// Main DAO class file // Main DAO class file
print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.(dol_is_file($realpathtoclass) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '</strike>').'</strong>'; print '<span class="fa fa-file-o"></span> '.$langs->trans("ClassFile").' : <strong>'.(dol_is_file($realpathtoclass) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoclass).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
// Image
if (dol_is_file($realpathtopicto)) {
print '<span class="fa fa-file-image-o"></span> '.$langs->trans("Image").' : <strong>'.(dol_is_file($realpathtopicto) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '</strike>').'</strong>';
//print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
} elseif (!empty($tmpobject)) {
print '<span class="fa fa-file-image-o"></span> '.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth"');
print '<br>';
}
// API file // API file
print '<br>'; print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span></strike>').'</strong>'; print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span></strike>').'</strong>';
@ -2781,9 +2858,6 @@ if ($module == 'initmodule') {
print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForObjLib").' : <strong class="wordbreak">'.(dol_is_file($realpathtoobjlib) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : '</strike>').'</strong>'; print '<span class="fa fa-file-o"></span> '.$langs->trans("PageForObjLib").' : <strong class="wordbreak">'.(dol_is_file($realpathtoobjlib) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : '</strike>').'</strong>';
print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoobjlib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtoobjlib).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>'; print '<br>';
print '<span class="fa fa-file-image-o"></span> '.$langs->trans("Image").' : <strong>'.(dol_is_file($realpathtopicto) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '</strike>').'</strong>';
//print ' <a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread?'@'.$dirread:'').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtopicto).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>';
print '<br>';
print '<br>'; print '<br>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtosql) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : '</strike>').'</strong>'; print '<span class="fa fa-file-o"></span> '.$langs->trans("SqlFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtosql) ? '' : '<strike>').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : '</strike>').'</strong>';
@ -2871,7 +2945,7 @@ if ($module == 'initmodule') {
print '<br><br><br>'; print '<br><br><br>';
if (!empty($tmpobjet)) { if (!empty($tmpobject)) {
$reflector = new ReflectionClass($tabobj); $reflector = new ReflectionClass($tabobj);
$reflectorproperties = $reflector->getProperties(); // Can also use get_object_vars $reflectorproperties = $reflector->getProperties(); // Can also use get_object_vars
$reflectorpropdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars $reflectorpropdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars
@ -2911,6 +2985,7 @@ if ($module == 'initmodule') {
print '<th class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</th>'; print '<th class="center">'.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).'</th>';
print '<th class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</th>'; print '<th class="center">'.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).'</th>';
print '<th class="center">'.$langs->trans("NotEditable").'</th>'; print '<th class="center">'.$langs->trans("NotEditable").'</th>';
print '<th class="center">'.$langs->trans("AlwaysEditable").'</th>';
print '<th class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</th>'; print '<th class="center">'.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).'</th>';
print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>'; print '<th class="center">'.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).'</th>';
print '<th class="center">'.$langs->trans("CSSClass").'</th>'; print '<th class="center">'.$langs->trans("CSSClass").'</th>';
@ -2924,9 +2999,9 @@ if ($module == 'initmodule') {
print '<th class="none"></th>'; print '<th class="none"></th>';
print '</tr>'; print '</tr>';
// We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobjet->fields may have been // We must use $reflectorpropdefault['fields'] to get list of fields because $tmpobject->fields may have been
// modified during the constructor and we want value into head of class before constructor is called. // modified during the constructor and we want value into head of class before constructor is called.
//$properties = dol_sort_array($tmpobjet->fields, 'position'); //$properties = dol_sort_array($tmpobject->fields, 'position');
$properties = dol_sort_array($reflectorpropdefault['fields'], 'position'); $properties = dol_sort_array($reflectorpropdefault['fields'], 'position');
if (!empty($properties)) { if (!empty($properties)) {
@ -2944,6 +3019,7 @@ if ($module == 'initmodule') {
print '<td class="center"><input type="text" class="center maxwidth50" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="center maxwidth50" name="propenabled" value="'.dol_escape_htmltag(GETPOST('propenabled', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="center maxwidth50" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="center maxwidth50" name="propvisible" value="'.dol_escape_htmltag(GETPOST('propvisible', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="center maxwidth50" name="propnoteditable" value="'.dol_escape_htmltag(GETPOST('propnoteditable', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="center maxwidth50" name="propnoteditable" value="'.dol_escape_htmltag(GETPOST('propnoteditable', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="center maxwidth50" name="propalwayseditable" value="'.dol_escape_htmltag(GETPOST('propalwayseditable', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="center maxwidth50" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="center maxwidth50" name="propsearchall" value="'.dol_escape_htmltag(GETPOST('propsearchall', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="center maxwidth50" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="center maxwidth50" name="propisameasure" value="'.dol_escape_htmltag(GETPOST('propisameasure', 'alpha')).'"></td>';
print '<td class="center"><input type="text" class="maxwidth50" name="propcss" value="'.dol_escape_htmltag(GETPOST('propcss', 'alpha')).'"></td>'; print '<td class="center"><input type="text" class="maxwidth50" name="propcss" value="'.dol_escape_htmltag(GETPOST('propcss', 'alpha')).'"></td>';
@ -2965,7 +3041,7 @@ if ($module == 'initmodule') {
{ {
$propname=$propval->getName(); $propname=$propval->getName();
$comment=$propval->getDocComment(); $comment=$propval->getDocComment();
$type=gettype($tmpobjet->$propname); $type=gettype($tmpobject->$propname);
$default=$propdefault[$propname]; $default=$propdefault[$propname];
// Discard generic properties // Discard generic properties
if (in_array($propname, array('element', 'childtables', 'table_element', 'table_element_line', 'class_element_line', 'ismultientitymanaged'))) continue; if (in_array($propname, array('element', 'childtables', 'table_element', 'table_element_line', 'class_element_line', 'ismultientitymanaged'))) continue;
@ -2986,6 +3062,7 @@ if ($module == 'initmodule') {
$propenabled = $propval['enabled']; $propenabled = $propval['enabled'];
$propvisible = $propval['visible']; $propvisible = $propval['visible'];
$propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0; $propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0;
$propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0;
$propsearchall = !empty($propval['searchall'])?$propval['searchall']:0; $propsearchall = !empty($propval['searchall'])?$propval['searchall']:0;
$propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0; $propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0;
$propcss = !empty($propval['css'])?$propval['css']:''; $propcss = !empty($propval['css'])?$propval['css']:'';
@ -3044,6 +3121,9 @@ if ($module == 'initmodule') {
print '<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">'; print '<input class="center" name="propnoteditable" size="2" value="'.dol_escape_htmltag($propnoteditable).'">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print '<input class="center" name="propalwayseditable" size="2" value="'.dol_escape_htmltag($propalwayseditable).'">';
print '</td>';
print '<td>';
print '<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).'">'; print '<input class="center" name="propsearchall" size="2" value="'.dol_escape_htmltag($propsearchall).'">';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
@ -3110,6 +3190,9 @@ if ($module == 'initmodule') {
print $propnoteditable ? dol_escape_htmltag($propnoteditable) : ''; print $propnoteditable ? dol_escape_htmltag($propnoteditable) : '';
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';
print $propalwayseditable ? dol_escape_htmltag($propalwayseditable) : '';
print '</td>';
print '<td class="center">';
print $propsearchall ? '1' : ''; print $propsearchall ? '1' : '';
print '</td>'; print '</td>';
print '<td class="center">'; print '<td class="center">';

View File

@ -89,6 +89,7 @@ class MyObject extends CommonObject
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0) * 'noteditable' says if field is not editable (1 or 0)
* 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0')
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
* 'index' if we want an index in database. * 'index' if we want an index in database.
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
@ -115,19 +116,19 @@ class MyObject extends CommonObject
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'),
'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>10), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>10),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object', 'validate'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20, 'searchall'=>1, 'comment'=>'Reference of object', 'validate'=>1),
'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), '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, 'alwayseditable'=>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), '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), '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'=>'OrganizationEventLinkToThirdParty', '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', 'csslist'=>'tdoverflowmax150'),
'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'), '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', 'csslist'=>'tdoverflowmax150'),
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), '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'), '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'), '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), '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), '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), //'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax150'),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511, 'csslist'=>'tdoverflowmax150'),
//'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600), '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), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),

View File

@ -0,0 +1,14 @@
Directory for module image files
--------------------------------
You can put here the .png files of your module:
If the picto of your module is an image (property $picto has been set to 'mymodule.png@mymodule', you can put into this
directory a .png file called *object_mymodule.png* (16x16 or 32x32 pixels)
If the picto of an object is an image (property $picto of the object.class.php has been set to 'myobject.png@mymodule', then you can put into this
directory a .png file called *object_myobject.png* (16x16 or 32x32 pixels)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 219 B

View File

@ -105,7 +105,7 @@ class Mo extends CommonObject
'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), 'mrptype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>34, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'),
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:0', 'label'=>'Product', 'enabled'=>'$conf->product->enabled', 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'comment'=>"Product to produce", 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax100', 'picto'=>'product'),
'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1), 'qty' => array('type'=>'real', 'label'=>'QtyToProduce', 'enabled'=>1, 'visible'=>1, 'position'=>40, 'notnull'=>1, 'comment'=>"Qty to produce", 'css'=>'width75', 'default'=>1, 'isameasure'=>1),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>42, 'notnull'=>-1, 'searchall'=>1, 'showoncombobox'=>'2', 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200', 'alwayseditable'=>1),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'visible'=>-1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax150'),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>51, 'notnull'=>-1, 'index'=>1, 'css'=>'minwidth200 maxwidth400', 'csslist'=>'tdoverflowmax100'),
'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php:0', 'label'=>'WarehouseForProduction', 'picto'=>'stock', 'enabled'=>'$conf->stock->enabled', 'visible'=>1, 'position'=>52, 'css'=>'maxwidth400', 'csslist'=>'tdoverflowmax200'),
@ -116,8 +116,8 @@ class Mo extends CommonObject
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,), 'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502,),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'), 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'position'=>510, 'notnull'=>1, 'foreignkey'=>'user.rowid', 'csslist'=>'tdoverflowmax100'),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'position'=>511, 'notnull'=>-1, 'csslist'=>'tdoverflowmax100'),
'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap'), 'date_start_planned' => array('type'=>'datetime', 'label'=>'DateStartPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>55, 'notnull'=>-1, 'index'=>1, 'help'=>'KeepEmptyForAsap', 'alwayseditable'=>1),
'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), 'date_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1, 'alwayseditable'=>1),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>1010),
'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')), 'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>2, 'position'=>1000, 'default'=>0, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'InProgress', '3'=>'StatusMOProduced', '9'=>'Canceled')),
@ -613,11 +613,9 @@ class Mo extends CommonObject
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
$this->db->commit(); $this->db->commit();
return 1; return 1;
} else { } else {
setEventMessages($this->error, $this->errors, 'errors');
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@ -636,8 +634,9 @@ class Mo extends CommonObject
$role = ""; $role = "";
if ($this->status != self::STATUS_DRAFT) { if ($this->status != self::STATUS_DRAFT) {
$this->error = 'BadStatus'; //$this->error = 'BadStatusForUpdateProduction';
return -1; //return -1;
return 1;
} }
$this->db->begin(); $this->db->begin();

View File

@ -136,7 +136,7 @@ if (empty($reshook)) {
} }
$triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record
//Create MO with Childs // Create MO with Childs
if ($action == 'add' && empty($id) && !empty($TBomLineId)) { if ($action == 'add' && empty($id) && !empty($TBomLineId)) {
$noback = 1; $noback = 1;
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
@ -165,7 +165,7 @@ if (empty($reshook)) {
$res = $object->add_object_linked('mo', $mo_parent->id); $res = $object->add_object_linked('mo', $mo_parent->id);
} }
header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.$moline->fk_mo, 1)); header("Location: ".dol_buildpath('/mrp/mo_card.php?id='.((int) $moline->fk_mo), 1));
exit; exit;
} }

View File

@ -183,7 +183,7 @@ div#topmenu-quickadd-dropdown a::after, div#topmenu-bookmark-dropdown a::after {
border-top-left-radius: 0; border-top-left-radius: 0;
padding: 1px 0 0 0; padding: 1px 0 0 0;
border-top-width: 0; border-top-width: 0;
width: 300px; width: 360px;
} }
.topnav .user-menu .dropdown-menu { .topnav .user-menu .dropdown-menu {
top: 50px; top: 50px;
@ -522,6 +522,9 @@ div.quickaddblock:focus {
max-width: 360px; max-width: 360px;
} }
.side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu {
width: 300px;
}
.dropdown-menu { .dropdown-menu {
border: none; border: none;
-webkit-box-shadow: none; -webkit-box-shadow: none;

View File

@ -1000,18 +1000,18 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<td>'; print '<td>';
$valuetoshow = ''; $valuetoshow = '';
if (preg_match('/ldap/', $dolibarr_main_authentication)) { if (preg_match('/ldap/', $dolibarr_main_authentication)) {
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("PasswordOfUserInLDAP"); $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)';
} }
if (preg_match('/http/', $dolibarr_main_authentication)) { if (preg_match('/http/', $dolibarr_main_authentication)) {
$valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword"); $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword");
} }
if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { if (preg_match('/dolibarr/', $dolibarr_main_authentication)) {
if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
$valuetoshow .= ($valuetoshow ? ', ' : '').'<input type="hidden" name="password" value="'.dol_escape_htmltag($ldap_pass).'">'; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= ($valuetoshow ? ' + ' : '').'<input type="hidden" name="password" value="'.dol_escape_htmltag($ldap_pass).'">'; // Dolibarr password is preffiled with LDAP known password
$valuetoshow .= preg_replace('/./i', '*', $ldap_pass); $valuetoshow .= preg_replace('/./i', '*', $ldap_pass);
} else { } else {
// We do not use a field password but a field text to show new password to use. // We do not use a field password but a field text to show new password to use.
$valuetoshow .= ($valuetoshow ? ', ' : '').'<input maxsize="32" type="text" name="password" value="'.dol_escape_htmltag($password).'" autocomplete="new-password">'; $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').'<input maxsize="32" type="text" name="password" value="'.dol_escape_htmltag($password).'" autocomplete="new-password">';
} }
} }

View File

@ -127,7 +127,7 @@ if ($id > 0) {
$langs->load("errors"); $langs->load("errors");
print '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</span>'; print '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</span>';
} else { } else {
print ' &nbsp; &nbsp; '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc")); print '<br>'.$form->textwithpicto('<span class="opacitymedium">'.$langs->trans("KeepEmptyToUseDefault").'</span>:<br>'.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc"));
} }
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -154,7 +154,7 @@ if ($id > 0) {
print '<table class="border centpercent tableforfield">'; print '<table class="border centpercent tableforfield">';
if (!empty($user->admin)) { if (!empty($user->admin)) {
print '<tr><td class="titlefield">ClickToDial URL</td>'; print '<tr><td class="">ClickToDial URL</td>';
print '<td class="valeur">'; print '<td class="valeur">';
if (!empty($conf->global->CLICKTODIAL_URL)) { if (!empty($conf->global->CLICKTODIAL_URL)) {
$url = $conf->global->CLICKTODIAL_URL; $url = $conf->global->CLICKTODIAL_URL;
@ -172,7 +172,7 @@ if ($id > 0) {
print '</tr>'; print '</tr>';
} }
print '<tr><td class="titlefield">ClickToDial '.$langs->trans("IdPhoneCaller").'</td>'; print '<tr><td class="">ClickToDial '.$langs->trans("IdPhoneCaller").'</td>';
print '<td class="valeur">'.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste : '').'</td>'; print '<td class="valeur">'.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste : '').'</td>';
print "</tr>"; print "</tr>";

View File

@ -108,7 +108,7 @@ dol_banner_tab($object, 'id', $linkback, (!empty($user->rights->user->user->lire
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">'; print '<table class="border centpercent tableforfield">';
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
if (!empty($conf->mutlicompany->enabled)) { if (!empty($conf->mutlicompany->enabled)) {

View File

@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php';
* @access protected * @access protected
* @class DolibarrApiAccess {@requires user,external} * @class DolibarrApiAccess {@requires user,external}
*/ */
class ZapierApi extends DolibarrApi class Zapier extends DolibarrApi
{ {
/** /**
* @var array $FIELDS Mandatory fields, checked when create and update object * @var array $FIELDS Mandatory fields, checked when create and update object