From f07281cdc1de6fd9102358452672bd10f71e5f2c Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sat, 1 Nov 2014 19:25:11 +0000 Subject: [PATCH] PFAHandler: - automatically skip quot, vnum and vtxt fields in store() (as if dont_write_to_db == 1) - document new field types vtxt and quot and mark field types that will never be stored in db git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1713 a1433add-5e2c-0410-b055-b7f2511e0802 --- model/PFAHandler.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/model/PFAHandler.php b/model/PFAHandler.php index 52b03d94..31a0fd7a 100644 --- a/model/PFAHandler.php +++ b/model/PFAHandler.php @@ -128,16 +128,20 @@ abstract class PFAHandler { * * available values for the "type" column: * text one line of text + * *vtxt "virtual" line of text, coming from JOINs etc. * pass password (will be encrypted with pacrypt()) * num number * txtl text "list" - array of one line texts - * vnum "virtual" number, coming from JOINs etc. + * *vnum "virtual" number, coming from JOINs etc. * bool boolean (converted to 0/1, additional column _$field with yes/no) * ts timestamp (created/modified) * enum list of options, must be given in column "options" as array * enma list of options, must be given in column "options" as associative array * list like enum, but allow multiple selections + * *quot used / total quota ("5 / 10") - for field "quotausage", there must also be a "_quotausage_percent" (type vnum) * You can use custom types, but you'll have to add handling for them in *Handler and the smarty templates + * + * Field types marked with * will automatically be skipped in store(). * * All database tables should have a 'created' and a 'modified' column. * @@ -373,6 +377,11 @@ abstract class PFAHandler { case 'pass': $db_values[$key] = pacrypt($db_values[$key]); break; + case 'quot': + case 'vnum': + case 'vtxt': + unset ($db_values[$key]); # virtual field, never write it + break; } if ($this->struct[$key]['not_in_db'] == 1) unset ($db_values[$key]); # remove 'not in db' columns if ($this->struct[$key]['dont_write_to_db'] == 1) unset ($db_values[$key]); # remove 'dont_write_to_db' columns