From f59d87f06dd3deb4d53c735701e967d3909e2074 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Fri, 6 Oct 2017 00:42:32 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- .../accountancy/journal/purchasesjournal.php | 6 +- htdocs/accountancy/journal/sellsjournal.php | 8 +- htdocs/api/class/api_documents.class.php | 192 +- htdocs/modulebuilder/index.php | 2882 ++++++++--------- 4 files changed, 1544 insertions(+), 1544 deletions(-) diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 8a1c704f87b..0f9081bdc98 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -100,9 +100,9 @@ $sql .= " WHERE f.fk_statut > 0"; // TODO Facture annulée ? $sql .= " AND fd.fk_code_ventilation > 0"; $sql .= " AND f.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")"; + $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_SITUATION . ")"; } else { - $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")"; + $sql .= " AND f.type IN (" . FactureFournisseur::TYPE_STANDARD . "," . FactureFournisseur::TYPE_REPLACEMENT . "," . FactureFournisseur::TYPE_CREDIT_NOTE . "," . FactureFournisseur::TYPE_DEPOSIT . "," . FactureFournisseur::TYPE_SITUATION . ")"; } if ($date_start && $date_end) $sql .= " AND f.datef >= '" . $db->idate($date_start) . "' AND f.datef <= '" . $db->idate($date_end) . "'"; @@ -277,7 +277,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add - $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; + $bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 32a29177a37..42fbb7ff681 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -295,7 +295,7 @@ if ($action == 'writebookkeeping') { $bookkeeping->doc_type = 'customer_invoice'; $bookkeeping->fk_doc = $key; $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add - $bookkeeping->thirdparty_code = $companystatic->code_client; + $bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; @@ -550,12 +550,12 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { - print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); - print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); + print img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); + print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; if (empty($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER) || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { - print ''; + print ''; } else { print ''; diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 123b5f50bd8..8c170cc78ad 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -33,49 +33,49 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; class Documents extends DolibarrApi { - /** - * @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object - */ - static $DOCUMENT_FIELDS = array( - 'modulepart' - ); + /** + * @var array $DOCUMENT_FIELDS Mandatory fields, checked when create and update object + */ + static $DOCUMENT_FIELDS = array( + 'modulepart' + ); - /** - * Constructor - */ - function __construct() - { - global $db; - $this->db = $db; - } + /** + * Constructor + */ + function __construct() + { + global $db; + $this->db = $db; + } - /** - * Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download - * a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie). - * - * @param string $module_part Name of module or area concerned by file download ('facture', ...) - * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf) - * @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases. - * Also, note that setting this to 1 nead write access on object. - * @return array List of documents - * - * @throws 500 - * @throws 501 - * @throws 400 - * @throws 401 - * @throws 200 - */ - public function index($module_part, $original_file='', $regeneratedoc=0) - { + /** + * Returns a document. Note that, this API is similar to using the wrapper link "documents.php" to download + * a file (used for internal HTML links of documents into application), but with no need to be into a logged session (no need to post the session cookie). + * + * @param string $module_part Name of module or area concerned by file download ('facture', ...) + * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf) + * @param int $regeneratedoc If requested document is the main document of an object, setting this to 1 ask API to regenerate document before returning it (supported for some module_part only). It is no effect in other cases. + * Also, note that setting this to 1 nead write access on object. + * @return array List of documents + * + * @throws 500 + * @throws 501 + * @throws 400 + * @throws 401 + * @throws 200 + */ + public function index($module_part, $original_file='', $regeneratedoc=0) + { global $conf; if (empty($module_part)) { - throw new RestException(400, 'bad value for parameter modulepart'); + throw new RestException(400, 'bad value for parameter modulepart'); + } + if (empty($original_file)) { + throw new RestException(400, 'bad value for parameter ref or subdir'); } - if (empty($original_file)) { - throw new RestException(400, 'bad value for parameter ref or subdir'); - } //--- Finds and returns the document $entity=$conf->entity; @@ -183,37 +183,37 @@ class Documents extends DolibarrApi $entity = $user->entity; if ($ref) { - if ($modulepart == 'facture' || $modulepart == 'invoice') - { - $modulepart='facture'; - $object=new Facture($db); - $result = $object->fetch('', $ref); - } + if ($modulepart == 'facture' || $modulepart == 'invoice') + { + $modulepart='facture'; + $object=new Facture($db); + $result = $object->fetch('', $ref); + } - if (! ($object->id > 0)) - { - throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found."); - } + if (! ($object->id > 0)) + { + throw new RestException(500, 'The object '.$modulepart." with ref '".$ref."' was not found."); + } - $tmp = dol_check_secure_access_document($modulepart, $tmpreldir.$object->ref, $entity, DolibarrApiAccess::$user, $ref, 'write'); - $upload_dir = $tmp['original_file']; + $tmp = dol_check_secure_access_document($modulepart, $tmpreldir.$object->ref, $entity, DolibarrApiAccess::$user, $ref, 'write'); + $upload_dir = $tmp['original_file']; - if (empty($upload_dir) || $upload_dir == '/') - { - throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); - } + if (empty($upload_dir) || $upload_dir == '/') + { + throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); + } } else { - if ($modulepart == 'invoice') $modulepart ='facture'; + if ($modulepart == 'invoice') $modulepart ='facture'; - $tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write'); - $upload_dir = $tmp['original_file']; + $tmp = dol_check_secure_access_document($modulepart, $subdir, $entity, DolibarrApiAccess::$user, '', 'write'); + $upload_dir = $tmp['original_file']; - if (empty($upload_dir) || $upload_dir == '/') - { - throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); - } + if (empty($upload_dir) || $upload_dir == '/') + { + throw new RestException(500, 'This value of modulepart does not support yet usage of ref. Check modulepart parameter or try to use subdir parameter instead of ref.'); + } } @@ -223,46 +223,46 @@ class Documents extends DolibarrApi $destfiletmp = DOL_DATA_ROOT.'/admin/temp/' . $original_file; dol_delete_file($destfiletmp); - if (!dol_is_dir($upload_dir)) { - throw new RestException(401,'Directory not exists : '.$upload_dir); - } + if (!dol_is_dir($upload_dir)) { + throw new RestException(401,'Directory not exists : '.$upload_dir); + } - if (! $overwriteifexists && dol_is_file($destfile)) - { - throw new RestException(500, "File with name '".$original_file."' already exists."); - } + if (! $overwriteifexists && dol_is_file($destfile)) + { + throw new RestException(500, "File with name '".$original_file."' already exists."); + } - $fhandle = @fopen($destfiletmp, 'w'); - if ($fhandle) - { - $nbofbyteswrote = fwrite($fhandle, $newfilecontent); - fclose($fhandle); - @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); - } - else - { - throw new RestException(500, "Failed to open file '".$destfiletmp."' for write"); - } + $fhandle = @fopen($destfiletmp, 'w'); + if ($fhandle) + { + $nbofbyteswrote = fwrite($fhandle, $newfilecontent); + fclose($fhandle); + @chmod($destfiletmp, octdec($conf->global->MAIN_UMASK)); + } + else + { + throw new RestException(500, "Failed to open file '".$destfiletmp."' for write"); + } - $result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1); + $result = dol_move($destfiletmp, $destfile, 0, $overwriteifexists, 1); - return $result; - } + return $result; + } - /** - * Validate fields before create or update object - * - * @param array $data Array with data to verify - * @return array - * @throws RestException - */ - function _validate_file($data) { - $result = array(); - foreach (Documents::$DOCUMENT_FIELDS as $field) { - if (!isset($data[$field])) - throw new RestException(400, "$field field missing"); - $result[$field] = $data[$field]; - } - return $result; - } + /** + * Validate fields before create or update object + * + * @param array $data Array with data to verify + * @return array + * @throws RestException + */ + function _validate_file($data) { + $result = array(); + foreach (Documents::$DOCUMENT_FIELDS as $field) { + if (!isset($data[$field])) + throw new RestException(400, "$field field missing"); + $result[$field] = $data[$field]; + } + return $result; + } } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 767370786c1..efd0404ee72 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -76,7 +76,7 @@ $newmask = 0; if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK; if (empty($newmask)) // This should no happen { - $newmask='0664'; + $newmask='0664'; } @@ -86,179 +86,179 @@ if (empty($newmask)) // This should no happen if ($dirins && $action == 'initmodule' && $modulename) { - if (preg_match('/\s/', $modulename)) - { - $error++; - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); - } + if (preg_match('/\s/', $modulename)) + { + $error++; + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); + } - if (! $error) - { - $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; - $destdir = $dirins.'/'.strtolower($modulename); + if (! $error) + { + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $destdir = $dirins.'/'.strtolower($modulename); - $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename - ); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename + ); - $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); - //dol_mkdir($destfile); - if ($result <= 0) - { - if ($result < 0) - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); - } - else // $result == 0 - { - setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); - } - } + $result = dolCopyDir($srcdir, $destdir, 0, 0, $arrayreplacement); + //dol_mkdir($destfile); + if ($result <= 0) + { + if ($result < 0) + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); + } + else // $result == 0 + { + setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); + } + } - // Delete some files - dol_delete_file($destdir.'/myobject_card.php'); - dol_delete_file($destdir.'/myobject_note.php'); - dol_delete_file($destdir.'/myobject_document.php'); - dol_delete_file($destdir.'/myobject_agenda.php'); - dol_delete_file($destdir.'/myobject_list.php'); - dol_delete_file($destdir.'/lib/myobject.lib.php'); - dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); - dol_delete_file($destdir.'/sql/llx_myobject.sql'); - dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql'); - dol_delete_file($destdir.'/sql/llx_myobject.key.sql'); - dol_delete_file($destdir.'/scripts/myobject.php'); - dol_delete_file($destdir.'/img/object_myobject.png'); - dol_delete_file($destdir.'/class/myobject.class.php'); - dol_delete_file($destdir.'/class/api_myobject.class.php'); - } + // Delete some files + dol_delete_file($destdir.'/myobject_card.php'); + dol_delete_file($destdir.'/myobject_note.php'); + dol_delete_file($destdir.'/myobject_document.php'); + dol_delete_file($destdir.'/myobject_agenda.php'); + dol_delete_file($destdir.'/myobject_list.php'); + dol_delete_file($destdir.'/lib/myobject.lib.php'); + dol_delete_file($destdir.'/test/phpunit/MyObjectTest.php'); + dol_delete_file($destdir.'/sql/llx_myobject.sql'); + dol_delete_file($destdir.'/sql/llx_myobject_extrafields.sql'); + dol_delete_file($destdir.'/sql/llx_myobject.key.sql'); + dol_delete_file($destdir.'/scripts/myobject.php'); + dol_delete_file($destdir.'/img/object_myobject.png'); + dol_delete_file($destdir.'/class/myobject.class.php'); + dol_delete_file($destdir.'/class/api_myobject.class.php'); + } - // Edit PHP files - if (! $error) - { - $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); - foreach($listofphpfilestoedit as $phpfileval) - { - //var_dump($phpfileval['fullname']); - $arrayreplacement=array( - 'mymodule'=>strtolower($modulename), - 'MyModule'=>$modulename, - 'MYMODULE'=>strtoupper($modulename), - 'My module'=>$modulename, - 'my module'=>$modulename, - 'Mon module'=>$modulename, - 'mon module'=>$modulename, - 'htdocs/modulebuilder/template'=>strtolower($modulename), - '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') - ); + // Edit PHP files + if (! $error) + { + $listofphpfilestoedit = dol_dir_list($destdir, 'files', 1, '\.(php|MD|js|sql|txt|xml|lang)$', '', 'fullname', SORT_ASC, 0, 1); + foreach($listofphpfilestoedit as $phpfileval) + { + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($modulename), + 'MyModule'=>$modulename, + 'MYMODULE'=>strtoupper($modulename), + 'My module'=>$modulename, + 'my module'=>$modulename, + 'Mon module'=>$modulename, + 'mon module'=>$modulename, + 'htdocs/modulebuilder/template'=>strtolower($modulename), + '---Put here your own copyright and developer email---'=>dol_print_date($now,'%Y').' '.$user->getFullName($langs).($user->email?' <'.$user->email.'>':'') + ); - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); - //var_dump($result); - if ($result < 0) - { - setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); - } - } - } + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); + //var_dump($result); + if ($result < 0) + { + setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); + } + } + } - if (! $error) - { - setEventMessages('ModuleInitialized', null); - $module=$modulename; - $modulename = ''; - } + if (! $error) + { + setEventMessages('ModuleInitialized', null); + $module=$modulename; + $modulename = ''; + } } if ($dirins && $action == 'initobject' && $module && $objectname) { - if (preg_match('/\s/', $objectname)) - { - $error++; - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); - } + if (preg_match('/\s/', $objectname)) + { + $error++; + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); + } - $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; - $destdir = $dirins.'/'.strtolower($module); + $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; + $destdir = $dirins.'/'.strtolower($module); - // 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; - } - } - } + // 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 (! $error) - { - // Delete some files - $filetogenerate = array( - 'myobject_card.php'=>strtolower($objectname).'_card.php', - 'myobject_note.php'=>strtolower($objectname).'_note.php', - 'myobject_document.php'=>strtolower($objectname).'_document.php', - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', - 'myobject_list.php'=>strtolower($objectname).'_list.php', - 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', - 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', - 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', - 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.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($objectname).'.class.php' - ); + if (! $error) + { + // Delete some files + $filetogenerate = array( + 'myobject_card.php'=>strtolower($objectname).'_card.php', + 'myobject_note.php'=>strtolower($objectname).'_note.php', + 'myobject_document.php'=>strtolower($objectname).'_document.php', + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', + 'myobject_list.php'=>strtolower($objectname).'_list.php', + 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', + 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', + 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.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($objectname).'.class.php' + ); - 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'); - } - } - } + 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) - { - // Scan for object class files - $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); + if (! $error) + { + // Scan for object class files + $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); - $firstobjectname=''; - foreach($listofobject as $fileobj) - { - if (preg_match('/^api_/',$fileobj['name'])) continue; - if (preg_match('/^actions_/',$fileobj['name'])) continue; + $firstobjectname=''; + foreach($listofobject as $fileobj) + { + if (preg_match('/^api_/',$fileobj['name'])) continue; + if (preg_match('/^actions_/',$fileobj['name'])) continue; - $tmpcontent=file_get_contents($fileobj['fullname']); - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) - { - $objectnameloop = $reg[1]; - if (empty($firstobjectname)) $firstobjectname = $objectnameloop; - } + $tmpcontent=file_get_contents($fileobj['fullname']); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) + { + $objectnameloop = $reg[1]; + if (empty($firstobjectname)) $firstobjectname = $objectnameloop; + } - // Regenerate left menu entry in descriptor for $objectname - $stringtoadd=" + // Regenerate left menu entry in descriptor for $objectname + $stringtoadd=" \t\t\$this->menu[\$r++]=array( 'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode 'type'=>'left', // This is a Left menu entry @@ -286,123 +286,123 @@ if ($dirins && $action == 'initobject' && $module && $objectname) 'target'=>'', 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both "; - $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); - $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); - $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); + $stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd); + $stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd); + $stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd); - $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; + $moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php'; - // TODO Allow a replace with regex using dolReplaceRegexInFile - // TODO Avoid duplicate addition + // TODO Allow a replace with regex using dolReplaceRegexInFile + // TODO Avoid duplicate addition - dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); + dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */")); // Add module descriptor to list of files to replace "MyObject' string with real name of object. - $filetogenerate[]='core/modules/mod'.$module.'.class.php'; + $filetogenerate[]='core/modules/mod'.$module.'.class.php'; - // TODO - } - } - } + // TODO + } + } + } - if (! $error) - { - // Edit PHP files - foreach($filetogenerate as $destfile) - { - $phpfileval['fullname'] = $destdir.'/'.$destfile; + if (! $error) + { + // Edit PHP files + foreach($filetogenerate as $destfile) + { + $phpfileval['fullname'] = $destdir.'/'.$destfile; - //var_dump($phpfileval['fullname']); - $arrayreplacement=array( - 'mymodule'=>strtolower($module), - 'MyModule'=>$module, - 'MYMODULE'=>strtoupper($module), - 'My module'=>$module, - 'my module'=>$module, - 'mon module'=>$module, - 'Mon module'=>$module, - 'htdocs/modulebuilder/template/'=>strtolower($modulename), - 'myobject'=>strtolower($objectname), - 'MyObject'=>$objectname - ); + //var_dump($phpfileval['fullname']); + $arrayreplacement=array( + 'mymodule'=>strtolower($module), + 'MyModule'=>$module, + 'MYMODULE'=>strtoupper($module), + 'My module'=>$module, + 'my module'=>$module, + 'mon module'=>$module, + 'Mon module'=>$module, + 'htdocs/modulebuilder/template/'=>strtolower($modulename), + 'myobject'=>strtolower($objectname), + 'MyObject'=>$objectname + ); - $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); - //var_dump($result); - if ($result < 0) - { - setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); - } - } - } + $result=dolReplaceInFile($phpfileval['fullname'], $arrayreplacement); + //var_dump($result); + if ($result < 0) + { + setEventMessages($langs->trans("ErrorFailToMakeReplacementInto", $phpfileval['fullname']), null, 'errors'); + } + } + } - if (! $error) - { - // Edit the class file to write properties - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); - if (is_numeric($object) && $object < 0) $error++; - } - if (! $error) - { - // Edit sql with new properties - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); - if ($result < 0) $error++; - } + if (! $error) + { + // Edit the class file to write properties + $object=rebuildObjectClass($destdir, $module, $objectname, $newmask); + if (is_numeric($object) && $object < 0) $error++; + } + if (! $error) + { + // Edit sql with new properties + $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, '', $object); + if ($result < 0) $error++; + } - if (! $error) - { - setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); - } + if (! $error) + { + setEventMessages($langs->trans('FilesForObjectInitialized', $objectname), null); + } } if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj)) { - $objectname = $tabobj; + $objectname = $tabobj; - $srcdir = $dirread.'/'.strtolower($module); - $destdir = $dirins.'/'.strtolower($module); - dol_mkdir($destdir); + $srcdir = $dirread.'/'.strtolower($module); + $destdir = $dirins.'/'.strtolower($module); + dol_mkdir($destdir); - $addfieldentry = array( - 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), - 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // 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')); + $addfieldentry = array( + 'name'=>GETPOST('propname','aZ09'),'label'=>GETPOST('proplabel','alpha'),'type'=>GETPOST('proptype','alpha'), + 'arrayofkeyval'=>GETPOST('proparrayofkeyval','none'), // 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')); - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) - { - $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); - } + if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) + { + $addfieldentry['arrayofkeyval'] = dol_json_decode($addfieldentry['arrayofkeyval'], true); + } - // Edit the class file to write properties - if (! $error) - { - $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); + // Edit the class file to write properties + if (! $error) + { + $object=rebuildObjectClass($destdir, $module, $objectname, $newmask, $srcdir, $addfieldentry); if (is_numeric($result) && $result <= 0) $error++; - } + } - // Edit sql with new properties - if (! $error) - { - $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); + // Edit sql with new properties + if (! $error) + { + $result=rebuildObjectSql($destdir, $module, $objectname, $newmask, $srcdir, $object); if ($result <= 0) { $error++; } - } + } - if (! $error) - { - clearstatcache(); + if (! $error) + { + clearstatcache(); - setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); + setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); - // Make a redirect to reload all data - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); + // Make a redirect to reload all data + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); - clearstatcache(); - exit; - } + clearstatcache(); + exit; + } } if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) @@ -433,171 +433,171 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) setEventMessages($langs->trans('FilesForObjectUpdated', $objectname), null); - // Make a redirect to reload all data - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); + // Make a redirect to reload all data + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.'&tabobj='.$objectname); - clearstatcache(); - exit; + clearstatcache(); + exit; } } if ($dirins && $action == 'confirm_delete') { - if (preg_match('/\s/', $module)) - { - $error++; - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); - } + if (preg_match('/\s/', $module)) + { + $error++; + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); + } - if (! $error) - { - $modulelowercase=strtolower($module); + if (! $error) + { + $modulelowercase=strtolower($module); - // Dir for module - $dir = $dirins.'/'.$modulelowercase; + // Dir for module + $dir = $dirins.'/'.$modulelowercase; - $result = dol_delete_dir_recursive($dir); + $result = dol_delete_dir_recursive($dir); - if ($result > 0) - { - setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); - } - else - { - setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); - } - } + if ($result > 0) + { + setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); + } + else + { + setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); + } + } - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); - //exit; - $action = ''; - $module = 'deletemodule'; + //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); + //exit; + $action = ''; + $module = 'deletemodule'; } if ($dirins && $action == 'confirm_deleteobject' && $objectname) { - if (preg_match('/[^a-z0-9]/i', $objectname)) - { - $error++; - setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); - } + if (preg_match('/[^a-z0-9]/i', $objectname)) + { + $error++; + setEventMessages($langs->trans("SpaceOrSpecialCharAreNotAllowed"), null, 'errors'); + } - if (! $error) - { - $modulelowercase=strtolower($module); - $objectlowercase=strtolower($objectname); + if (! $error) + { + $modulelowercase=strtolower($module); + $objectlowercase=strtolower($objectname); - // Dir for module - $dir = $dirins.'/'.$modulelowercase; + // Dir for module + $dir = $dirins.'/'.$modulelowercase; - // Delete some files - $filetogenerate = array( - 'myobject_card.php'=>strtolower($objectname).'_card.php', - 'myobject_note.php'=>strtolower($objectname).'_note.php', - 'myobject_document.php'=>strtolower($objectname).'_document.php', - 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', - 'myobject_list.php'=>strtolower($objectname).'_list.php', - 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', - 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', - 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', - 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', - 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.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($objectname).'.class.php' - ); + // Delete some files + $filetogenerate = array( + 'myobject_card.php'=>strtolower($objectname).'_card.php', + 'myobject_note.php'=>strtolower($objectname).'_note.php', + 'myobject_document.php'=>strtolower($objectname).'_document.php', + 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', + 'myobject_list.php'=>strtolower($objectname).'_list.php', + 'lib/myobject.lib.php'=>'lib/'.strtolower($objectname).'.lib.php', + 'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.$objectname.'Test.php', + 'sql/llx_myobject.sql'=>'sql/llx_'.strtolower($objectname).'.sql', + 'sql/llx_myobject_extrafields.sql'=>'sql/llx_'.strtolower($objectname).'_extrafields.sql', + 'sql/llx_myobject.key.sql'=>'sql/llx_'.strtolower($objectname).'.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($objectname).'.class.php' + ); - $resultko = 0; - foreach($filetogenerate as $filetodelete) - { - $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); - if (! $resulttmp) $resultko++; - } + $resultko = 0; + foreach($filetogenerate as $filetodelete) + { + $resulttmp = dol_delete_file($dir.'/'.$filetodelete, 0, 0, 1); + if (! $resulttmp) $resultko++; + } - if ($resultko == 0) - { - setEventMessages($langs->trans("FilesDeleted"), null); - } - else - { - setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); - } - } + if ($resultko == 0) + { + setEventMessages($langs->trans("FilesDeleted"), null); + } + else + { + setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); + } + } - //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); - //exit; - $action = ''; - $tabobj = 'deleteobject'; + //header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?module=initmodule'); + //exit; + $action = ''; + $tabobj = 'deleteobject'; } if ($dirins && $action == 'generatepackage') { - $modulelowercase=strtolower($module); + $modulelowercase=strtolower($module); - // Dir for module - $dir = $dirins.'/'.$modulelowercase; - // Zip file to build - $FILENAMEZIP=''; + // Dir for module + $dir = $dirins.'/'.$modulelowercase; + // Zip file to build + $FILENAMEZIP=''; - // Load module - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); - $class='mod'.$module; + // Load module + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); + $class='mod'.$module; - if (class_exists($class)) - { - try { - $moduleobj = new $class($db); - } - catch(Exception $e) - { - $error++; - dol_print_error($e->getMessage()); - } - } - else - { - $error++; - $langs->load("errors"); - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); - exit; - } + if (class_exists($class)) + { + try { + $moduleobj = new $class($db); + } + catch(Exception $e) + { + $error++; + dol_print_error($e->getMessage()); + } + } + else + { + $error++; + $langs->load("errors"); + dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); + exit; + } - $arrayversion=explode('.',$moduleobj->version,3); - if (count($arrayversion)) - { - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; + $arrayversion=explode('.',$moduleobj->version,3); + if (count($arrayversion)) + { + $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; - $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; - $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; + $dirofmodule = dol_buildpath($modulelowercase, 0).'/bin'; + $outputfilezip = $dirofmodule.'/'.$FILENAMEZIP; if ($dirofmodule) { - if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); - $result = dol_compress_dir($dir, $outputfilezip, 'zip'); + if (! dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); + $result = dol_compress_dir($dir, $outputfilezip, 'zip'); } else { $result = -1; } - if ($result > 0) - { - setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); - } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); - } - } - else - { - $error++; - $langs->load("errors"); - setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); - } + if ($result > 0) + { + setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); + } + else + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); + } + } + else + { + $error++; + $langs->load("errors"); + setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); + } } if ($dirins && $action == 'generatedoc') @@ -673,40 +673,40 @@ if ($dirins && $action == 'generatedoc') // Save file if ($action == 'savefile' && empty($cancel)) { - $relofcustom = basename($dirins); + $relofcustom = basename($dirins); - if ($relofcustom) - { - // Check that relative path ($file) start with name 'custom' - if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; + if ($relofcustom) + { + // Check that relative path ($file) start with name 'custom' + if (! preg_match('/^'.$relofcustom.'/', $file)) $file=$relofcustom.'/'.$file; - $pathoffile=dol_buildpath($file, 0); - $pathoffilebackup=dol_buildpath($file.'.back', 0); + $pathoffile=dol_buildpath($file, 0); + $pathoffilebackup=dol_buildpath($file.'.back', 0); - // Save old version - if (dol_is_file($pathoffile)) - { - dol_copy($pathoffile, $pathoffilebackup, 0, 1); - } + // Save old version + if (dol_is_file($pathoffile)) + { + dol_copy($pathoffile, $pathoffilebackup, 0, 1); + } - $content = GETPOST('editfilecontent','none'); + $content = GETPOST('editfilecontent','none'); - // Save file on disk - if ($content) - { - dol_delete_file($pathoffile); - file_put_contents($pathoffile, $content); - @chmod($pathoffile, octdec($newmask)); + // Save file on disk + if ($content) + { + dol_delete_file($pathoffile); + file_put_contents($pathoffile, $content); + @chmod($pathoffile, octdec($newmask)); - setEventMessages($langs->trans("FileSaved"), null); - } - else - { + setEventMessages($langs->trans("FileSaved"), null); + } + else + { setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors'); - //$action='editfile'; - $error++; - } - } + //$action='editfile'; + $error++; + } + } } // Enable module @@ -770,7 +770,7 @@ $formadmin = new FormAdmin($db); // Set dir where external modules are installed if (! dol_is_dir($dirins)) { - dol_mkdir($dirins); + dol_mkdir($dirins); } $dirins_ok=(dol_is_dir($dirins)); @@ -827,30 +827,30 @@ if ($forceddirread) print $langs->trans("DirScanned").' : '.$dirread.'trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); - $allowfromweb=-1; + $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); + $allowfromweb=-1; } else { - if ($dirins_ok) - { - if (! is_writable(dol_osencode($dirins))) - { - $langs->load("errors"); - $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); - $allowfromweb=0; - } - } - else - { + if ($dirins_ok) + { + if (! is_writable(dol_osencode($dirins))) + { + $langs->load("errors"); + $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins)); + $allowfromweb=0; + } + } + else + { - $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); - $allowfromweb=0; - } + $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); + $allowfromweb=0; + } } if ($message) { - print $message; + print $message; } //print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
'; @@ -865,27 +865,27 @@ if (! empty($module) && $module != 'initmodule' && $module != 'deletemodule') { $modulelowercase=strtolower($module); - // Load module - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); - $class='mod'.$module; + // Load module + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); + $class='mod'.$module; - if (class_exists($class)) - { - try { - $moduleobj = new $class($db); - } - catch(Exception $e) - { - $error++; - print $e->getMessage(); - } - } - else - { - if (empty($forceddirread)) $error++; - $langs->load("errors"); - print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; - } + if (class_exists($class)) + { + try { + $moduleobj = new $class($db); + } + catch(Exception $e) + { + $error++; + print $e->getMessage(); + } + } + else + { + if (empty($forceddirread)) $error++; + $langs->load("errors"); + print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; + } } print '
'; @@ -902,10 +902,10 @@ $h++; foreach($listofmodules as $tmpmodule => $tmpmodulewithcase) { - $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); - $head[$h][1] = $tmpmodulewithcase; - $head[$h][2] = $tmpmodulewithcase; - $h++; + $head[$h][0] = $_SERVER["PHP_SELF"].'?module='.$tmpmodulewithcase.($forceddirread?'@'.$dirread:''); + $head[$h][1] = $tmpmodulewithcase; + $head[$h][2] = $tmpmodulewithcase; + $h++; } $head[$h][0] = $_SERVER["PHP_SELF"].'?module=deletemodule'; @@ -918,671 +918,671 @@ dol_fiche_head($head, $module, $langs->trans("Modules"), -1, 'generic', 0, $info if ($module == 'initmodule') { - // New module - print '
'; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; - print $langs->trans("EnterNameOfModuleDesc").'

