reduced upload code

This commit is contained in:
Roland Gruber 2014-04-18 09:03:31 +00:00
parent f564879f09
commit 1372c4645a
4 changed files with 13 additions and 38 deletions

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 Roland Gruber
Copyright (C) 2013 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -236,9 +236,7 @@ class pykotaBillingCode extends baseModule {
$partialAccounts[$i]['pykotaBillingCode'] = $rawAccounts[$i][$ids['pykotaBillingCode_pykotaBillingCode']];
}
// description
if (!empty($rawAccounts[$i][$ids['pykotaBillingCode_description']])) {
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaBillingCode_description']];
}
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaBillingCode_description', 'description');
// balance
$partialAccounts[$i]['pykotaBalance'] = '0.0';
// page count

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 Roland Gruber
Copyright (C) 2013 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -416,9 +416,7 @@ class pykotaGroup extends baseModule {
}
}
// description
if ($this->manageDescription() && !empty($rawAccounts[$i][$ids['pykotaGroup_description']])) {
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaGroup_description']];
}
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaGroup_description', 'description');
// PyKota group name
if (!empty($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']])) {
if (!get_preg($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']], 'groupname')) {

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 Roland Gruber
Copyright (C) 2013 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -480,24 +480,11 @@ class pykotaPrinter extends baseModule {
}
}
// description
if (!empty($rawAccounts[$i][$ids['pykotaPrinter_description']])) {
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaPrinter_description']];
}
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaPrinter_description', 'description');
// job size
if (!empty($rawAccounts[$i][$ids['pykotaPrinter_pykotaMaxJobSize']])) {
$pykotaMaxJobSize = $rawAccounts[$i][$ids['pykotaPrinter_pykotaMaxJobSize']];
if (!get_preg($pykotaMaxJobSize, 'digit')) {
$errMsg = $this->messages['pykotaMaxJobSize'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
else {
$partialAccounts[$i]['pykotaMaxJobSize'] = $pykotaMaxJobSize;
}
}
else {
$partialAccounts[$i]['pykotaMaxJobSize'] = '0.0';
}
$partialAccounts[$i]['pykotaMaxJobSize'] = '0.0';
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaPrinter_pykotaMaxJobSize', 'pykotaMaxJobSize',
'digit', $this->messages['pykotaMaxJobSize'][1], $messages);
// price per job
if (!empty($rawAccounts[$i][$ids['pykotaPrinter_pykotaPricePerJob']])) {
$pykotaPricePerJob = $rawAccounts[$i][$ids['pykotaPrinter_pykotaPricePerJob']];

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 Roland Gruber
Copyright (C) 2013 - 2014 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -795,19 +795,11 @@ class pykotaUser extends baseModule {
}
// mail
if ($this->manageUid() && !empty($rawAccounts[$i][$ids['pykotaUser_mail']])) {
if (!get_preg($rawAccounts[$i][$ids['pykotaUser_mail']], 'email')) {
$errMsg = $this->messages['mail'][1];
array_push($errMsg, array($i));
$messages[] = $errMsg;
}
else {
$partialAccounts[$i]['mail'] = $rawAccounts[$i][$ids['pykotaUser_mail']];
}
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaUser_mail', 'mail',
'email', $this->messages['mail'][1], $messages);
}
// description
if ($this->manageDescription() && !empty($rawAccounts[$i][$ids['pykotaUser_description']])) {
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaUser_description']];
}
$this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaUser_description', 'description');
// PyKota user name
if (!empty($rawAccounts[$i][$ids['pykotaUser_pykotaUserName']])) {
if (!get_preg($rawAccounts[$i][$ids['pykotaUser_pykotaUserName']], 'username')) {