Ejemplo n.º 1
0
 public function run()
 {
     $tpl = new template();
     $language = new language();
     $language->setModule('leads');
     $language->readIni();
     if (isset($_POST['save'])) {
         if (isset($_POST['name']) && isset($_POST['money']) && isset($_POST['referralSource'])) {
             $refValue = '';
             if ($_POST['referralValueOther'] != '') {
                 $refValue = $_POST['referralValueOther'];
             } else {
                 if ($_POST['referralSource'] == 5 && $_POST['referralValueClient'] > 0) {
                     $refValue = $_POST['referralValueClient'];
                 }
             }
             $values = array('name' => $_POST['name'], 'refSource' => $_POST['referralSource'], 'refValue' => $refValue, 'potentialMoney' => $_POST['money'], 'creatorId' => $_SESSION['userdata']['id']);
             $contact = array('name' => $_POST['clientName'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'email' => $_POST['email'], 'internet' => $_POST['internet']);
             if ($this->isLead($values['name']) !== true) {
                 $leadId = $this->addLead($values);
                 $this->addLeadContact($contact, $leadId);
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
             } else {
                 $tpl->setNotification('LEAD_EXISTS', 'error');
             }
         } else {
             $tpl->setNotification('MISSING_FIELDS', 'error');
         }
     }
     $client = new clients();
     $tpl->assign('referralSources', $this->getReferralSources());
     $tpl->assign('clients', $client->getAll());
     $tpl->display('leads.addLead');
 }
Ejemplo n.º 2
0
 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     $users = new users();
     $clients = new clients();
     if ($id && $id > 0) {
         $lead = $this->getLead($id);
         $contact = $this->getLeadContact($id);
         $values = array('user' => $contact['email'], 'password' => '', 'firstname' => '', 'lastname' => '', 'phone' => $contact['phone'], 'role' => 3, 'clientId' => $lead['clientId']);
         if (isset($_POST['save'])) {
             if (isset($_POST['user']) && isset($_POST['firstname']) && isset($_POST['lastname'])) {
                 $hasher = new PasswordHash(8, TRUE);
                 $values = array('user' => $_POST['user'], 'password' => $hasher->HashPassword($_POST['password']), 'firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'clientId' => $_POST['clientId']);
                 if ($users->usernameExist($values['user']) !== true) {
                     $users->addUser($values);
                     $tpl->setNotification('USER_CREATED', 'success');
                 } else {
                     $tpl->setNotification('USERNAME_EXISTS', 'error');
                 }
             } else {
                 $tpl->setNotification('MISSING_FIELDS', 'error');
             }
         }
         $tpl->assign('values', $values);
         $tpl->assign('clients', $clients->getAll());
         $tpl->assign('roles', $users->getRoles());
         $tpl->display('leads.convertToUser');
     } else {
         $tpl->display('general.error');
     }
 }
Ejemplo n.º 3
0
 function get($clientid)
 {
     $clientid = mysql_real_escape_string($clientid);
     $thetable = new clients($this->db, "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083");
     $clientRecord = $thetable->getRecord($clientid, true);
     $clientRecord["invoices"] = $this->_getInvoices($clientid);
     $clientRecord["notes"] = $this->_getnotes($clientid);
     return $clientRecord;
 }
Ejemplo n.º 4
0
 public function run()
 {
     $tpl = new template();
     $id = (int) $_GET['id'];
     if ($id > 0) {
         $lead = $this->getLead($id);
         $values = array('name' => $lead['name'], 'potentialMoney' => $lead['potentialMoney'], 'actualMoney' => $lead['actualMoney'], 'refSource' => $lead['refSource'], 'refValue' => $lead['refValue'], 'status' => $lead['status'], 'proposal' => $lead['proposal']);
         $clients = new clients();
         $dbClient = $clients->getClient($lead['clientId']);
         $client = array('name' => $dbClient['name'], 'street' => $dbClient['street'], 'zip' => $dbClient['zip'], 'city' => $dbClient['city'], 'state' => $dbClient['state'], 'country' => $dbClient['country'], 'phone' => $dbClient['phone'], 'email' => $dbClient['email'], 'internet' => $dbClient['internet']);
         if (isset($_POST['save'])) {
             if (isset($_FILES['file'])) {
                 if (htmlspecialchars($_FILES['file']['name']) !== '') {
                     $file = new files();
                     $file->upload($_FILES, 'lead', $id);
                 }
             }
             if (isset($_POST['name']) && isset($_POST['referralSource']) && isset($_POST['money']) && isset($_POST['status'])) {
                 $refValue = '';
                 if ($_POST['referralSource'] && $_POST['referralValueOther'] != '') {
                     $refValue = $_POST['referralValueOther'];
                 } else {
                     if ($_POST['referralSource'] == 5 && $_POST['referralValueClient'] > 0) {
                         $refValue = $_POST['referralValueClient'];
                     }
                 }
                 $values = array('name' => $_POST['name'], 'potentialMoney' => $_POST['money'], 'actualMoney' => $_POST['actualMoney'], 'refSource' => $_POST['referralSource'], 'refValue' => $refValue, 'status' => $_POST['status']);
                 $client = array('name' => $_POST['clientName'], 'street' => $_POST['street'], 'zip' => $_POST['zip'], 'city' => $_POST['city'], 'state' => $_POST['state'], 'country' => $_POST['country'], 'phone' => $_POST['phone'], 'email' => $_POST['email'], 'internet' => $_POST['internet']);
                 $this->editLead($values, $id);
                 $clients->editClient($client, $lead['clientId']);
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
             } else {
                 $tpl->setNotification('MISSING_FIELDS', 'error');
             }
         }
         $tpl->assign('client', $client);
         $tpl->assign('lead', $values);
     } else {
         $tpl->display('general.error');
     }
     $client = new clients();
     $tpl->assign('status', $this->getStatus());
     $tpl->assign('referralSources', $this->getReferralSources());
     $tpl->assign('clients', $client->getAll());
     $tpl->display('leads.editLead');
 }
Ejemplo n.º 5
0
 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $hasher = new PasswordHash(8, TRUE);
     //only Admins
     if ($_SESSION['userdata']['role'] == 'admin') {
         $values = array();
         if (isset($_POST['save'])) {
             $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'role' => $_POST['role'], 'password' => $hasher->HashPassword($_POST['password']), 'clientId' => $_POST['client']);
             //Validation
             if ($values['user'] !== '') {
                 $helper = new helper();
                 if ($helper->validateEmail($values['user']) == 1) {
                     if ($hasher->CheckPassword($_POST['password'], $values['password']) && $_POST['password'] != '') {
                         if ($this->usernameExist($values['user']) === false) {
                             $this->addUser($values);
                             $tpl->setNotification('USER_ADDED', 'success');
                         } else {
                             $tpl->setNotification('USERNAME_EXISTS', 'error');
                         }
                     } else {
                         $tpl->setNotification('PASSWORDS_DONT_MATCH', 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_VALID_EMAIL', 'error');
                 }
             } else {
                 $tpl->setNotification('NO_USERNAME', 'error');
             }
             $tpl->assign('values', $values);
         }
         $clients = new clients();
         $tpl->assign('clients', $clients->getAll());
         $tpl->assign('roles', $this->getRoles());
         $tpl->display('users.newUser');
     } else {
         $tpl->display('general.error');
     }
 }
Ejemplo n.º 6
0
 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     $msgKey = '';
     $values = array('name' => '', 'details' => '', 'clientId' => '', 'hourBudget' => '', 'assignedUsers' => array(), 'dollarBudget' => '');
     if (isset($_POST['save']) === true) {
         if (!isset($_POST['hourBudget']) || $_POST['hourBudget'] == '' || $_POST['hourBudget'] == NULL) {
             $hourBudget = '0';
         } else {
             $hourBudget = $_POST['hourBudget'];
         }
         if (isset($_POST['editorId']) && count($_POST['editorId'])) {
             $assignedUsers = $_POST['editorId'];
         } else {
             $assignedUsers = array();
         }
         $values = array('name' => $_POST['name'], 'details' => $_POST['details'], 'clientId' => $_POST['clientId'], 'hourBudget' => $hourBudget, 'assignedUsers' => $assignedUsers, 'dollarBudget' => $_POST['dollarBudget']);
         if ($values['name'] === '') {
             $msgKey = 'NO_PROJECTNAME';
         } elseif ($values['clientId'] === '') {
             $msgKey = 'ERROR_NO_CLIENT';
         } else {
             $this->addProject($values);
             //Take the old value to avoid nl character
             $values['details'] = $_POST['details'];
             $msgKey = 'PROJECT_ADDED';
         }
         $tpl->assign('values', $values);
     }
     $tpl->assign('values', $values);
     $user = new users();
     $tpl->assign('availableUsers', $user->getAll());
     $clients = new clients();
     $tpl->assign('info', $msgKey);
     $tpl->assign('clients', $clients->getAll());
     $tpl->display('projects.newProject');
 }