'; + print $langs->trans("EnterNameOfModuleDesc").'

'; - print ''; - print ''; - print '
'; + print ''; + print ''; + print ''; } elseif ($module == 'deletemodule') { - print '
'; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; - print $langs->trans("EnterNameOfModuleToDeleteDesc").'

'; + print $langs->trans("EnterNameOfModuleToDeleteDesc").'

'; - print ''; - print ''; - print '
'; + print ''; + print ''; + print ''; } elseif (! empty($module)) { // Tabs for module - if (! $error) - { - $head2 = array(); - $h=0; + if (! $error) + { + $head2 = array(); + $h=0; - $modulelowercase=strtolower($module); - $const_name = 'MAIN_MODULE_'.strtoupper($module); + $modulelowercase=strtolower($module); + $const_name = 'MAIN_MODULE_'.strtoupper($module); - $param=''; - if ($tab) $param.= '&tab='.$tab; - if ($module) $param.='&module='.$module; - if ($tabobj) $param.='&tabobj='.$tabobj; + $param=''; + if ($tab) $param.= '&tab='.$tab; + if ($module) $param.='&module='.$module; + if ($tabobj) $param.='&tabobj='.$tabobj; - $urltomodulesetup=''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; - $linktoenabledisable=''; - if (! empty($conf->global->$const_name)) // If module is already activated - { - $linktoenabledisable.=''; - $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); - $linktoenabledisable.=''; - } - else - { - $linktoenabledisable.=''; - $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); - $linktoenabledisable.="\n"; - } - if (! empty($conf->$modulelowercase->enabled)) - { - $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); - } - else - { - $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); - } + $urltomodulesetup=''.$langs->trans('Home').'-'.$langs->trans("Setup").'-'.$langs->trans("Modules").''; + $linktoenabledisable=''; + if (! empty($conf->global->$const_name)) // If module is already activated + { + $linktoenabledisable.=''; + $linktoenabledisable.=img_picto($langs->trans("Activated"),'switch_on'); + $linktoenabledisable.=''; + } + else + { + $linktoenabledisable.=''; + $linktoenabledisable.=img_picto($langs->trans("Disabled"),'switch_off'); + $linktoenabledisable.="\n"; + } + if (! empty($conf->$modulelowercase->enabled)) + { + $modulestatusinfo=img_warning().' '.$langs->trans("ModuleIsLive"); + } + else + { + $modulestatusinfo=img_info('').' '.$langs->trans("ModuleIsNotActive", $urltomodulesetup); + } - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Description"); - $head2[$h][2] = 'description'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=description&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Description"); + $head2[$h][2] = 'description'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Specifications"); - $head2[$h][2] = 'specifications'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=specifications&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Specifications"); + $head2[$h][2] = 'specifications'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Languages"); - $head2[$h][2] = 'languages'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=languages&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Languages"); + $head2[$h][2] = 'languages'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Objects"); - $head2[$h][2] = 'objects'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Objects"); + $head2[$h][2] = 'objects'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Menus"); - $head2[$h][2] = 'menus'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=menus&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Menus"); + $head2[$h][2] = 'menus'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Permissions"); - $head2[$h][2] = 'permissions'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=permissions&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Permissions"); + $head2[$h][2] = 'permissions'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Hooks"); - $head2[$h][2] = 'hooks'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=hooks&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Hooks"); + $head2[$h][2] = 'hooks'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Triggers"); - $head2[$h][2] = 'triggers'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=triggers&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Triggers"); + $head2[$h][2] = 'triggers'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("Widgets"); - $head2[$h][2] = 'widgets'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=widgets&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("Widgets"); + $head2[$h][2] = 'widgets'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("CronList"); - $head2[$h][2] = 'cron'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("CronList"); + $head2[$h][2] = 'cron'; + $h++; - $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); - $head2[$h][1] = $langs->trans("BuildPackage"); - $head2[$h][2] = 'buildpackage'; - $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module.($forceddirread?'@'.$dirread:''); + $head2[$h][1] = $langs->trans("BuildPackage"); + $head2[$h][2] = 'buildpackage'; + $h++; - print $modulestatusinfo; - print ' '.$linktoenabledisable; - print '

