Commit 94c9617e authored by Till Brehm's avatar Till Brehm
Browse files

- Added support for reseller templates.

- Resellers can use templates for their clients.
parent 23229cb3
......@@ -106,9 +106,10 @@ class client_templates {
/*
* Get the master-template for the client
*/
$sql = "SELECT template_master, template_additional FROM client WHERE client_id = " . $app->functions->intval($clientId);
$sql = "SELECT template_master, template_additional,limit_client FROM client WHERE client_id = " . $app->functions->intval($clientId);
$record = $app->db->queryOneRecord($sql);
$masterTemplateId = $record['template_master'];
$is_reseller = ($record['limit_client'] > 0)?true:false;
if($record['template_additional'] != '') {
// we have to call the update_client_templates function
......@@ -222,6 +223,7 @@ class client_templates {
* Write all back to the database
*/
$update = '';
if(!$is_reseller) unset($limits['limit_client']); // Only Resellers may have limit_client set in template to ensure that we do not convert a client to reseller accidently.
foreach($limits as $k => $v){
if ((strpos($k, 'limit') !== false or $k == 'ssh_chroot' or $k == 'web_php_options' or $k == 'force_suexec') && !is_array($v)){
if ($update != '') $update .= ', ';
......
......@@ -32,7 +32,7 @@ class custom_datasource {
function master_templates($field, $record) {
global $app, $conf;
$records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m'");
$records = $app->db->queryAllRecords("SELECT template_id,template_name FROM client_template WHERE template_type ='m' and ".$app->tform->getAuthSQL('r'));
$records_new[0] = $app->lng('Custom');
foreach($records as $rec) {
$key = $rec['template_id'];
......
......@@ -92,6 +92,11 @@ class page_action extends tform_actions {
}
}
}
//* Resellers shall not be able to create another reseller
if($_SESSION["s"]["user"]["typ"] == 'user') {
$this->dataRecord['limit_client'] = 0;
}
if($this->id != 0) {
$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $this->id);
......
......@@ -51,6 +51,18 @@ $app->load('tform_actions');
class page_action extends tform_actions {
function onSubmit() {
global $app;
//* Resellers shall not be able to create another reseller
if($_SESSION["s"]["user"]["typ"] == 'user') {
$this->dataRecord['limit_client'] = 0;
}
parent::onSubmit();
}
function onBeforeUpdate() {
global $app;
......
......@@ -101,6 +101,20 @@ $form["tabs"]['limits'] = array (
//#################################
// Begin Datatable fields
//#################################
'limit_client' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'ISINT',
'errmsg'=> 'limit_client_error_notint'),
),
'default' => '1',
'value' => '',
'separator' => '',
'width' => '10',
'maxlength' => '10',
'rows' => '',
'cols' => ''
),
'limit_maildomain' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Ограничения';
$wb['Add Client'] = 'Добавяне на клиент';
$wb['Edit Client'] = 'Редактиране на клиент';
$wb['Clients'] = 'Клиенти';
$wb['Edit Client-Templates'] = 'Редактирай Клиентски-Шаблон';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Добави дистрибутор';
$wb['Edit Reseller'] = 'Редактирай дистрибутор';
$wb['Resellers'] = 'Дистрибутори';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites';
$wb['Add Client'] = 'Adcionar Cliente';
$wb['Edit Client'] = 'Editar Cliente';
$wb['Clients'] = 'Clientes';
$wb['Edit Client-Templates'] = 'Editar Gabaritos de Clientes';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Adcionar Revendedor';
$wb['Edit Reseller'] = 'Editar Revendedor';
$wb['Resellers'] = 'Revendedores';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limity';
$wb['Add Client'] = 'Přidat klienta';
$wb['Edit Client'] = 'Upravit klienta';
$wb['Clients'] = 'Klienti';
$wb['Edit Client-Templates'] = 'Upravit klientské šablony';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Přidat distributora';
$wb['Edit Reseller'] = 'Upravit distributora';
$wb['Resellers'] = 'Distributoři (prodejci)';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Kunde hinzufügen';
$wb['Edit Client'] = 'Kunde bearbeiten';
$wb['Clients'] = 'Kunden';
$wb['Edit Client-Templates'] = 'Kundenvorlagen';
$wb['Templates'] = 'Vorlagen';
$wb['Limit-Templates'] = 'Kundenvorlagen';
$wb['Add Reseller'] = 'Reseller hinzufügen';
$wb['Edit Reseller'] = 'Reseller bearbeiten';
$wb['Resellers'] = 'Reseller';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Όρια';
$wb['Add Client'] = 'Νέος Πελάτης';
$wb['Edit Client'] = 'Επεξεργασία Πελάτη';
$wb['Clients'] = 'Πελάτες';
$wb['Edit Client-Templates'] = 'Επεξεργασία προτύπων πελατών';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Νέος Μεταπωλητής';
$wb['Edit Reseller'] = 'Επεξεργασία Μεταπωλητή';
$wb['Resellers'] = 'Μεταπωλητές';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limits';
$wb['Add Client'] = 'Add Client';
$wb['Edit Client'] = 'Edit Client';
$wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Edit Client-Templates';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Add Reseller';
$wb['Edit Reseller'] = 'Edit Reseller';
$wb['Resellers'] = 'Resellers';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Límites';
$wb['Add Client'] = 'Añadir cliente';
$wb['Edit Client'] = 'Editar cliente';
$wb['Clients'] = 'Clientes';
$wb['Edit Client-Templates'] = 'Editar plantillas de clientes';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Añadir revendedor';
$wb['Edit Reseller'] = 'Editar revendedor';
$wb['Resellers'] = 'Revendedores';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Rajoitukset';
$wb['Add Client'] = 'Lisää asiakas';
$wb['Edit Client'] = 'Muokkaa asiakkaan tietoja';
$wb['Clients'] = 'Asiakkaat';
$wb['Edit Client-Templates'] = 'Muokkaa asiakasmalleja';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Lisää uusi jälleenmyyjä';
$wb['Edit Reseller'] = 'Muokkaa jälleenmyyjää';
$wb['Resellers'] = 'Jälleenmyyjät';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limites';
$wb['Add Client'] = 'Ajouter un Client';
$wb['Edit Client'] = 'Editer un Client';
$wb['Clients'] = 'Clients';
$wb['Edit Client-Templates'] = 'Editer les modèles de Clients';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Ajouter un Revendeur';
$wb['Edit Reseller'] = 'Editer un Revendeur';
$wb['Resellers'] = 'Revendeurs';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limiti';
$wb['Add Client'] = 'Dodaj klijenta';
$wb['Edit Client'] = 'Editiraj klijenta';
$wb['Clients'] = 'Klijenti';
$wb['Edit Client-Templates'] = 'Editiraj predložak za klijente';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Dodaj preprodavača';
$wb['Edit Reseller'] = 'Editiraj preprodavača';
$wb['Resellers'] = 'Preprodavači';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Korlátok';
$wb['Add Client'] = 'Ügyfél hozzáadása';
$wb['Edit Client'] = 'Ügyfél adatok szerkesztése';
$wb['Clients'] = 'Ügyfelek';
$wb['Edit Client-Templates'] = 'Ügyfél-Sablonok szerkesztése';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Új Viszonteladó';
$wb['Edit Reseller'] = 'Viszonteladók szerkesztése';
$wb['Resellers'] = 'Viszonteladók';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Batasan';
$wb['Add Client'] = 'Tambah Klien';
$wb['Edit Client'] = 'Sunting Klien';
$wb['Clients'] = 'Klien';
$wb['Edit Client-Templates'] = 'Sunting Template Klien';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Tambah Reseller';
$wb['Edit Reseller'] = 'Sunting Reseller';
$wb['Resellers'] = 'Reseller';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = '制限';
$wb['Add Client'] = 'クライアントを追加する';
$wb['Edit Client'] = 'クライアントを編集する';
$wb['Clients'] = 'クライアント';
$wb['Edit Client-Templates'] = 'クライアントテンプレートを編集する';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'リセラーを追加する';
$wb['Edit Reseller'] = 'リセラーを編集する';
$wb['Resellers'] = 'リセラー';
......
......@@ -5,7 +5,8 @@ $wb['Limits'] = 'Limieten';
$wb['Add Client'] = 'Toevoegen klant';
$wb['Edit Client'] = 'Wijzigen klant';
$wb['Clients'] = 'klanten';
$wb['Edit Client-Templates'] = 'Wijzig klant-template';
$wb['Templates'] = 'Templates';
$wb['Limit-Templates'] = 'Limit-Templates';
$wb['Add Reseller'] = 'Toevoegen Reseller';
$wb['Edit Reseller'] = 'Wijzigen Reseller';
$wb['Resellers'] = 'Resellers';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment