import: fix some PHP warnings and update comments

This commit is contained in:
Benjamin Renard 2021-02-04 12:35:14 +01:00
parent 7af066f4c2
commit 7ecfa33afc
3 changed files with 16 additions and 16 deletions

View file

@ -98,7 +98,7 @@ class LSimport extends LSlog_staticLoggerClass {
}
/**
* Import objects form POST data
* Import objects from POST data
*
* This method retreive, validate and import POST data.
*
@ -106,6 +106,11 @@ class LSimport extends LSlog_staticLoggerClass {
*
*
* array (
* 'success' => boolean,
* 'LSobject' => '[object type]',
* 'ioFormat' => '[ioFormat name]',
* 'justTry' => boolean,
* 'updateIfExists' => boolean,
* 'imported' => array (
* '[object1 dn]' => '[object1 display name]',
* '[object2 dn]' => '[object2 display name]',
@ -139,7 +144,7 @@ class LSimport extends LSlog_staticLoggerClass {
*
* @author Benjamin Renard <brenard@easter-eggs.com>
*
* @retval boolean Array of the import result, false on error
* @retval array Array of the import result
*/
public static function importFromPostData() {
// Get data from $_POST

View file

@ -781,26 +781,21 @@ function handle_LSobject_import($request) {
return;
$ioFormats = array();
$result = null;
if ( LSsession :: loadLSclass('LSimport')) {
$result = array();
if ( LSsession :: loadLSclass('LSimport', null, true)) { // import class with warning
$ioFormats = $object->listValidIOformats();
if (is_array($ioFormats) && !empty($ioFormats)) {
if (LSimport::isSubmit()) {
$result = LSimport::importFromPostData();
LSlog :: debug("LSimport::importFromPostData(): result = ".varDump($result));
}
}
else {
if (!is_array($ioFormats) || empty($ioFormats)) {
$ioFormats = array();
LSerror :: addErrorCode('LSsession_16');
}
}
else {
LSerror :: addErrorCode('LSsession_05','LSimport');
else if (LSimport::isSubmit()) {
$result = LSimport::importFromPostData();
LSlog :: debug("LSimport::importFromPostData(): result = ".varDump($result));
}
}
// Define page title & template variables
LStemplate :: assign('pagetitle',_('Import').' : '.$object->getLabel());
LStemplate :: assign('pagetitle', _('Import').' : '.$object->getLabel());
LStemplate :: assign('LSobject', $object -> getType());
LStemplate :: assign('ioFormats', $ioFormats);
LStemplate :: assign('result', $result);

View file

@ -37,7 +37,7 @@
</dl>
</form>
</div>
{if is_array($result)}
{if $result}
<h1>{tr msg='Result'}</h1>
{if !empty($result.errors)}
<h2>{tr msg='Errors'}</h2>