Ejemplo n.º 7
0
<?
require_once($_SERVER['DOCUMENT_ROOT'] . "/classes/clients.php");
$cl = new clients();
$clients = $cl->getClients('RANDOM()', 5);
if (!count($clients)) $clients = array();

$searchLinkFlag = 0;
if (get_uid(false)) {
    if ( $_SESSION["role"][0] != '1') {
        $searchLinkFlag = 1;
    }
}
?>
<div style="position:absolute;top:260px; width:100%;margin-top:<?php 
echo $extraMarginTop;
?>
px">
<div style="margin:0 auto;	min-width:1000px;	max-width:1280px;">
<div class="b-promo b-promo_main">
    <table class="b-layout__table b-layout__table_width_full" cellpadding="0" cellspacing="0" border="0">
        <tr class="b-layout__tr">
            <td class="b-layout__one b-layout__one_width_50ps b-layout__one_padtb_20">
                <table class="b-layout__table b-layout__table_width_full" cellpadding="0" cellspacing="0" border="0" style="max-width:620px; min-width:500px; float:right;">
                    <tr class="b-layout__tr">
                        <td class="b-layout__one b-layout__one_padleft_20">
                            <div class="b-promo__txt b-promo__txt_fontsize_34 b-promo__txt_bold b-promo__txt_lineheight_1"><?php 