'; + print $modulestatusinfo; + print ' '.$linktoenabledisable; + print '

'; - if ($tab == 'description') - { - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; - $pathtofilereadme = $modulelowercase.'/README.md'; - $pathtochangelog = $modulelowercase.'/ChangeLog.md'; + if ($tab == 'description') + { + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + $pathtofilereadme = $modulelowercase.'/README.md'; + $pathtochangelog = $modulelowercase.'/ChangeLog.md'; - if ($action != 'editfile' || empty($file)) - { - dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 + if ($action != 'editfile' || empty($file)) + { + dol_fiche_head($head2, $tab, '', -1, ''); // Description - level 2 - print $langs->trans("ModuleBuilderDesc".$tab).'

'; + print $langs->trans("ModuleBuilderDesc".$tab).'

'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("ReadmeFile").' : '.$pathtofilereadme.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("ChangeLog").' : '.$pathtochangelog.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; - print '
'; + print '
'; + print '
'; - print_fiche_titre($langs->trans("DescriptorFile")); + print_fiche_titre($langs->trans("DescriptorFile")); - if (! empty($moduleobj)) - { - print '
'; - print '
'; + if (! empty($moduleobj)) + { + print '
'; + print '
'; - print ''; - print ''; + print '
'; - print $langs->trans("Parameter"); - print ''; - print $langs->trans("Value"); - print '
'; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print '
'; + print $langs->trans("Parameter"); + print ''; + print $langs->trans("Value"); + print '
'; - print $langs->trans("Numero"); - print ''; - print $moduleobj->numero; - print '   ('.$langs->trans("SeeIDsInUse").''; - print ' - '.$langs->trans("SeeReservedIDsRangeHere").')'; - print '
'; + print $langs->trans("Numero"); + print ''; + print $moduleobj->numero; + print '   ('.$langs->trans("SeeIDsInUse").''; + print ' - '.$langs->trans("SeeReservedIDsRangeHere").')'; + print '
'; - print $langs->trans("Name"); - print ''; - print $moduleobj->getName(); - print '
'; + print $langs->trans("Name"); + print ''; + print $moduleobj->getName(); + print '
'; - print $langs->trans("Version"); - print ''; - print $moduleobj->getVersion(); - print '
'; + print $langs->trans("Version"); + print ''; + print $moduleobj->getVersion(); + print '
'; - print $langs->trans("Family"); - //print "
'crm','financial','hr','projects','products','ecm','technic','interface','other'"; - print '
'; - print $moduleobj->family; - print '
'; + print $langs->trans("Family"); + //print "
'crm','financial','hr','projects','products','ecm','technic','interface','other'"; + print '
'; + print $moduleobj->family; + print '
'; - print $langs->trans("EditorName"); - print ''; - print $moduleobj->editor_name; - print '
'; + print $langs->trans("EditorName"); + print ''; + print $moduleobj->editor_name; + print '
'; - print $langs->trans("EditorUrl"); - print ''; - print $moduleobj->editor_url; - print '
'; + print $langs->trans("EditorUrl"); + print ''; + print $moduleobj->editor_url; + print '
'; - print $langs->trans("Description"); - print ''; - print $moduleobj->getDesc(); - print '
'; + print $langs->trans("Description"); + print ''; + print $moduleobj->getDesc(); + print '
'; + print ''; - print '

