diff --git a/dev/examples/zapier/triggers/action.js b/dev/examples/zapier/triggers/action.js index 0e152473869..86e4b747185 100644 --- a/dev/examples/zapier/triggers/action.js +++ b/dev/examples/zapier/triggers/action.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -84,7 +84,7 @@ const getFallbackRealAction = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/contact.js b/dev/examples/zapier/triggers/contact.js index 2ba3bd226f8..ef83970e0b5 100644 --- a/dev/examples/zapier/triggers/contact.js +++ b/dev/examples/zapier/triggers/contact.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -76,7 +76,7 @@ const getFallbackRealContact = (z, bundle) => { // const getModulesChoices = (z/*, bundle*/) => { // // For the test poll, you should get some real data, to aid the setup process. // 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)); @@ -94,7 +94,7 @@ const getFallbackRealContact = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/member.js b/dev/examples/zapier/triggers/member.js index 3385cdca625..68f80b30009 100644 --- a/dev/examples/zapier/triggers/member.js +++ b/dev/examples/zapier/triggers/member.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -76,7 +76,7 @@ const getFallbackRealMember = (z, bundle) => { // const getModulesChoices = (z/*, bundle*/) => { // // For the test poll, you should get some real data, to aid the setup process. // 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)); @@ -94,7 +94,7 @@ const getFallbackRealMember = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/order.js b/dev/examples/zapier/triggers/order.js index 061ce218d10..2265c4da288 100644 --- a/dev/examples/zapier/triggers/order.js +++ b/dev/examples/zapier/triggers/order.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -74,7 +74,7 @@ const getFallbackRealOrder = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/thirdparty.js b/dev/examples/zapier/triggers/thirdparty.js index 76194acbc9a..6c477b1174f 100644 --- a/dev/examples/zapier/triggers/thirdparty.js +++ b/dev/examples/zapier/triggers/thirdparty.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -83,7 +83,7 @@ const getFallbackRealThirdparty = (z, bundle) => { // const getModulesChoices = (z/*, bundle*/) => { // // For the test poll, you should get some real data, to aid the setup process. // 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)); @@ -102,7 +102,7 @@ const getFallbackRealThirdparty = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/ticket.js b/dev/examples/zapier/triggers/ticket.js index c642099bd55..ee5a3f8efd7 100644 --- a/dev/examples/zapier/triggers/ticket.js +++ b/dev/examples/zapier/triggers/ticket.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -76,7 +76,7 @@ const getFallbackRealTicket = (z, bundle) => { // const getModulesChoices = (z/*, bundle*/) => { // // For the test poll, you should get some real data, to aid the setup process. // 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)); @@ -97,7 +97,7 @@ const getFallbackRealTicket = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/dev/examples/zapier/triggers/user.js b/dev/examples/zapier/triggers/user.js index 92209bb8651..a706bb9a3d6 100644 --- a/dev/examples/zapier/triggers/user.js +++ b/dev/examples/zapier/triggers/user.js @@ -10,7 +10,7 @@ const subscribeHook = (z, bundle) => { 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 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 need to complete. You can also register middleware to control this. 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', }; @@ -73,7 +73,7 @@ const getFallbackRealUser = (z, bundle) => { // const getModulesChoices = (z/*, bundle*/) => { // // For the test poll, you should get some real data, to aid the setup process. // 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)); @@ -93,7 +93,7 @@ const getFallbackRealUser = (z, bundle) => { // // For the test poll, you should get some real data, to aid the setup process. // const module = bundle.inputData.module; // 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)); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 10e9b90ccd6..926f988567b 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -139,7 +139,7 @@ $formldap = new FormLdap($db); print '
'; print ''; -print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); +print dol_get_fiche_head($head, 'ldap', '', -1); print ''; @@ -245,7 +245,8 @@ print ''; print '
'.$langs->trans // Pass print ''; print '
'.$langs->trans("LDAPPassword").''; -print ''; +print ''; +print showValueWithClipboardCPButton(getDolGlobalString('LDAP_ADMIN_PASS'), 0, ' '); print ''.$langs->trans('Password').' (ex: secret)
'; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 0f8fec1cecc..6ee7b38e0b8 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -140,7 +140,7 @@ if (!function_exists("ldap_connect")) { 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 ''.$langs->trans("LDAPDescContact").'
'; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 23a4103bc75..5079d6d2d29 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -114,7 +114,7 @@ if (!function_exists("ldap_connect")) { 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 ''.$langs->trans("LDAPDescGroups").'
'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index b7783c99ca0..b9461430bf9 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -188,7 +188,7 @@ if (!function_exists("ldap_connect")) { print ''; print ''; -print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); +print dol_get_fiche_head($head, 'members', '', -1); print ''.$langs->trans("LDAPDescMembers").'
'; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index abb017ea037..7b3ac57192f 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -106,7 +106,7 @@ if (!function_exists("ldap_connect")) { 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 ''.$langs->trans("LDAPDescMembersTypes").'
'; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 2ec3ef169d8..ad84a5889ed 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -178,7 +178,7 @@ print ''; -print dol_get_fiche_head($head, 'users', $langs->trans("LDAPSetup"), -1); +print dol_get_fiche_head($head, 'users', '', -1); print ''.$langs->trans("LDAPDescUsers").'
'; print '
'; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 80efc0a9891..86c76ca1604 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -411,7 +411,7 @@ foreach ($configfileparameters as $key => $value) { } elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/', ${$newkey})) { print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); } elseif ($newkey == 'dolibarr_main_document_root_alt') { - $tmparray = explode(',', ${$newkey}); + $tmparray = explode(',', $dolibarr_main_document_root_alt); $i = 0; foreach ($tmparray as $value2) { if ($i > 0) { @@ -429,7 +429,7 @@ foreach ($configfileparameters as $key => $value) { 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 if (empty($dolibarr_main_prod)) { - print ''; + print ''; print showValueWithClipboardCPButton($valuetoshow, 0, '********'); } else { print '**********'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 5cde78cd09f..3b75994ef00 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1283,9 +1283,9 @@ if ($resql) { if ($massaction == 'createbills') { print ''; - print ''; + print '
'; print ''; - print ''; print ''; print '
'; + print ''; print $langs->trans('DateInvoice'); print ''; @@ -1320,12 +1320,11 @@ if ($resql) { print '
'; - print '
'; print '
'; print ' '; print ''; print '
'; - print '
'; + print '

'; } if ($sall) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 0fe82b9e7f1..072aa9e67b2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4453,7 +4453,7 @@ if ($action == 'create') { if ($result > 0) { print ' '; $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); print $s; print '
'; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 78a2616058a..6401437ac15 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -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 -if ($action == "update_extras" && !empty($permissiontoadd)) { +if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) { $object->fetch(GETPOST('id', 'int')); $attributekey = GETPOST('attribute', 'alpha'); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 50ce856dec2..6c7f60fc98f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -211,7 +211,21 @@ class Form // Check parameters 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 diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 675300169e4..80cd8bb79e2 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1782,6 +1782,8 @@ class FormFile $result = 0; if (is_object($object_instance)) { + $object_instance->id = 0; + $object_instance->ref = ''; if ($id) { $result = $object_instance->fetch($id); } else { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 0ad7f6d6eb6..3be3c4c24f7 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2970,7 +2970,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $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 if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 11cbcad7b85..498e587a328 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -95,7 +95,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = // Edit class files $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 (is_array($addfieldentry) && count($addfieldentry)) { $name = $addfieldentry['name']; @@ -133,6 +133,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = if (!empty($val['noteditable'])) { $texttoinsert .= " 'noteditable'=>'".$val['noteditable']."',"; } + if (!empty($val['alwayseditable'])) { + $texttoinsert .= " 'alwayseditable'=>'".$val['alwayseditable']."',"; + } if (!empty($val['default']) || (isset($val['default']) && $val['default'] === '0')) { $texttoinsert .= " 'default'=>'".$val['default']."',"; } @@ -189,6 +192,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } $texttoinsert .= "),\n"; + //print $texttoinsert; } } @@ -212,14 +216,16 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES'; - //print($texttoinsert);exit; + //print($texttoinsert); $contentclass = preg_replace('/\/\/ BEGIN MODULEBUILDER PROPERTIES.*END MODULEBUILDER PROPERTIES/ims', $texttoinsert, $contentclass); + //print $contentclass; dol_mkdir(dirname($pathoffiletoedittarget)); //file_put_contents($pathoffiletoedittmp, $contentclass); $result = file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass); + if ($result) { @chmod($pathoffiletoedittarget, octdec($newmask)); } else { diff --git a/htdocs/core/tpl/commonfields_view.tpl.php b/htdocs/core/tpl/commonfields_view.tpl.php index 42ead1573f4..9b7e3cd4df1 100644 --- a/htdocs/core/tpl/commonfields_view.tpl.php +++ b/htdocs/core/tpl/commonfields_view.tpl.php @@ -64,15 +64,23 @@ foreach ($object->fields as $key => $val) { print ' tdtop'; } print '">'; + + $labeltoshow = ''; 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 { if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 1) { - print showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($val['label'])); + $labeltoshow .= showValueWithClipboardCPButton($value, 0, $langs->transnoentitiesnoconv($val['label'])); } 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 ''; print ''; - if (in_array($val['type'], array('text', 'html'))) { - print '
'; - } - if ($key == 'lang') { - $langs->load("languages"); - $labellang = ($value ? $langs->trans('Language_'.$value) : ''); - print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); - print $labellang; - } else { - if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 2) { - $out = $object->showOutputField($val, $key, $value, '', '', '', 0); - print showValueWithClipboardCPButton($out, 0, $out); - } else { - print $object->showOutputField($val, $key, $value, '', '', '', 0); + if (empty($val['alwayseditable'])) { + if (in_array($val['type'], array('text', 'html'))) { + print '
'; } - } - //print dol_escape_htmltag($object->$key, 1, 1); - if (in_array($val['type'], array('text', 'html'))) { - print '
'; + if ($key == 'lang') { + $langs->load("languages"); + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); + print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); + print $labellang; + } else { + if (isset($val['copytoclipboard']) && $val['copytoclipboard'] == 2) { + $out = $object->showOutputField($val, $key, $value, '', '', '', 0); + print showValueWithClipboardCPButton($out, 0, $out); + } else { + print $object->showOutputField($val, $key, $value, '', '', '', 0); + } + } + //print dol_escape_htmltag($object->$key, 1, 1); + if (in_array($val['type'], array('text', 'html'))) { + print '
'; + } + } else { + print $form->editfieldval($labeltoshow, $key, $value, $object, 1, $val['type']); } print ''; print ''; @@ -144,10 +156,20 @@ foreach ($object->fields as $key => $val) { $rightpart .= ' tdtop'; } $rightpart.= '">'; + $labeltoshow = ''; 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 { - $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 .= ''; $rightpart .= ''; - if (in_array($val['type'], array('text', 'html'))) { - $rightpart .= '
'; - } - $rightpart .= $object->showOutputField($val, $key, $value, '', '', '', 0); - //$rightpart .= dol_escape_htmltag($object->$key, 1, 1); - if (in_array($val['type'], array('text', 'html'))) { - $rightpart .= '
'; + + if (empty($val['alwayseditable'])) { + if (in_array($val['type'], array('text', 'html'))) { + $rightpart .= '
'; + } + if ($key == 'lang') { + $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'))) { + $rightpart .= '
'; + } + } else { + $rightpart .= $form->editfieldval($labeltoshow, $key, $value, $object, 1, $val['type']); } + $rightpart .= ''; $rightpart .= ''; } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index e53220e661d..d0e32e480d9 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -294,6 +294,7 @@ ErrorFailedToLoadThirdParty=Failed to find/load thirdparty from id=%s, email=%s, 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. ErrorCharPlusNotSupportedByImapForSearch=IMAP search is not able to search into sender or recipient for a string containing the character + +ErrorTableNotFound=Table %s not found # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/en_US/modulebuilder.lang b/htdocs/langs/en_US/modulebuilder.lang index c7ca26ee149..0e11bef2bf1 100644 --- a/htdocs/langs/en_US/modulebuilder.lang +++ b/htdocs/langs/en_US/modulebuilder.lang @@ -133,11 +133,11 @@ UseSpecificEditorURL = Use a specific editor URL UseSpecificFamily = Use a specific family UseSpecificAuthor = Use a specific author 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 -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. -ShowOnCombobox=Show value into combobox +ShowOnCombobox=Show value into combo boxes KeyForTooltip=Key for tooltip CSSClass=CSS for edit/create form CSSViewClass=CSS for read form @@ -156,4 +156,7 @@ LinkToParentMenu=Parent menu (fk_xxxxmenu) ListOfTabsEntries=List of tab entries TabsDefDesc=Define here the tabs provided by your module TabsDefDescTooltip=The tabs provided by your module/application are defined into the array $this->tabs into the module descriptor file. You can edit manually this file or use the embedded editor. -BadValueForType=Bad value for type %s \ No newline at end of file +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. diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 8441dd530ee..1c30d709576 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -202,10 +202,10 @@ foreach ($dirsrootforscan as $dirread) { } $textforlistofdirs .= ''.$dirread.''; 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")); } - if (!empty($conf->global->MODULEBUILDER_ADD_DOCUMENT_ROOT)) { + if (getDolGlobalString('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.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_dir($destdir.'/class', 1); @@ -895,237 +894,7 @@ if ($dirins && $action == 'confirm_removefile' && !empty($module)) { } } - -// Build the $fields array from SQL table (initfromtablename) -if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', 'alpha')) { - $tablename = GETPOST('initfromtablename', 'alpha'); - $_results = $db->DDLDescTable($tablename); - if (empty($_results)) { - setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors'); - } else { - /** - * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') - * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" - * 'label' the translation key. - * 'picto' is code of a picto to show before value in forms - * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) - * 'position' is the sort order of field. - * '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) - * 'noteditable' says if field is not editable (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. - * '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_...). - * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. - * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) - * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' - * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. - * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record - * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. - * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' - * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. - * 'comment' is not used. You can store here any text of your choice. It is not used by application. - * 'validate' is 1 if need to validate with $this->validateField() - * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) - */ - - /*public $fields=array( - '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'), - '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'), - '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'), - 'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), - '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'=>1, 'position'=>501), - //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), - //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - '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"; - $string .= "
"; - $i = 10; - while ($obj = $db->fetch_object($_results)) { - // fieldname - $fieldname = $obj->Field; - // type - $type = $obj->Type; - if ($type == 'int(11)') { - $type = 'integer'; - } - if ($type == 'float') { - $type = 'real'; - } - if (strstr($type, 'tinyint')) { - $type = 'integer'; - } - if ($obj->Field == 'fk_soc') { - $type = 'integer:Societe:societe/class/societe.class.php'; - } - if (preg_match('/^fk_proj/', $obj->Field)) { - $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1'; - } - if (preg_match('/^fk_prod/', $obj->Field)) { - $type = 'integer:Product:product/class/product.class.php:1'; - } - if ($obj->Field == 'fk_warehouse') { - $type = 'integer:Entrepot:product/stock/class/entrepot.class.php'; - } - if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) { - $type = 'integer:User:user/class/user.class.php'; - } - - // notnull - $notnull = ($obj->Null == 'YES' ? 0 : 1); - if ($fieldname == 'fk_user_modif') { - $notnull = -1; - } - // label - $label = preg_replace('/_/', '', ucfirst($fieldname)); - if ($fieldname == 'rowid') { - $label = 'TechnicalID'; - } - if ($fieldname == 'import_key') { - $label = 'ImportId'; - } - if ($fieldname == 'fk_soc') { - $label = 'ThirdParty'; - } - if ($fieldname == 'tms') { - $label = 'DateModification'; - } - if ($fieldname == 'datec') { - $label = 'DateCreation'; - } - if ($fieldname == 'date_valid') { - $label = 'DateValidation'; - } - if ($fieldname == 'datev') { - $label = 'DateValidation'; - } - if ($fieldname == 'note_private') { - $label = 'NotePublic'; - } - if ($fieldname == 'note_public') { - $label = 'NotePrivate'; - } - if ($fieldname == 'fk_user_creat') { - $label = 'UserAuthor'; - } - if ($fieldname == 'fk_user_modif') { - $label = 'UserModif'; - } - if ($fieldname == 'fk_user_valid') { - $label = 'UserValidation'; - } - // visible - $visible = -1; - if ($fieldname == 'entity') { - $visible = -2; - } - if ($fieldname == 'import_key') { - $visible = -2; - } - if ($fieldname == 'fk_user_creat') { - $visible = -2; - } - if ($fieldname == 'fk_user_modif') { - $visible = -2; - } - if (in_array($fieldname, array('ref_ext', 'model_pdf', 'note_public', 'note_private'))) { - $visible = 0; - } - // enabled - $enabled = 1; - // default - $default = ''; - if ($fieldname == 'entity') { - $default = 1; - } - // position - $position = $i; - if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) { - $position = 500; - } - if ($fieldname == 'import_key') { - $position = 900; - } - // index - $index = 0; - if ($fieldname == 'entity') { - $index = 1; - } - // css, cssview, csslist - $css = ''; - $cssview = ''; - $csslist = ''; - if (preg_match('/^fk_/', $fieldname)) { - $css = 'maxwidth500 widthcentpercentminusxx'; - } - if ($fieldname == 'label') { - $css = 'minwidth300'; - $cssview = 'wordbreak'; - } - if (in_array($fieldname, array('note_public', 'note_private'))) { - $cssview = 'wordbreak'; - } - - // type - $picto = $obj->Picto; - if ($obj->Field == 'fk_soc') { - $picto = 'company'; - } - if (preg_match('/^fk_proj/', $obj->Field)) { - $picto = 'project'; - } - - // Build the property string - $string .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',"; - if ($default != '') { - $string .= " 'default'=>".$default.","; - } - $string .= " 'enabled'=>".$enabled.","; - $string .= " 'visible'=>".$visible; - if ($notnull) { - $string .= ", 'notnull'=>".$notnull; - } - if ($fieldname == 'ref' || $fieldname == 'code') { - $string .= ", 'showoncombobox'=>1"; - } - $string .= ", 'position'=>".$position; - if ($index) { - $string .= ", 'index'=>".$index; - } - if ($picto) { - $string .= ", 'picto'=>'".$picto."'"; - } - if ($css) { - $string .= ", 'css'=>".$css; - } - if ($cssview) { - $string .= ", 'cssview'=>".$cssview; - } - if ($csslist) { - $string .= ", 'csslist'=>".$csslist; - } - $string .= "),\n"; - $string .= "
"; - $i += 5; - } - $string .= ');'."\n"; - $string .= "
"; - print $string; - exit; - } -} - +// Init an object if ($dirins && $action == 'initobject' && $module && $objectname) { $objectname = ucfirst($objectname); @@ -1169,6 +938,247 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { } } + // If we must reuse a table for properties, define $stringforproperties + $stringforproperties = ''; + $tablename = GETPOST('initfromtablename', 'alpha'); + if ($tablename) { + $_results = $db->DDLDescTable($tablename); + if (empty($_results)) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors'); + } else { + /** + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or 'isModEnabled("multicurrency")' ...) + * 'position' is the sort order of field. + * '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) + * '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. + * '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_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage) + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar' + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * 'validate' is 1 if need to validate with $this->validateField() + * 'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value) + */ + + /*public $fields=array( + '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'), + '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', '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'), + '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), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), + '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'=>1, 'position'=>501), + //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), + //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), + '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')), + );*/ + + $stringforproperties = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; + $stringforproperties .= 'public $fields=array('."\n"; + $i = 10; + while ($obj = $db->fetch_object($_results)) { + // fieldname + $fieldname = $obj->Field; + // type + $type = $obj->Type; + if ($type == 'int(11)') { + $type = 'integer'; + } + if ($type == 'float') { + $type = 'real'; + } + if (strstr($type, 'tinyint')) { + $type = 'integer'; + } + if ($obj->Field == 'fk_soc') { + $type = 'integer:Societe:societe/class/societe.class.php'; + } + if (preg_match('/^fk_proj/', $obj->Field)) { + $type = 'integer:Project:projet/class/project.class.php:1:fk_statut=1'; + } + if (preg_match('/^fk_prod/', $obj->Field)) { + $type = 'integer:Product:product/class/product.class.php:1'; + } + if ($obj->Field == 'fk_warehouse') { + $type = 'integer:Entrepot:product/stock/class/entrepot.class.php'; + } + if (preg_match('/^(fk_user|fk_commercial)/', $obj->Field)) { + $type = 'integer:User:user/class/user.class.php'; + } + + // notnull + $notnull = ($obj->Null == 'YES' ? 0 : 1); + if ($fieldname == 'fk_user_modif') { + $notnull = -1; + } + // label + $label = preg_replace('/_/', '', ucfirst($fieldname)); + if ($fieldname == 'rowid') { + $label = 'TechnicalID'; + } + if ($fieldname == 'import_key') { + $label = 'ImportId'; + } + if ($fieldname == 'fk_soc') { + $label = 'ThirdParty'; + } + if ($fieldname == 'tms') { + $label = 'DateModification'; + } + if ($fieldname == 'datec') { + $label = 'DateCreation'; + } + if ($fieldname == 'date_valid') { + $label = 'DateValidation'; + } + if ($fieldname == 'datev') { + $label = 'DateValidation'; + } + if ($fieldname == 'note_private') { + $label = 'NotePublic'; + } + if ($fieldname == 'note_public') { + $label = 'NotePrivate'; + } + if ($fieldname == 'fk_user_creat') { + $label = 'UserAuthor'; + } + if ($fieldname == 'fk_user_modif') { + $label = 'UserModif'; + } + if ($fieldname == 'fk_user_valid') { + $label = 'UserValidation'; + } + // visible + $visible = -1; + if ($fieldname == 'entity') { + $visible = -2; + } + if ($fieldname == 'import_key') { + $visible = -2; + } + if ($fieldname == 'fk_user_creat') { + $visible = -2; + } + if ($fieldname == 'fk_user_modif') { + $visible = -2; + } + if (in_array($fieldname, array('ref_ext', 'model_pdf', 'note_public', 'note_private'))) { + $visible = 0; + } + // enabled + $enabled = 1; + // default + $default = ''; + if ($fieldname == 'entity') { + $default = 1; + } + // position + $position = $i; + if (in_array($fieldname, array('status', 'statut', 'fk_status', 'fk_statut'))) { + $position = 500; + } + if ($fieldname == 'import_key') { + $position = 900; + } + // $alwayseditable + if ($fieldname == 'label') { + $alwayseditable = 1; + } + // index + $index = 0; + if ($fieldname == 'entity') { + $index = 1; + } + // css, cssview, csslist + $css = ''; + $cssview = ''; + $csslist = ''; + if (preg_match('/^fk_/', $fieldname)) { + $css = 'maxwidth500 widthcentpercentminusxx'; + } + if ($fieldname == 'label') { + $css = 'minwidth300'; + $cssview = 'wordbreak'; + } + if (in_array($fieldname, array('note_public', 'note_private'))) { + $cssview = 'wordbreak'; + } + if (in_array($fieldname, array('ref', 'label')) || preg_match('/integer:/', $type)) { + $csslist = 'tdoverflowmax150'; + } + + // type + $picto = $obj->Picto; + if ($obj->Field == 'fk_soc') { + $picto = 'company'; + } + if (preg_match('/^fk_proj/', $obj->Field)) { + $picto = 'project'; + } + + // Build the property string + $stringforproperties .= "'".$obj->Field."'=>array('type'=>'".$type."', 'label'=>'".$label."',"; + if ($default != '') { + $stringforproperties .= " 'default'=>".$default.","; + } + $stringforproperties .= " 'enabled'=>".$enabled.","; + $stringforproperties .= " 'visible'=>".$visible; + if ($notnull) { + $stringforproperties .= ", 'notnull'=>".$notnull; + } + if ($alwayseditable) { + $stringforproperties .= ", 'alwayseditable'=>1"; + } + if ($fieldname == 'ref' || $fieldname == 'code') { + $stringforproperties .= ", 'showoncombobox'=>1"; + } + $stringforproperties .= ", 'position'=>".$position; + if ($index) { + $stringforproperties .= ", 'index'=>".$index; + } + if ($picto) { + $stringforproperties .= ", 'picto'=>'".$picto."'"; + } + if ($css) { + $stringforproperties .= ", 'css'=>'".$css."'"; + } + if ($cssview) { + $stringforproperties .= ", 'cssview'=>'".$cssview."'"; + } + if ($csslist) { + $stringforproperties .= ", 'csslist'=>'".$csslist."'"; + } + $stringforproperties .= "),\n"; + $i += 5; + } + $stringforproperties .= ');'."\n"; + $stringforproperties .= '// END MODULEBUILDER PROPERTIES'."\n"; + } + } + if (!$error) { // Copy some files $filetogenerate = array( @@ -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.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql', //'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/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php', ); @@ -1210,20 +1219,33 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { ); } - foreach ($filetogenerate as $srcfile => $destfile) { - $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); - if ($result <= 0) { - if ($result < 0) { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); - } else { - // $result == 0 - setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); + + if (!$error) { + foreach ($filetogenerate as $srcfile => $destfile) { + $result = dol_copy($srcdir.'/'.$srcfile, $destdir.'/'.$destfile, $newmask, 0); + if ($result <= 0) { + if ($result < 0) { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); + } else { + // $result == 0 + setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); + } } } } + // 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' if (GETPOST('includerefgeneration', 'aZ09')) { // Replace 'visible'=>1, 'noteditable'=>0, 'default'=>'' @@ -1386,14 +1408,19 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { if (!$error) { // Edit the class file to write properties $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++; } } if (!$error) { // Edit sql with new properties $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); - if ($result < 0) { + + if ($result <= 0) { + setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null); $error++; } } @@ -1401,6 +1428,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { if (!$error) { setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); $tabobj = $objectname; + } else { + $tabobj = 'newobject'; } } @@ -1485,25 +1514,26 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) { $addfieldentry = array( - 'name'=>GETPOST('propname', 'aZ09'), - 'label'=>GETPOST('proplabel', 'alpha'), - 'type'=>GETPOST('proptype', 'alpha'), - 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' - 'visible'=>GETPOST('propvisible', 'int'), - 'enabled'=>GETPOST('propenabled', 'int'), - 'position'=>GETPOST('propposition', 'int'), - 'notnull'=>GETPOST('propnotnull', 'int'), - 'index'=>GETPOST('propindex', 'int'), - 'searchall'=>GETPOST('propsearchall', 'int'), - 'isameasure'=>GETPOST('propisameasure', 'int'), - 'comment'=>GETPOST('propcomment', 'alpha'), - 'help'=>GETPOST('prophelp', 'alpha'), - 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example - 'cssview'=>GETPOST('propcssview', 'alpha'), - 'csslist'=>GETPOST('propcsslist', 'alpha'), - 'default'=>GETPOST('propdefault', 'restricthtml'), - 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), - 'validate' => GETPOST('propvalidate', 'int') + 'name'=>GETPOST('propname', 'aZ09'), + 'label'=>GETPOST('proplabel', 'alpha'), + 'type'=>GETPOST('proptype', 'alpha'), + 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'restricthtml'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' + 'visible'=>GETPOST('propvisible', 'int'), + 'enabled'=>GETPOST('propenabled', 'int'), + 'position'=>GETPOST('propposition', 'int'), + 'notnull'=>GETPOST('propnotnull', 'int'), + 'index'=>GETPOST('propindex', 'int'), + 'searchall'=>GETPOST('propsearchall', 'int'), + 'isameasure'=>GETPOST('propisameasure', 'int'), + 'comment'=>GETPOST('propcomment', 'alpha'), + 'help'=>GETPOST('prophelp', 'alpha'), + 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example + 'cssview'=>GETPOST('propcssview', 'alpha'), + 'csslist'=>GETPOST('propcsslist', 'alpha'), + 'default'=>GETPOST('propdefault', 'restricthtml'), + 'noteditable'=>intval(GETPOST('propnoteditable', 'int')), + 'alwayseditable'=>intval(GETPOST('propalwayseditable', '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); if (is_numeric($object) && $object <= 0) { + $pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php'; + setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors'); $error++; } } @@ -1537,6 +1569,7 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) && $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object, $moduletype); if ($result <= 0) { + setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors'); $error++; } } @@ -1568,7 +1601,10 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) { // Edit the class file to write properties if (!$error) { $object = rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, array(), $propertykey); + if (is_numeric($object) && $object <= 0) { + $pathoffiletoeditsrc = $destdir.'/class/'.strtolower($objectname).'.class.php'; + setEventMessages($langs->trans('ErrorFailToCreateFile', $pathoffiletoeditsrc), null, 'errors'); $error++; } } @@ -1576,7 +1612,9 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) { // Edit sql with new properties if (!$error) { $result = rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); + if ($result <= 0) { + setEventMessages($langs->trans('ErrorFailToCreateFile', '.sql'), null, 'errors'); $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_extrafields.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.key.sql', '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/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', @@ -1934,7 +1971,7 @@ if ($message) { } //print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
'; -$infomodulesfound = '
'.$form->textwithpicto(''.$langs->trans("ModuleBuilderDesc3", count($listofmodules)).'', $langs->trans("ModuleBuilderDesc4", $FILEFLAG).'
'.$textforlistofdirs).'
'; +$infomodulesfound = '
'.$form->textwithpicto('', $langs->trans("ModuleBuilderDesc3", count($listofmodules)).'

'.$langs->trans("ModuleBuilderDesc4", $FILEFLAG).'
'.$textforlistofdirs).'
'; // Load module descriptor @@ -2013,8 +2050,10 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { } $urltomodulesetup = ''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; - if (!empty($conf->global->$const_name)) { // If module is already activated - $linktoenabledisable .= ''; + + // Define $linktoenabledisable to show after module title + if (isModEnabled($modulelowercase)) { // If module is already activated + $linktoenabledisable .= ''; $linktoenabledisable .= img_picto($langs->trans("Activated"), 'switch_on', '', false, 0, 0, '', '', 1); $linktoenabledisable .= ''; @@ -2074,7 +2113,7 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { } $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'; $h++; @@ -2271,6 +2310,8 @@ if ($module == 'initmodule') { $head2[$h][2] = 'buildpackage'; $h++; + $MAXTABFOROBJECT = 15; + print ''; // Note module is inside $dirread @@ -2282,7 +2323,7 @@ if ($module == 'initmodule') { $pathtochangelog = $modulelowercase.'/ChangeLog.md'; 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 ''.$langs->trans("ModuleBuilderDesc".$tab).''; $infoonmodulepath = ''; @@ -2442,7 +2483,7 @@ if ($module == 'initmodule') { print '
'; } } 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') { @@ -2563,7 +2604,7 @@ if ($module == 'initmodule') { if ($h > 1) { $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'; $h++; } @@ -2589,12 +2630,38 @@ if ($module == 'initmodule') { print ''.$langs->trans("EnterNameOfObjectDesc").'

'; - print '
'; - print '
'; + print '
'; + + print '
'; + print ''.$langs->trans("ObjectKey").'   '; + print '
'; + print '
'; + print '
'; + + print '
'; + print ''.$langs->trans("Picto").'   '; + print '
'; + print ''; + print $form->textwithpicto('', $langs->trans("Example").': fa-generic, fa-globe, ... any font awesome code.
Advanced syntax is fa-fakey[_faprefix[_facolor[_fasize]]]'); + print '
'; + + print '
'; + print ''.$langs->trans("DefinePropertiesFromExistingTable").'   '; + print '
'; + print ''; + print $form->textwithpicto('', $langs->trans("DefinePropertiesFromExistingTableDesc").'
'.$langs->trans("DefinePropertiesFromExistingTableDesc2")); + print '
'; + + print '
'; + + print '
'; + print '
'; print '
'; - print ''; + print '
'; + print ''; print '
'; print '
'; + /* print '
'; print ''.$langs->trans("or").''; print '
'; @@ -2604,6 +2671,7 @@ if ($module == 'initmodule') { print ''; print ''; print '
'; + */ print ''; } elseif ($tabobj == 'deleteobject') { @@ -2665,7 +2733,7 @@ if ($module == 'initmodule') { } if (class_exists($tabobj)) { try { - $tmpobjet = @new $tabobj($db); + $tmpobject = @new $tabobj($db); } catch (Exception $e) { dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); } @@ -2738,13 +2806,22 @@ if ($module == 'initmodule') { $urlofcard = dol_buildpath('/'.$pathtocard, 1); - - - + print ''; print '
'; // Main DAO class file print ' '.$langs->trans("ClassFile").' : '.(dol_is_file($realpathtoclass) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoclass).(dol_is_file($realpathtoclass) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + // Image + if (dol_is_file($realpathtopicto)) { + print ' '.$langs->trans("Image").' : '.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '').''; + //print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } elseif (!empty($tmpobject)) { + print ' '.$langs->trans("Image").' : '.img_picto('', $tmpobject->picto, 'class="pictofixedwidth"'); + print '
'; + } + // API file print '
'; print ' '.$langs->trans("ApiClassFile").' : '.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'').''; @@ -2781,9 +2858,6 @@ if ($module == 'initmodule') { print ' '.$langs->trans("PageForObjLib").' : '.(dol_is_file($realpathtoobjlib) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoobjlib).(dol_is_file($realpathtoobjlib) ? '' : '').''; print ' '.img_picto($langs->trans("Edit"), 'edit').''; print '
'; - print ' '.$langs->trans("Image").' : '.(dol_is_file($realpathtopicto) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtopicto).(dol_is_file($realpathtopicto) ? '' : '').''; - //print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; print '
'; print ' '.$langs->trans("SqlFile").' : '.(dol_is_file($realpathtosql) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtosql).(dol_is_file($realpathtosql) ? '' : '').''; @@ -2871,7 +2945,7 @@ if ($module == 'initmodule') { print '


'; - if (!empty($tmpobjet)) { + if (!empty($tmpobject)) { $reflector = new ReflectionClass($tabobj); $reflectorproperties = $reflector->getProperties(); // Can also use get_object_vars $reflectorpropdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars @@ -2911,6 +2985,7 @@ if ($module == 'initmodule') { print ''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).''; print ''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).''; print ''.$langs->trans("NotEditable").''; + print ''.$langs->trans("AlwaysEditable").''; print ''.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).''; print ''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).''; print ''.$langs->trans("CSSClass").''; @@ -2924,9 +2999,9 @@ if ($module == 'initmodule') { print ''; print ''; - // 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. - //$properties = dol_sort_array($tmpobjet->fields, 'position'); + //$properties = dol_sort_array($tmpobject->fields, 'position'); $properties = dol_sort_array($reflectorpropdefault['fields'], 'position'); if (!empty($properties)) { @@ -2944,6 +3019,7 @@ if ($module == 'initmodule') { print ''; print ''; print ''; + print ''; print ''; print ''; print ''; @@ -2965,7 +3041,7 @@ if ($module == 'initmodule') { { $propname=$propval->getName(); $comment=$propval->getDocComment(); - $type=gettype($tmpobjet->$propname); + $type=gettype($tmpobject->$propname); $default=$propdefault[$propname]; // Discard generic properties 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']; $propvisible = $propval['visible']; $propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0; + $propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0; $propsearchall = !empty($propval['searchall'])?$propval['searchall']:0; $propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0; $propcss = !empty($propval['css'])?$propval['css']:''; @@ -3044,6 +3121,9 @@ if ($module == 'initmodule') { print ''; print ''; print ''; + print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -3110,6 +3190,9 @@ if ($module == 'initmodule') { print $propnoteditable ? dol_escape_htmltag($propnoteditable) : ''; print ''; print ''; + print $propalwayseditable ? dol_escape_htmltag($propalwayseditable) : ''; + print ''; + print ''; print $propsearchall ? '1' : ''; print ''; print ''; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 8265bbadaf8..b30391becc7 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -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). * '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) + * '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. * '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_...). @@ -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'), '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), - '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), '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_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_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', 'csslist'=>'tdoverflowmax150'), '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_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62, 'validate'=>1, 'cssview'=>'wordbreak'), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), //'date_validation ' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - '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_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), + '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, 'csslist'=>'tdoverflowmax150'), //'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), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), diff --git a/htdocs/modulebuilder/template/img/README.md b/htdocs/modulebuilder/template/img/README.md new file mode 100644 index 00000000000..2fcb4afc087 --- /dev/null +++ b/htdocs/modulebuilder/template/img/README.md @@ -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) + diff --git a/htdocs/modulebuilder/template/img/object_mymodule.png b/htdocs/modulebuilder/template/img/object_mymodule.png deleted file mode 100644 index b421fe3c9e0..00000000000 Binary files a/htdocs/modulebuilder/template/img/object_mymodule.png and /dev/null differ diff --git a/htdocs/modulebuilder/template/img/object_mymodule_over.png b/htdocs/modulebuilder/template/img/object_mymodule_over.png deleted file mode 100644 index 7831c3025d7..00000000000 Binary files a/htdocs/modulebuilder/template/img/object_mymodule_over.png and /dev/null differ diff --git a/htdocs/modulebuilder/template/img/object_myobject.png b/htdocs/modulebuilder/template/img/object_myobject.png deleted file mode 100644 index b421fe3c9e0..00000000000 Binary files a/htdocs/modulebuilder/template/img/object_myobject.png and /dev/null differ diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index b58c7169f25..8624713c689 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -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'), '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), - '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_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'), @@ -116,8 +116,8 @@ class Mo extends CommonObject '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_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_end_planned' => array('type'=>'datetime', 'label'=>'DateEndPlannedMo', 'enabled'=>1, 'visible'=>1, 'position'=>56, 'notnull'=>-1, 'index'=>1,), + '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, 'alwayseditable'=>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), '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) { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); $this->db->commit(); return 1; } else { - setEventMessages($this->error, $this->errors, 'errors'); $this->db->rollback(); return -1; } @@ -636,8 +634,9 @@ class Mo extends CommonObject $role = ""; if ($this->status != self::STATUS_DRAFT) { - $this->error = 'BadStatus'; - return -1; + //$this->error = 'BadStatusForUpdateProduction'; + //return -1; + return 1; } $this->db->begin(); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 373dd7b6410..fde5811547a 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -136,7 +136,7 @@ if (empty($reshook)) { } $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)) { $noback = 1; 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); } - 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; } diff --git a/htdocs/theme/eldy/dropdown.inc.php b/htdocs/theme/eldy/dropdown.inc.php index bfde88726e9..b3f91901575 100644 --- a/htdocs/theme/eldy/dropdown.inc.php +++ b/htdocs/theme/eldy/dropdown.inc.php @@ -183,7 +183,7 @@ div#topmenu-quickadd-dropdown a::after, div#topmenu-bookmark-dropdown a::after { border-top-left-radius: 0; padding: 1px 0 0 0; border-top-width: 0; - width: 300px; + width: 360px; } .topnav .user-menu .dropdown-menu { top: 50px; @@ -522,6 +522,9 @@ div.quickaddblock:focus { max-width: 360px; } + .side-nav-vert .user-menu .dropdown-menu, .topnav .user-menu .dropdown-menu { + width: 300px; + } .dropdown-menu { border: none; -webkit-box-shadow: none; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index cf30cc2bb99..9ba58cd069b 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1000,18 +1000,18 @@ if ($action == 'create' || $action == 'adduserldap') { print ''; $valuetoshow = ''; 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)) { - $valuetoshow .= ($valuetoshow ? ', ' : '').$langs->trans("HTTPBasicPassword"); + $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword"); } 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 - $valuetoshow .= ($valuetoshow ? ', ' : '').''; // Dolibarr password is preffiled with LDAP known password + $valuetoshow .= ($valuetoshow ? ' + ' : '').''; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } else { // We do not use a field password but a field text to show new password to use. - $valuetoshow .= ($valuetoshow ? ', ' : '').''; + $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; } } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index 2302b6e7681..562ab081ab8 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -127,7 +127,7 @@ if ($id > 0) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } else { - print '     '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc")); + print '
'.$form->textwithpicto(''.$langs->trans("KeepEmptyToUseDefault").':
'.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc")); } print ''; print ''; @@ -154,7 +154,7 @@ if ($id > 0) { print ''; if (!empty($user->admin)) { - print ''; + print ''; print ''; } - print ''; + print ''; print ''; print ""; diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index dd12669980a..d93ec7851e4 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -108,7 +108,7 @@ dol_banner_tab($object, 'id', $linkback, (!empty($user->rights->user->user->lire print '
'; print '
'; -print '
ClickToDial URL
ClickToDial URL'; if (!empty($conf->global->CLICKTODIAL_URL)) { $url = $conf->global->CLICKTODIAL_URL; @@ -172,7 +172,7 @@ if ($id > 0) { print '
ClickToDial '.$langs->trans("IdPhoneCaller").'
ClickToDial '.$langs->trans("IdPhoneCaller").''.(!empty($object->clicktodial_poste) ? $object->clicktodial_poste : '').'
'; +print '
'; // 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)) { diff --git a/htdocs/zapier/class/api_zapier.class.php b/htdocs/zapier/class/api_zapier.class.php index f065a165a54..56ab923435d 100644 --- a/htdocs/zapier/class/api_zapier.class.php +++ b/htdocs/zapier/class/api_zapier.class.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/zapier/class/hook.class.php'; * @access protected * @class DolibarrApiAccess {@requires user,external} */ -class ZapierApi extends DolibarrApi +class Zapier extends DolibarrApi { /** * @var array $FIELDS Mandatory fields, checked when create and update object