echo $pUStat['u']['count'];
?>
</div>
                            <div class="b-promo__txt"><?php 
echo $pUStat['u']['phrase'];
 function calculate_tpl($method, $tpl)
 {
     $this->method = $method;
     switch ($method) {
         case 'add':
             $return = $this->add();
             switch ($return) {
                 case 0:
                     //por defecto
                     break;
                 case -1:
                     //Errores al intentar añadir datos
                     for ($i = 0; $i < count($this->fields_list->array_error); $i += 2) {
                         $tpl->assign("error_" . $this->fields_list->array_error[$i], $this->fields_list->array_error[$i + 1]);
                     }
                     break;
                 default:
                     //Si se ha añadido
                     $this->method = "list";
                     $clients = new clients();
                     $tpl = $this->listar($tpl);
                     $clients->get_list_clients($_SESSION['ident_corp']);
                     $tpl->assign("clients", $clients->clients_list);
                     $tpl->assign("message", "&nbsp;<br>Contacto a&ntilde;adido correctamente<br>&nbsp;");
                     break;
             }
             $tpl->assign("objeto", $this);
             break;
         case 'list':
             $clients = new clients();
             $tpl = $this->listar($tpl);
             $clients->get_list_clients($_SESSION['ident_corp']);
             $tpl->assign("clients", $clients->clients_list);
             $tpl->assign("objeto", $this);
             break;
         case 'modify':
             $this->read($_GET['id']);
             $return = $this->modify();
             switch ($return) {
                 case 0:
                     //por defecto
                     $this->birthday = $this->fields_list->change_date($this->birthday, "es");
                     break;
                 case -1:
                     //Errores al intentar añadir datos
                     for ($i = 0; $i < count($this->fields_list->array_error); $i += 2) {
                         $tpl->assign("error_" . $this->fields_list->array_error[$i], $this->fields_list->array_error[$i + 1]);
                     }
                     break;
                 default:
                     //Si se ha añadido
                     $this->method = "list";
                     $clients = new clients();
                     $tpl = $this->listar($tpl);
                     $clients->get_list_clients($_SESSION['ident_corp']);
                     $tpl->assign("clients", $clients->clients_list);
                     $tpl->assign("objeto", $this);
                     $tpl->assign("message", "&nbsp;<br>Contacto modificado correctamente<br>&nbsp;");
                     break;
             }
             $tpl->assign("objeto", $this);
             break;
         case 'delete':
             $this->read($_GET['id']);
             if ($this->remove($_GET['id']) == 0) {
                 $tpl->assign("message", $this->contactos);
             } else {
                 $this->contacts_list = "";
                 $this->method = "list";
                 $clients = new clients();
                 $tpl = $this->listar($tpl);
                 $clients->get_list_clients($_SESSION['ident_corp']);
                 $tpl->assign("clients", $clients->clients_list);
                 $tpl->assign("message", "&nbsp;<br>Contacto borrado correctamente<br>&nbsp;");
             }
             $tpl->assign("objeto", $this);
             break;
         case 'view':
             $tpl = $this->view($_GET['id'], $tpl);
             $_SESSION['id_contact'] = $this->id_contact;
             break;
         default:
             if ($_SESSION['ident_corp'] != 0) {
                 $this->method = 'list';
                 $clients = new clients();
                 $tpl = $this->listar($tpl);
                 $clients->get_list_clients($_SESSION['ident_corp']);
                 $tpl->assign("clients", $clients->clients_list);
                 $tpl->assign("objeto", $this);
             } else {
                 $tpl->assign('plantilla', 'error_corp.tpl');
                 return $tpl;
             }
             break;
     }
     $tpl->assign('plantilla', 'contacts_' . $this->method . '.tpl');
     return $tpl;
 }