'; + print '

'; // Readme file - print_fiche_titre($langs->trans("ReadmeFile")); + print_fiche_titre($langs->trans("ReadmeFile")); - print '
'; - print '
'; + print '
'; + print '
'; - print $moduleobj->getDescLong(); + print $moduleobj->getDescLong(); - print '

'; + print '

'; - // ChangeLog - print_fiche_titre($langs->trans("ChangeLog")); + // ChangeLog + print_fiche_titre($langs->trans("ChangeLog")); - print '
'; - print '
'; + print '
'; + print '
'; - print $moduleobj->getChangeLog(); + print $moduleobj->getChangeLog(); - print '
'; - } - else - { - print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; - } + print '
'; + } + else + { + print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; + } - dol_fiche_end(); - } - else - { - $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 + dol_fiche_end(); + } + else + { + $fullpathoffile=dol_buildpath($file, 0, 1); // Description - level 2 - if ($fullpathoffile) - { - $content = file_get_contents($fullpathoffile); - } + if ($fullpathoffile) + { + $content = file_get_contents($fullpathoffile); + } - // New module - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - dol_fiche_head($head2, $tab, '', -1, ''); + dol_fiche_head($head2, $tab, '', -1, ''); - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - dol_fiche_end(); + dol_fiche_end(); - print '
'; - print ''; - print '   '; - print ''; - print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print '
'; - } - } - else - { - dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 - } + print ''; + } + } + else + { + dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 + } - if ($tab == 'specifications') - { - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("SpecDefDesc").'
'; - print '
'; + if ($tab == 'specifications') + { + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("SpecDefDesc").'
'; + print '
'; - $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); + $specs=dol_dir_list(dol_buildpath($modulelowercase.'/doc', 0), 'files', 1, '(\.md|\.asciidoc)$'); - foreach ($specs as $spec) - { - $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; + foreach ($specs as $spec) + { + $pathtofile = $modulelowercase.'/doc/'.$spec['relativename']; $format='asciidoc'; if (preg_match('/\.md$/i', $spec['name'])) $format='markdown'; - print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } - } - else - { - // Use MD or asciidoc + print ' '.$langs->trans("SpecificationFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } + } + else + { + // Use MD or asciidoc - //print $langs->trans("UseAsciiDocFormat").'
'; + //print $langs->trans("UseAsciiDocFormat").'
'; - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print '
'; - } - } + print ''; + } + } - if ($tab == 'languages') - { - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("LanguageDefDesc").'
'; - print '
'; + if ($tab == 'languages') + { + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("LanguageDefDesc").'
'; + print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1); - print '
'; - print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 1); + print '
'; + print '
'; - print '
'; - print '
'; + print '
'; + print '
'; - $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); + $langfiles=dol_dir_list(dol_buildpath($modulelowercase.'/langs', 0), 'files', 1, '\.lang$'); - foreach ($langfiles as $langfile) - { - $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; - print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } - } - else - { - // Edit text language file + foreach ($langfiles as $langfile) + { + $pathtofile = $modulelowercase.'/langs/'.$langfile['relativename']; + print ' '.$langs->trans("LanguageFile").' '.basename(dirname($pathtofile)).' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } + } + else + { + // Edit text language file - //print $langs->trans("UseAsciiDocFormat").'
'; + //print $langs->trans("UseAsciiDocFormat").'
'; - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'text')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print '
'; - } - } + print ''; + } + } - if ($tab == 'objects') - { - $head3 = array(); - $h=0; + if ($tab == 'objects') + { + $head3 = array(); + $h=0; - // Dir for module - $dir = $dirread.'/'.$modulelowercase.'/class'; + // Dir for module + $dir = $dirread.'/'.$modulelowercase.'/class'; - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; - $head3[$h][1] = $langs->trans("NewObject"); - $head3[$h][2] = 'newobject'; - $h++; + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=newobject'; + $head3[$h][1] = $langs->trans("NewObject"); + $head3[$h][2] = 'newobject'; + $h++; - // Scan for object class files - $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); + // Scan for object class files + $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); - $firstobjectname=''; - foreach($listofobject as $fileobj) - { - if (preg_match('/^api_/',$fileobj['name'])) continue; - if (preg_match('/^actions_/',$fileobj['name'])) continue; + $firstobjectname=''; + foreach($listofobject as $fileobj) + { + if (preg_match('/^api_/',$fileobj['name'])) continue; + if (preg_match('/^actions_/',$fileobj['name'])) continue; - $tmpcontent=file_get_contents($fileobj['fullname']); - if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) - { - //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); - $objectname = $reg[1]; - if (empty($firstobjectname)) $firstobjectname = $objectname; + $tmpcontent=file_get_contents($fileobj['fullname']); + if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims',$tmpcontent,$reg)) + { + //$objectname = preg_replace('/\.txt$/', '', $fileobj['name']); + $objectname = $reg[1]; + if (empty($firstobjectname)) $firstobjectname = $objectname; - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; - $head3[$h][1] = $objectname; - $head3[$h][2] = $objectname; - $h++; - } - } + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj='.$objectname; + $head3[$h][1] = $objectname; + $head3[$h][2] = $objectname; + $h++; + } + } - $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; - $head3[$h][1] = $langs->trans("DangerZone"); - $head3[$h][2] = 'deleteobject'; - $h++; + $head3[$h][0] = $_SERVER["PHP_SELF"].'?tab=objects&module='.$module.($forceddirread?'@'.$dirread:'').'&tabobj=deleteobject'; + $head3[$h][1] = $langs->trans("DangerZone"); + $head3[$h][2] = 'deleteobject'; + $h++; - // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. - if ($tabobj == 'newobjectifnoobj') - { - if ($firstobjectname) $tabobj=$firstobjectname; - else $tabobj = 'newobject'; - } + // If tabobj was not defined, then we check if there is one obj. If yes, we force on it, if no, we will show tab to create new objects. + if ($tabobj == 'newobjectifnoobj') + { + if ($firstobjectname) $tabobj=$firstobjectname; + else $tabobj = 'newobject'; + } - dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 + dol_fiche_head($head3, $tabobj, '', -1, ''); // Level 3 - if ($tabobj == 'newobject') - { - // New object tab - print '
'; - print ''; - print ''; - print ''; - print ''; + if ($tabobj == 'newobject') + { + // New object tab + print ''; + print ''; + print ''; + print ''; + print ''; - print $langs->trans("EnterNameOfObjectDesc").'

'; + print $langs->trans("EnterNameOfObjectDesc").'

'; - print ''; - print ''; - print '
'; - } - elseif ($tabobj == 'deleteobject') - { - // Delete object tab - print '
'; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print '
'; + } + elseif ($tabobj == 'deleteobject') + { + // Delete object tab + print '
'; + print ''; + print ''; + print ''; + print ''; - print $langs->trans("EnterNameOfObjectToDeleteDesc").'

'; + print $langs->trans("EnterNameOfObjectToDeleteDesc").'

'; - print ''; - print ''; - print '
'; - } - else - { // tabobj = module - if ($action == 'deleteproperty') - { - $formconfirm = $form->formconfirm( - $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), - $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 - ); + print ''; + print ''; + print ''; + } + else + { // tabobj = module + if ($action == 'deleteproperty') + { + $formconfirm = $form->formconfirm( + $_SERVER["PHP_SELF"].'?propertykey='.urlencode(GETPOST('propertykey','alpha')).'&objectname='.urlencode($objectname).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj), + $langs->trans('Delete'), $langs->trans('ConfirmDeleteProperty', GETPOST('propertykey','alpha')), 'confirm_deleteproperty', '', 0, 1 + ); - // Print form confirm - print $formconfirm; - } + // Print form confirm + print $formconfirm; + } - if ($action != 'editfile' || empty($file)) - { - try { - $pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php'; - $pathtoapi = strtolower($module).'/class/api_'.strtolower($tabobj).'.class.php'; - $pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php'; - $pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php'; - $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; - $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; - $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; - $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; - $pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql'; - $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql'; - $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql'; - $pathtolib = strtolower($module).'/lib/'.strtolower($tabobj).'.lib.php'; - $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; + if ($action != 'editfile' || empty($file)) + { + try { + $pathtoclass = strtolower($module).'/class/'.strtolower($tabobj).'.class.php'; + $pathtoapi = strtolower($module).'/class/api_'.strtolower($tabobj).'.class.php'; + $pathtoagenda = strtolower($module).'/'.strtolower($tabobj).'_agenda.php'; + $pathtocard = strtolower($module).'/'.strtolower($tabobj).'_card.php'; + $pathtodocument = strtolower($module).'/'.strtolower($tabobj).'_document.php'; + $pathtolist = strtolower($module).'/'.strtolower($tabobj).'_list.php'; + $pathtonote = strtolower($module).'/'.strtolower($tabobj).'_note.php'; + $pathtophpunit = strtolower($module).'/test/phpunit/'.$tabobj.'Test.php'; + $pathtosql = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.sql'; + $pathtosqlextra = strtolower($module).'/sql/llx_'.strtolower($tabobj).'_extrafields.sql'; + $pathtosqlkey = strtolower($module).'/sql/llx_'.strtolower($tabobj).'.key.sql'; + $pathtolib = strtolower($module).'/lib/'.strtolower($tabobj).'.lib.php'; + $pathtopicto = strtolower($module).'/img/object_'.strtolower($tabobj).'.png'; - $realpathtoclass = dol_buildpath($pathtoclass, 0, 1); - $realpathtoapi = dol_buildpath($pathtoapi, 0, 1); - $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 1); - $realpathtocard = dol_buildpath($pathtocard, 0, 1); - $realpathtodocument = dol_buildpath($pathtodocument, 0, 1); - $realpathtolist = dol_buildpath($pathtolist, 0, 1); - $realpathtonote = dol_buildpath($pathtonote, 0, 1); - $realpathtophpunit = dol_buildpath($pathtophpunit, 0, 1); - $realpathtosql = dol_buildpath($pathtosql, 0, 1); - $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 1); - $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 1); - $realpathtolib = dol_buildpath($pathtolib, 0, 1); - $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); + $realpathtoclass = dol_buildpath($pathtoclass, 0, 1); + $realpathtoapi = dol_buildpath($pathtoapi, 0, 1); + $realpathtoagenda = dol_buildpath($pathtoagenda, 0, 1); + $realpathtocard = dol_buildpath($pathtocard, 0, 1); + $realpathtodocument = dol_buildpath($pathtodocument, 0, 1); + $realpathtolist = dol_buildpath($pathtolist, 0, 1); + $realpathtonote = dol_buildpath($pathtonote, 0, 1); + $realpathtophpunit = dol_buildpath($pathtophpunit, 0, 1); + $realpathtosql = dol_buildpath($pathtosql, 0, 1); + $realpathtosqlextra = dol_buildpath($pathtosqlextra, 0, 1); + $realpathtosqlkey = dol_buildpath($pathtosqlkey, 0, 1); + $realpathtolib = dol_buildpath($pathtolib, 0, 1); + $realpathtopicto = dol_buildpath($pathtopicto, 0, 1); - print '
'; - print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass?'':'').$pathtoclass.($realpathtoclass?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi?'':'').$pathtoapi.($realpathtoapi?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '   '.$langs->trans("GoToApiExplorer").''; - print '
'; - print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit?'':'').$pathtophpunit.($realpathtophpunit?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'; + print ' '.$langs->trans("ClassFile").' : '.($realpathtoclass?'':'').$pathtoclass.($realpathtoclass?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("ApiClassFile").' : '.($realpathtoapi?'':'').$pathtoapi.($realpathtoapi?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '.$langs->trans("GoToApiExplorer").''; + print '
'; + print ' '.$langs->trans("TestClassFile").' : '.($realpathtophpunit?'':'').$pathtophpunit.($realpathtophpunit?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; + print '
'; - print ' '.$langs->trans("PageForLib").' : '.($realpathtolib?'':'').$pathtolib.($realpathtodocument?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("PageForPicto").' : '.($realpathtopicto?'':'').$pathtopicto.($realpathtopicto?'':'').''; - //print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("PageForLib").' : '.($realpathtolib?'':'').$pathtolib.($realpathtodocument?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("PageForPicto").' : '.($realpathtopicto?'':'').$pathtopicto.($realpathtopicto?'':'').''; + //print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; - print ' '.$langs->trans("SqlFile").' : '.($realpathtosql?'':'').$pathtosql.($realpathtosql?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '   '.$langs->trans("DropTableIfEmpty").''; - //print '   '.$langs->trans("RunSql").''; - print '
'; - print ' '.$langs->trans("SqlFileExtraFields").' : '.($realpathtosqlextra?'':'').$pathtosqlextra.($realpathtosqlextra?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - //print '   '.$langs->trans("RunSql").''; - print '
'; - print ' '.$langs->trans("SqlFileKey").' : '.($realpathtosqlkey?'':'').$pathtosqlkey.($realpathtosqlkey?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - //print '   '.$langs->trans("RunSql").''; - print '
'; + print '
'; + print ' '.$langs->trans("SqlFile").' : '.($realpathtosql?'':'').$pathtosql.($realpathtosql?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '   '.$langs->trans("DropTableIfEmpty").''; + //print '   '.$langs->trans("RunSql").''; + print '
'; + print ' '.$langs->trans("SqlFileExtraFields").' : '.($realpathtosqlextra?'':'').$pathtosqlextra.($realpathtosqlextra?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + //print '   '.$langs->trans("RunSql").''; + print '
'; + print ' '.$langs->trans("SqlFileKey").' : '.($realpathtosqlkey?'':'').$pathtosqlkey.($realpathtosqlkey?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + //print '   '.$langs->trans("RunSql").''; + print '
'; - print '
'; - print '
'; + print '
'; + print '
'; - $urloflist = dol_buildpath($pathtolist, 1); - $urlofcard = dol_buildpath($pathtocard, 1); + $urloflist = dol_buildpath($pathtolist, 1); + $urlofcard = dol_buildpath($pathtocard, 1); - print '
'; - print ' '.$langs->trans("PageForList").' : '.($realpathtosql?'':'').$pathtolist.($realpathtosql?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("PageForCreateEditView").' : '.($realpathtocard?'':'').$pathtocard.($realpathtocard?'':'').'?action=create'; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda?'':'').$pathtoagenda.($realpathtoagenda?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument?'':'').$pathtodocument.($realpathtodocument?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote?'':'').$pathtonote.($realpathtonote?'':'').''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print '
'; + print ' '.$langs->trans("PageForList").' : '.($realpathtosql?'':'').$pathtolist.($realpathtosql?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("PageForCreateEditView").' : '.($realpathtocard?'':'').$pathtocard.($realpathtocard?'':'').'?action=create'; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("PageForAgendaTab").' : '.($realpathtoagenda?'':'').$pathtoagenda.($realpathtoagenda?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("PageForDocumentTab").' : '.($realpathtodocument?'':'').$pathtodocument.($realpathtodocument?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + print ' '.$langs->trans("PageForNoteTab").' : '.($realpathtonote?'':'').$pathtonote.($realpathtonote?'':'').''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; + print '
'; - print '
'; + print '
'; - print '


'; + print '


'; - if (empty($forceddirread)) - { - $result = dol_include_once($pathtoclass); - } - else - { - $result = @include_once($dirread.'/'.$pathtoclass); - } - if (class_exists($tabobj)) - { - try { - $tmpobjet = @new $tabobj($db); - } - catch(Exception $e) - { - dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); - } - } + if (empty($forceddirread)) + { + $result = dol_include_once($pathtoclass); + } + else + { + $result = @include_once($dirread.'/'.$pathtoclass); + } + if (class_exists($tabobj)) + { + try { + $tmpobjet = @new $tabobj($db); + } + catch(Exception $e) + { + dol_syslog('Failed to load Constructor of class: '.$e->getMessage(), LOG_WARNING); + } + } - if (! empty($tmpobjet)) - { - $reflector = new ReflectionClass($tabobj); - $properties = $reflector->getProperties(); // Can also use get_object_vars - $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars - //$propstat = $reflector->getStaticProperties(); + if (! empty($tmpobjet)) + { + $reflector = new ReflectionClass($tabobj); + $properties = $reflector->getProperties(); // Can also use get_object_vars + $propdefault = $reflector->getDefaultProperties(); // Can also use get_object_vars + //$propstat = $reflector->getStaticProperties(); - print load_fiche_titre($langs->trans("Properties"), '', ''); + print load_fiche_titre($langs->trans("Properties"), '', ''); - print '
'; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; + print '
'.$langs->trans("Property"); - print ' ('.$langs->trans("Example").')'; - print ''; - print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); - print ''.$langs->trans("Type").''.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).''.$langs->trans("NotNull").''.$langs->trans("DefaultValue").''.$langs->trans("DatabaseIndex").''.$langs->trans("Position").''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).''.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).''.$langs->trans("Comment").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $properties = dol_sort_array($tmpobjet->fields, 'position'); + $properties = dol_sort_array($tmpobjet->fields, 'position'); - if (! empty($properties)) - { - // Line to add a property - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + if (! empty($properties)) + { + // Line to add a property + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + //print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - foreach($properties as $propkey => $propval) - { - /* If from Reflection + foreach($properties as $propkey => $propval) + { + /* If from Reflection if ($propval->class == $tabobj) { $propname=$propval->getName(); @@ -1596,154 +1596,154 @@ elseif (! empty($module)) if (in_array($propname, array('fk_element', 'lines'))) continue; }*/ - $propname=$propkey; - $proplabel=$propval['label']; - $proptype=$propval['type']; - $proparrayofkeyval=$propval['arrayofkeyval']; - $propnotnull=$propval['notnull']; - $propsearchall=$propval['searchall']; - //$propdefault=$propval['default']; - $propindex=$propval['index']; - $propposition=$propval['position']; - $propenabled=$propval['enabled']; - $propvisible=$propval['visible']; - $propisameasure=$propval['isameasure']; - $propcomment=$propval['comment']; + $propname=$propkey; + $proplabel=$propval['label']; + $proptype=$propval['type']; + $proparrayofkeyval=$propval['arrayofkeyval']; + $propnotnull=$propval['notnull']; + $propsearchall=$propval['searchall']; + //$propdefault=$propval['default']; + $propindex=$propval['index']; + $propposition=$propval['position']; + $propenabled=$propval['enabled']; + $propvisible=$propval['visible']; + $propisameasure=$propval['isameasure']; + $propcomment=$propval['comment']; - print ''; + print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - /*print ''; + print ''; + print ''; + print ''; + print ''; + /*print '';*/ - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print ''; - } - } - else - { - print ''; - } - print '
'.$langs->trans("Property"); + print ' ('.$langs->trans("Example").')'; + print ''; + print $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")); + print ''.$langs->trans("Type").''.$form->textwithpicto($langs->trans("ArrayOfKeyValues"), $langs->trans("ArrayOfKeyValuesDesc")).''.$langs->trans("NotNull").''.$langs->trans("DefaultValue").''.$langs->trans("DatabaseIndex").''.$langs->trans("Position").''.$form->textwithpicto($langs->trans("Enabled"), $langs->trans("EnabledDesc")).''.$form->textwithpicto($langs->trans("Visible"), $langs->trans("VisibleDesc")).''.$form->textwithpicto($langs->trans("IsAMeasure"), $langs->trans("IsAMeasureDesc")).''.$form->textwithpicto($langs->trans("SearchAll"), $langs->trans("SearchAllDesc")).''.$langs->trans("Comment").'
'; - print ''; - print '
'; + print ''; + print '
'; - print $propname; - print ''; - print $proplabel; - print ''; - print $proptype; - print ''; - if ($proparrayofkeyval) - { - print json_encode($proparrayofkeyval); - } - print ''; - print $propnotnull; - print ''; + print ''; + print $propname; + print ''; + print $proplabel; + print ''; + print $proptype; + print ''; + if ($proparrayofkeyval) + { + print json_encode($proparrayofkeyval); + } + print ''; + print $propnotnull; + print ''; print $propdefault; print ''; - print $propindex?'X':''; - print ''; - print $propposition; - print ''; - print $propenabled?$propenabled:''; - print ''; - print $propvisible?$propvisible:''; - print ''; - print $propisameasure?$propisameasure:''; - print ''; - print $propsearchall?'X':''; - print ''; - print $propcomment; - print ''; - print ''.img_delete().''; - print ''; + print $propindex?'X':''; + print ''; + print $propposition; + print ''; + print $propenabled?$propenabled:''; + print ''; + print $propvisible?$propvisible:''; + print ''; + print $propisameasure?$propisameasure:''; + print ''; + print $propsearchall?'X':''; + print ''; + print $propcomment; + print ''; + print ''.img_delete().''; + print '
'.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').'
'; + print ''; + } + } + else + { + print ''.$langs->trans('Property $field not found into the class. The class was probably not generated by modulebuilder.').''; + } + print ''; print '
'; - print '
'; - } - else - { - print ''.$langs->trans('Failed to init the object with the new.').''; - } - } - catch(Exception $e) - { - print $e->getMessage(); - } - } - else - { - if (empty($forceddirread)) - { - $fullpathoffile=dol_buildpath($file, 0); - } - else - { - $fullpathoffile=$dirread.'/'.$file; - } + print ''; + } + else + { + print ''.$langs->trans('Failed to init the object with the new.').''; + } + } + catch(Exception $e) + { + print $e->getMessage(); + } + } + else + { + if (empty($forceddirread)) + { + $fullpathoffile=dol_buildpath($file, 0); + } + else + { + $fullpathoffile=$dirread.'/'.$file; + } - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print '
'; - } - } + print ''; + } + } - dol_fiche_end(); // Level 3 - } + dol_fiche_end(); // Level 3 + } - if ($tab == 'menus') - { - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + if ($tab == 'menus') + { + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; - //$menus = $moduleobj->; + //$menus = $moduleobj->; - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("MenusDefDesc", ''.$langs->trans('Menus').'').'
'; - print '
'; + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("MenusDefDesc", ''.$langs->trans('Menus').'').'
'; + print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; - //print load_fiche_titre($langs->trans("MenusList"), '', ''); + print '
'; + //print load_fiche_titre($langs->trans("MenusList"), '', ''); - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - /* + /* print '
'; print ''; @@ -1814,58 +1814,58 @@ elseif (! empty($module)) print ''; */ - } - else - { - $fullpathoffile=dol_buildpath($file, 0); + } + else + { + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print ''; - } - } + print ''; + } + } - if ($tab == 'permissions') - { - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + if ($tab == 'permissions') + { + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; - //$perms = $moduleobj->; + //$perms = $moduleobj->; - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("PermissionsDefDesc", ''.$langs->trans('DefaultPermissions').'').'
'; - print '
'; + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("PermissionsDefDesc", ''.$langs->trans('DefaultPermissions').'').'
'; + print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; - print load_fiche_titre($langs->trans("ListOfPermissionsDefined"), '', ''); + print '
'; + print load_fiche_titre($langs->trans("ListOfPermissionsDefined"), '', ''); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print 'TODO...'; /* @@ -1939,81 +1939,81 @@ elseif (! empty($module)) print ''; */ - } - else - { - $fullpathoffile=dol_buildpath($file, 0); + } + else + { + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print ''; - } - } + print ''; + } + } - if ($tab == 'hooks') - { - if ($action != 'editfile' || empty($file)) + if ($tab == 'hooks') + { + if ($action != 'editfile' || empty($file)) { print $langs->trans("HooksDefDesc").'
'; print '
'; - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; + $pathtohook = strtolower($module).'/class/actions_'.strtolower($module).'.class.php'; print ' '.$langs->trans("HooksFile").' : '.$pathtohook.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print ''; + print ''; } - } + } - if ($tab == 'triggers') - { - require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; + if ($tab == 'triggers') + { + require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; $interfaces = new Interfaces($db); $triggers = $interfaces->getTriggersList(array('/'.strtolower($module).'/core/triggers')); @@ -2025,14 +2025,14 @@ elseif (! empty($module)) if (! empty($triggers)) { - foreach ($triggers as $trigger) - { - $pathtofile = $trigger['relpath']; + foreach ($triggers as $trigger) + { + $pathtofile = $trigger['relpath']; - print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } + print ' '.$langs->trans("TriggersFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } } else { @@ -2041,34 +2041,34 @@ elseif (! empty($module)) } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print ''; + print ''; } - } + } - if ($tab == 'widgets') - { - require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + if ($tab == 'widgets') + { + require_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; $widgets = ModeleBoxes::getWidgetsList(array('/'.strtolower($module).'/core/boxes')); @@ -2076,260 +2076,260 @@ elseif (! empty($module)) { if (! empty($widget)) { - foreach ($widgets as $widget) - { - $pathtofile = $widget['relpath']; + foreach ($widgets as $widget) + { + $pathtofile = $widget['relpath']; - print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; - } - } - else - { - print $langs->trans("NoWidget"); - } + print ' '.$langs->trans("WidgetFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + } + } + else + { + print $langs->trans("NoWidget"); + } } else { - $fullpathoffile=dol_buildpath($file, 0); + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print ''; + print ''; } - } + } - if ($tab == 'cron') - { - $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + if ($tab == 'cron') + { + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; - $cronjobs = $moduleobj->cronjobs; + $cronjobs = $moduleobj->cronjobs; - if ($action != 'editfile' || empty($file)) - { - print $langs->trans("CronJobDefDesc", ''.$langs->trans('CronList').'').'
'; - print '
'; + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("CronJobDefDesc", ''.$langs->trans('CronList').'').'
'; + print '
'; - print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; - print ' '.img_picto($langs->trans("Edit"), 'edit').''; - print '
'; + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; - print '
'; - print load_fiche_titre($langs->trans("CronJobProfiles"), '', ''); + print '
'; + print load_fiche_titre($langs->trans("CronJobProfiles"), '', ''); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - print '
'; - print '
'; + print '
'; + print '
'; - print ''; - print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); - print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print "\n"; + print ''; + print_liste_field_titre("CronLabel",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("CronTask",'','',"",$param,'',$sortfield,$sortorder); + print_liste_field_titre("CronFrequency",'',"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("StatusAtInstall",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre("Comment",$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print "\n"; - if (count($cronjobs)) - { - foreach ($cronjobs as $cron) - { - print ''; + if (count($cronjobs)) + { + foreach ($cronjobs as $cron) + { + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; - print ''; - } - } - else - { - print ''; - } + print ''; + } + } + else + { + print ''; + } - print '
'; - print $cron['label']; - print ''; + print $cron['label']; + print ''; - if ($cron['jobtype']=='method') - { - $text=$langs->trans("CronClass"); - $texttoshow=$langs->trans('CronModule').': '.$module.'
'; - $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'
'; - $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'
'; - $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; - $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; - $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); - } - elseif ($cron['jobtype']=='command') - { - $text=$langs->trans('CronCommand'); - $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); - $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; - $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); - } - print $form->textwithpicto($text, $texttoshow, 1); - print '
'; + if ($cron['jobtype']=='method') + { + $text=$langs->trans("CronClass"); + $texttoshow=$langs->trans('CronModule').': '.$module.'
'; + $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'
'; + $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'
'; + $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; + $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; + $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); + } + elseif ($cron['jobtype']=='command') + { + $text=$langs->trans('CronCommand'); + $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); + $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; + $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); + } + print $form->textwithpicto($text, $texttoshow, 1); + print '
'; - if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); - if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); - if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); - if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); - print ''; + if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); + if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); + if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); + if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); + print ''; - print $cron['status']; - print ''; + print $cron['status']; + print ''; - if (!empty($cron['comment'])) {print $cron['comment'];} - print ''; + if (!empty($cron['comment'])) {print $cron['comment'];} + print '
'.$langs->trans("None").'
'.$langs->trans("None").'
'; - print '
'; + print ''; + print '
'; - print ''; - } - else - { - $fullpathoffile=dol_buildpath($file, 0); + print ''; + } + else + { + $fullpathoffile=dol_buildpath($file, 0); - $content = file_get_contents($fullpathoffile); + $content = file_get_contents($fullpathoffile); - // New module - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; - $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); - print '
'; - print '
'; - print ''; - print '   '; - print ''; - print '
'; + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; - print '
'; - } - } + print ''; + } + } - if ($tab == 'buildpackage') - { - if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) - { - print img_warning().' '.$langs->trans("ErrNoZipEngine"); - print '
'; - } + if ($tab == 'buildpackage') + { + if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) + { + print img_warning().' '.$langs->trans("ErrNoZipEngine"); + print '
'; + } - $modulelowercase=strtolower($module); + $modulelowercase=strtolower($module); - // Zip file to build - $FILENAMEZIP=''; + // Zip file to build + $FILENAMEZIP=''; - // Load module - dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); - $class='mod'.$module; + // Load module + dol_include_once($modulelowercase.'/core/modules/mod'.$module.'.class.php'); + $class='mod'.$module; - if (class_exists($class)) - { - try { - $moduleobj = new $class($db); - } - catch(Exception $e) - { - $error++; - dol_print_error($e->getMessage()); - } - } - else - { - $error++; - $langs->load("errors"); - dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); - exit; - } + if (class_exists($class)) + { + try { + $moduleobj = new $class($db); + } + catch(Exception $e) + { + $error++; + dol_print_error($e->getMessage()); + } + } + else + { + $error++; + $langs->load("errors"); + dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); + exit; + } - $arrayversion=explode('.',$moduleobj->version,3); - if (count($arrayversion)) - { - $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; - $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; + $arrayversion=explode('.',$moduleobj->version,3); + if (count($arrayversion)) + { + $FILENAMEZIP="module_".$modulelowercase.'-'.$arrayversion[0].'.'.$arrayversion[1].($arrayversion[2]?".".$arrayversion[2]:"").".zip"; + $outputfilezip = dol_buildpath($modulelowercase, 0).'/bin/'.$FILENAMEZIP; - $FILENAMEDOC=$modulelowercase.'.html'; - $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; - } + $FILENAMEDOC=$modulelowercase.'.html'; + $outputfiledoc = dol_buildpath($modulelowercase, 0).'/doc/'.$FILENAMEDOC; + } - print '
'; + print '
'; - print ' '. $langs->trans("PathToModulePackage") . ' : '; - if (! dol_is_file($outputfilezip)) print ''.$langs->trans("FileNotYetGenerated").''; - else { - $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; - print ''.$outputfilezip.''; - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; - } - print '

'; + print ' '. $langs->trans("PathToModulePackage") . ' : '; + if (! dol_is_file($outputfilezip)) print ''.$langs->trans("FileNotYetGenerated").''; + else { + $relativepath = $modulelowercase.'/bin/'.$FILENAMEZIP; + print ''.$outputfilezip.''; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfilezip), 'dayhour').')'; + } + print '
'; - print '
'; + print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; - print '


'; + print '


'; - print ' '. $langs->trans("PathToModuleDocumentation") . ' : '; - if (! dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").''; - else { - print ''.$outputfiledoc.''; - print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; - } - print '
'; + print ' '. $langs->trans("PathToModuleDocumentation") . ' : '; + if (! dol_is_file($outputfiledoc)) print ''.$langs->trans("FileNotYetGenerated").''; + else { + print ''.$outputfiledoc.''; + print ' ('.$langs->trans("GeneratedOn").' '.dol_print_date(dol_filemtime($outputfiledoc), 'dayhour').')'; + } + print '
'; - print '
'; + print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - print '
'; - } + print '
'; + print ''; + print ''; + print ''; + print ''; + print '
'; + } - if ($tab != 'description') - { - dol_fiche_end(); - } - } + if ($tab != 'description') + { + dol_fiche_end(); + } + } } dol_fiche_end(); // End modules