/**
  * Get a system default value
  * 
  * @param mixed $name
  * @return mixed
  */
 public function findByName($name)
 {
     switch ($name) {
         case 'biller':
             $SI_BILLER = new SimpleInvoices_Db_Table_Biller();
             return $SI_BILLER->getDefault();
             break;
         case 'customer':
             $SI_CUSTOMERS = new SimpleInvoices_Db_Table_Customers();
             return $SI_CUSTOMERS->getDefault();
             break;
         case 'payment_type':
             $SI_PAYMENT_TYPES = new SimpleInvoices_Db_Table_PaymentTypes();
             return $SI_PAYMENT_TYPES->getDefault();
             break;
         case 'preference':
             $SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();
             return $SI_PREFERENCES->getDefault();
             break;
         case 'tax':
             $SI_TAX = new SimpleInvoices_Db_Table_Tax();
             return $SI_TAX->getDefault();
             break;
         default:
             $auth_session = Zend_Registry::get('auth_session');
             $select = $this->select();
             $select->where('name = ?', $name);
             $select->where('domain_id = ?', $auth_session->domain_id);
             $result = $this->getAdapter()->fetchRow($select);
             return $result['value'];
             break;
     }
 }
Example #2
0
$SI_PRODUCTS = new SimpleInvoices_Db_Table_Products();
$SI_SYSTEM_DEFAULTS = new SimpleInvoices_Db_Table_SystemDefaults();
$SI_CUSTOMERS = new SimpleInvoices_Db_Table_Customers();
$SI_TAX = new SimpleInvoices_Db_Table_Tax();
$SI_BILLER = new SimpleInvoices_Db_Table_Biller();
$SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();

$billers = $SI_BILLER->fetchAllActive();
$customers = $SI_CUSTOMERS->fetchAllActive();
$taxes = $SI_TAX->fetchAllActive();
$products = $SI_PRODUCTS->findActive();
$preferences = $SI_PREFERENCES->fetchAllActive();
$defaults = $SI_SYSTEM_DEFAULTS->fetchAll();


$defaultBiller = $SI_BILLER->getDefault();
$defaultCustomerID = (isset($_GET['customer_id'])) ? $_GET['customer_id'] : $SI_CUSTOMERS->getDefault();
$defaultTax = $SI_TAX->getDefault();
$defaultPreference = $SI_PREFERENCES->getDefault();

if (!empty( $_GET['get_num_line_items'] )) {
	$dynamic_line_items = $_GET['get_num_line_items'];
} 
else {
	$dynamic_line_items = $defaults['line_items'] ;
}

for($i=1;$i<=4;$i++) {
	$show_custom_field[$i] = show_custom_field("invoice_cf$i",'',"write",'',"details_screen",'','','');
}
Example #3
0
		break;
	}
}

// Default delete
$defaults['delete'] = $system_defaults->findByName('delete');
$defaults['delete'] = $defaults['delete']==1?$LANG['enabled']:$LANG['disabled'];

// Default Logging
$defaults['logging'] = $system_defaults->findByName('logging');
$defaults['logging'] = $defaults['logging']==1?$LANG['enabled']:$LANG['disabled'];

// Default inventory
$defaults['inventory'] = $system_defaults->findByName('inventory');
$defaults['inventory'] = $defaults['inventory']==1?$LANG['enabled']:$LANG['disabled'];


$smarty -> assign("defaults", $SI_SYSTEM_DEFAULTS->fetchAll());
$smarty -> assign("defaultBiller", $SI_BILLER->getDefault());
$smarty -> assign("defaultCustomer", $SI_CUSTOMERS->getDefault());
$smarty -> assign("defaultTax", $SI_TAX->getDefault());
$smarty -> assign("defaultPreference", $SI_PREFERENCES->getDefault());
$smarty -> assign("defaultPaymentType", $SI_PAYMENT_TYPES->getDefault());
$smarty -> assign("defaultDelete", $defaults['delete']);
$smarty -> assign("defaultLogging", $defaults['logging']);
$smarty -> assign("defaultInventory", $defaults['inventory']);
$smarty -> assign("defaultLanguage", $lang);

$smarty -> assign('pageActive', 'system_default');
$smarty -> assign('active_tab', '#setting');
?>