Ejemplo n.º 9
0
<?php

$g_page_id = "0|5";
$rpath = "../";
$grey_catalog = 1;
$stretch_page = true;
$showMainDiv = true;
error_reporting(E_ERROR);
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/clients.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/users.php";
session_start();
$clnt = new clients();
$prof_id = __paramInit('int', 'prof', 'prof', 0);
if ($prof_id) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/professions.php";
    $prof_link = professions::GetProfField($prof_id, 'link');
}
if ($_GET['a'] == 1 && hasPermissions('users')) {
    require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/CFile.php";
    $admin = 1;
    $page = intval($_GET['page']);
    $upage = $page > 0 ? "&page=" . $page : "";
    $page = $page <= 0 ? $page + 1 : $page;
    $edit = intval($_GET['edit']);
    if ($_POST['action']) {
        $action = $_POST['action'];
    }
    if ((int) $_GET['delete'] > 0) {
        $action = "delete_client";
    }
    switch ($action) {
Ejemplo n.º 10
0
 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     //Only admins
     if ($_SESSION['userdata']['role'] == 'admin') {
         if (isset($_GET['id']) === true) {
             $id = (int) $_GET['id'];
             $row = $this->getProject($id);
             $msgKey = '';
             $values = array('name' => $row['name'], 'details' => $row['details'], 'clientId' => $row['clientId'], 'state' => $row['state'], 'hourBudget' => $row['hourBudget'], 'assignedUsers' => $this->getProjectUserRelation($id), 'dollarBudget' => $row['dollarBudget']);
             //Edit project
             if (isset($_POST['save']) === true) {
                 if (isset($_POST['editorId']) && count($_POST['editorId'])) {
                     $assignedUsers = $_POST['editorId'];
                 } else {
                     $assignedUsers = array();
                 }
                 $values = array('name' => $_POST['name'], 'details' => $_POST['details'], 'clientId' => $_POST['clientId'], 'state' => $_POST['projectState'], 'hourBudget' => $_POST['hourBudget'], 'assignedUsers' => $assignedUsers, 'dollarBudget' => $_POST['dollarBudget']);
                 if ($values['name'] !== '') {
                     if ($this->hasTickets($id) && $values['state'] == 1) {
                         $tpl->setNotification('PROJECT_HAS_TICKETS', 'error');
                     } else {
                         $this->editProject($values, $id);
                         //Take the old value to avoid nl character
                         $values['details'] = $_POST['details'];
                         $tpl->setNotification('PROJECT_EDITED', 'success');
                     }
                 } else {
                     $tpl->setNotification('NO_PROJECTTNAME', 'error');
                 }
             }
             //Add Account
             if (isset($_POST['accountSubmit']) === true) {
                 $accountValues = array('name' => $_POST['accountName'], 'kind' => $_POST['kind'], 'username' => $_POST['username'], 'password' => $_POST['password'], 'host' => $_POST['host'], 'projectId' => $id);
                 if ($accountValues['name'] !== '') {
                     $this->addProjectAccount($accountValues);
                     $tpl->setNotification('ACCOUNT_ADDED', 'sucess');
                 } else {
                     $tpl->setNotification('NO_ACCOUNT_NAME', 'error');
                 }
                 $tpl->assign('accountValues', $accountValues);
             }
             //Upload file
             if (isset($_POST['upload']) === true) {
                 if ($_FILES['file']['name'] !== '') {
                     $upload = new fileupload();
                     $upload->initFile($_FILES['file']);
                     if ($upload->error == '') {
                         //Name on Server is encoded
                         $newname = md5($id . time());
                         $upload->renameFile($newname);
                         if ($upload->upload() === true) {
                             $fileValues = array('encName' => $upload->file_name, 'realName' => $upload->real_name, 'date' => date("Y-m-d H:i:s"), 'ticketId' => $id, 'userId' => $_SESSION['userdata']['id']);
                             $this->addFile($fileValues);
                             $tpl->setNotification('FILE_UPLOADED', 'success');
                         } else {
                             $tpl->setNotification('ERROR_FILEUPLOAD', 'error');
                         }
                     } else {
                         $tpl->setNotification('ERROR_FILEUPLOAD', 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_FILE', 'error');
                 }
             }
             $helper = new helper();
             $clients = new clients();
             $user = new users();
             $tpl->assign('availableUsers', $user->getAll());
             //Assign vars
             $tpl->assign('info', $msgKey);
             $tpl->assign('clients', $clients->getAll());
             $tpl->assign('values', $values);
             $tpl->assign('files', $this->getFiles($id));
             $tpl->assign('helper', $helper);
             $tpl->assign('accounts', $this->getProjectAccounts($id));
             $tpl->display('projects.editProject');
         } else {
             $tpl->display('general.error');
         }
     } else {
         $tpl->display('general.error');
     }
 }
Ejemplo n.º 11
0
 function view($id, $tpl)
 {
     /*
     	Cosas que faltan por hacer:
     		De forma general, mirar los permisos del usuario que vaya a acceder aqui, para saber si tiene permisos de borrar editar ver etc...
     		Averiguar como pasar el numero de registros, si va a ser a grupos a grupos, si va a ser a modulos, a modulos
     		Order By (y mantener la búsqueda en el caso de que hubiera hecha una y averiguar la "pestaña" a la que hace referencia)
     		Busquedas
     */
     $cadena = '';
     // Leemos la empresa y se lo pasamos a la plantilla
     $this->read($id);
     $tpl->assign('objeto', $this);
     //listado de empleados
     $tabla_empleados = new table(false);
     $empleados = new emps();
     if ($empleados->get_list_emps($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_empleados->tabla_vacia('emps', $per->add);
         $variables_empleados = $tabla_empleados->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_empleados->make_tables('emps', $empleados->emps_list, array('Nombre', 20, 'Primer Apellido', 20, 'Segundo Apellido', 20), array('id_emp', 'name', 'last_name', 'last_name2'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_empleados = $tabla_empleados->nombres_variables;
     }
     //Productos
     $products = new products(false);
     $tabla_productos = new table(false);
     if ($products->get_list_products_corps($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_productos->tabla_vacia('products', $per->add);
         $variables_products = $tabla_productos->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_productos->make_tables('products', $products->products_list, array('Nombre', 20, 'Nombre Web', 40), array('id_product', 'name', 'name_web'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_products = $tabla_productos->nombres_variables;
     }
     //servicios
     $services = new services(false);
     $tabla_servicios = new table(false);
     if ($services->get_list_services_corp($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_servicios->tabla_vacia('services', $per->add);
         $variables_services = $tabla_servicios->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_servicios->make_tables('services', $services->services_list, array('Nombre', 20, 'Nombre Web', 40), array('id_service', 'name', 'name_web'), $_SESSION['num_regs'], $per->permissions_module, $per->add);
         $variables_services = $tabla_servicios->nombres_variables;
     }
     //clientes
     $clients = new clients(false);
     $tabla_clientes = new table(false);
     if ($clients->get_list_clients($_SESSION['ident_corp']) == 0) {
         $per = new permissions();
         $per->get_permissions_list('clients');
         $cadena = $cadena . $tabla_clientes->tabla_vacia('clients', $per->add);
         $variables_clients = $tabla_clientes->nombres_variables;
     } else {
         $per = new permissions();
         $per->get_permissions_list('corps');
         $cadena = $cadena . $tabla_clientes->make_tables('clients', $clients->clients_list, array('Nombre', 20, 'Nombre Completo', 40, 'Tel&eacute;fono', 20), array('id_client', 'name', 'full_name', 'phone'), 10, $per->permissions_module, $per->add);
         $variables_clients = $tabla_clientes->nombres_variables;
     }
     //Rellenamos de forma provisional las variables con un "no se puede mostrar"
     $facturaspen = new table(false);
     $facturascob = new table(false);
     $gestionalm = new table(false);
     $partes = new table(false);
     $cadena = $cadena . $facturaspen->dont_show('facturaspen');
     $cadena = $cadena . $facturascob->dont_show('facturascob');
     $cadena = $cadena . $gestionalm->dont_show('gestionalm');
     $cadena = $cadena . $partes->dont_show('partes');
     $variables_facturaspen = $facturaspen->nombres_variables;
     $variables_facturascob = $facturascobs->nombres_variables;
     $variables_gestionalm = $gestionalm->nombres_variables;
     $variables_partes = $partes->nombres_variables;
     $i = 0;
     while ($i < count($variables_empleados) + count($variables_clients) + count($variables_facturaspen) + count($variables_facturascob) + count($variables_products) + count($variables_services) + count($variables_gestionalm) + count($variables_partes)) {
         for ($j = 0; $j < count($variables_empleados); $j++) {
             $variables[$i] = $variables_empleados[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_clients); $j++) {
             $variables[$i] = $variables_clients[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_facturaspen); $j++) {
             $variables[$i] = $variables_facturaspen[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_facturascob); $j++) {
             $variables[$i] = $variables_facturascob[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_products); $j++) {
             $variables[$i] = $variables_products[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_services); $j++) {
             $variables[$i] = $variables_services[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_gestionalm); $j++) {
             $variables[$i] = $variables_gestionalm[$j];
             $i++;
         }
         for ($j = 0; $j < count($variables_partes); $j++) {
             $variables[$i] = $variables_partes[$j];
             $i++;
         }
     }
     //Se comprueba si hay permiso para borrar o modificar
     $permisos_mod_del = new permissions();
     $permisos_mod_del->get_permissions_modify_delete('corps');
     $tpl->assign('acciones', $permisos_mod_del->per_mod_del);
     $tpl->assign('variables', $variables);
     $tpl->assign('cadena', $cadena);
     //
     return $tpl;
 }
Ejemplo n.º 12
0
	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
	<div class="form-group">
     <div class="span2">
		<?php 
echo $form->labelEx($model, 'client_id');
?>
        </div>
        <div class="col-sm-8 clearLeftPadding">
		<?php 
//echo $form->textField($model,'client_id');
echo $form->dropDownList($model, 'client_id', CHtml::listData(clients::model()->findAll(array('select' => 'id, client_name', 'order' => 'client_name')), 'id', 'client_name'), array('empty' => '- Select -'));
?>
		<?php 
echo $form->error($model, 'client_id');
?>
	</div>
    </div>
 </div>

	<div class="row">
	<div class="form-group">
     <div class="span2">
		<?php 
echo $form->labelEx($model, 'portfolio');
?>
        </div>
Ejemplo n.º 13
0
*/
include "../../include/session.php";
include "include/tables.php";
include "include/fields.php";
include "include/addresses.php";
include "include/addresstorecord.php";
include "include/clients.php";
if (!isset($_GET["backurl"])) {
    $backurl = NULL;
} else {
    $backurl = $_GET["backurl"];
    if (isset($_GET["refid"])) {
        $backurl .= "?refid=" . $_GET["refid"];
    }
}
$thetable = new clients($db, "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083", $backurl);
$therecord = $thetable->processAddEditPage();
if (isset($therecord["phpbmsStatus"])) {
    $statusmessage = $therecord["phpbmsStatus"];
}
$pageTitle = ucwords($therecord["type"]);
if ($therecord["inactive"]) {
    $pageTitle = "Inactive " . $pageTitle;
}
$phpbms->cssIncludes[] = "pages/client.css";
$phpbms->jsIncludes[] = "modules/bms/javascript/client.js";
//Form Elements
//==============================================================
$theform = new phpbmsForm();
$theinput = new inputCheckbox("inactive", $therecord["inactive"]);
$theform->addField($theinput);
Ejemplo n.º 14
0
        $this->exportJS(js::maskInput('state', "**"));
        $this->export($data);
    }
    public function editClient($content)
    {
        $id = $content['editAccount'];
        $uid = $this->returnFieldFromTable("id", "users", "company_id='{$id}'");
        $this->query("UPDATE users SET user_name='{$content['user_name']}', user_email='{$content['user_email']}', user_phone='{$content['user_phone']}', \n\t\t\t\tuser_title='{$content['user_title']}' WHERE id='{$uid}'");
        $this->query("UPDATE companies SET company_phone='{$content['user_phone']}', company_name='{$content['company_name']}', company_address='{$content['company_address']}', company_address2='{$content['company_address2']}',\n\t\t\t\tcompany_city='{$content['company_city']}', company_state='{$content['company_state']}', company_zip='{$content['company_zip']}' WHERE id='{$id}'");
        $json = [];
        $json['action'] = 'reload';
        $json['url'] = '/clients/';
        $this->jsonE('success', $json);
    }
}
$mod = new clients();
if (isset($_GET['createClient'])) {
    $mod->createClient();
} else {
    if (isset($_POST['createAccount'])) {
        $mod->createAccount($_POST);
    } else {
        if (isset($_GET['showClient'])) {
            $mod->showClient($_GET);
        } else {
            if (isset($_POST['editAccount'])) {
                $mod->editClient($_POST);
            } else {
                $mod->main();
            }
        }
Ejemplo n.º 15
0
 /**
  * run - display template and edit data
  *
  * @access public
  *
  */
 public function run()
 {
     $tpl = new template();
     //Only admins
     if ($_SESSION['userdata']['role'] == 'admin') {
         if (isset($_GET['id']) === true) {
             $project = new projects();
             $id = (int) $_GET['id'];
             $row = $this->getUser($id);
             $edit = false;
             $infoKey = '';
             //Build values array
             $values = array('firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'user' => $row['username'], 'phone' => $row['phone'], 'status' => $row['status'], 'role' => $row['role'], 'hours' => $row['hours'], 'wage' => $row['wage'], 'clientId' => $row['clientId']);
             if (isset($_POST['save'])) {
                 $values = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'user' => $_POST['user'], 'phone' => $_POST['phone'], 'status' => $_POST['status'], 'role' => $_POST['role'], 'hours' => $_POST['hours'], 'wage' => $_POST['wage'], 'clientId' => $_POST['client']);
                 $changedEmail = 0;
                 if ($row['username'] != $values['user']) {
                     $changedEmail = 1;
                 }
                 if ($values['user'] !== '') {
                     $helper = new helper();
                     if ($helper->validateEmail($values['user']) === 1) {
                         if ($changedEmail == 1) {
                             if ($this->usernameExist($row['username'], $id) === false) {
                                 $edit = true;
                             } else {
                                 $tpl->setNotification('USERNAME_EXISTS', 'error');
                             }
                         } else {
                             $edit = true;
                         }
                     } else {
                         $tpl->setNotification('NO_VALID_EMAIL_' . $helper->validateEmail($values['user']), 'error');
                     }
                 } else {
                     $tpl->setNotification('NO_USERNAME', 'error');
                 }
             }
             //Was everything okay?
             if ($edit !== false) {
                 $this->editUser($values, $id);
                 if (isset($_POST['projects'])) {
                     if ($_POST['projects'][0] !== '0') {
                         $project->editUserProjectRelations($id, $_POST['projects']);
                     } else {
                         $project->deleteAllProjectRelations($id);
                     }
                 }
                 $tpl->setNotification('EDIT_SUCCESS', 'success');
             }
             // Get relations to projects
             $projects = $project->getUserProjectRelation($id);
             $projectrelation = array();
             foreach ($projects as $projectId) {
                 $projectrelation[] = $projectId['projectId'];
             }
             //Assign vars
             $clients = new clients();
             $tpl->assign('clients', $clients->getAll());
             $tpl->assign('allProjects', $project->getAll());
             $tpl->assign('values', $values);
             $tpl->assign('relations', $projectrelation);
             $tpl->assign('roles', $this->getRoles());
             $tpl->assign('status', $this->status);
             $tpl->display('users.editUser');
         } else {
             $tpl->display('general.error');
         }
     } else {
         $tpl->display('general.error');
     }
 }