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
pull/2/head
Christian Boltz 10 years ago
parent 9093a946b4
commit f07281cdc1

@ -128,16 +128,20 @@ abstract class PFAHandler {
* *
* available values for the "type" column: * available values for the "type" column:
* text one line of text * text one line of text
* *vtxt "virtual" line of text, coming from JOINs etc.
* pass password (will be encrypted with pacrypt()) * pass password (will be encrypted with pacrypt())
* num number * num number
* txtl text "list" - array of one line texts * 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) * bool boolean (converted to 0/1, additional column _$field with yes/no)
* ts timestamp (created/modified) * ts timestamp (created/modified)
* enum list of options, must be given in column "options" as array * 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 * enma list of options, must be given in column "options" as associative array
* list like enum, but allow multiple selections * 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 * 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. * All database tables should have a 'created' and a 'modified' column.
* *
@ -373,6 +377,11 @@ abstract class PFAHandler {
case 'pass': case 'pass':
$db_values[$key] = pacrypt($db_values[$key]); $db_values[$key] = pacrypt($db_values[$key]);
break; 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]['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 if ($this->struct[$key]['dont_write_to_db'] == 1) unset ($db_values[$key]); # remove 'dont_write_to_db' columns

Loading…
Cancel
Save