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$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) 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 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 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']]; $partialAccounts[$i]['pykotaBillingCode'] = $rawAccounts[$i][$ids['pykotaBillingCode_pykotaBillingCode']];
} }
// description // description
if (!empty($rawAccounts[$i][$ids['pykotaBillingCode_description']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaBillingCode_description', 'description');
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaBillingCode_description']];
}
// balance // balance
$partialAccounts[$i]['pykotaBalance'] = '0.0'; $partialAccounts[$i]['pykotaBalance'] = '0.0';
// page count // page count

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) 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 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 it under the terms of the GNU General Public License as published by
@ -416,9 +416,7 @@ class pykotaGroup extends baseModule {
} }
} }
// description // description
if ($this->manageDescription() && !empty($rawAccounts[$i][$ids['pykotaGroup_description']])) { $this->mapSimpleUploadField($rawAccounts, $ids, $partialAccounts, $i, 'pykotaGroup_description', 'description');
$partialAccounts[$i]['description'] = $rawAccounts[$i][$ids['pykotaGroup_description']];
}
// PyKota group name // PyKota group name
if (!empty($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']])) { if (!empty($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']])) {
if (!get_preg($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']], 'groupname')) { if (!get_preg($rawAccounts[$i][$ids['pykotaGroup_pykotaGroupName']], 'groupname')) {

View File

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

View File

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