Пример #1
0
 /**
  * Event method sharing the contacts with the Co-Workers
  * @param object $evtcl
  */
 function eventShareContactsMultiple(EventControler $evtcl)
 {
     $contacts = $evtcl->getParam("idcontacts");
     $co_workers = $evtcl->getParam("cwid");
     $count = 0;
     $no_coworker = 0;
     if (is_array($contacts) && is_array($co_workers)) {
         $do_tag = new Tag();
         foreach ($co_workers as $co) {
             foreach ($contacts as $cont) {
                 if (!$this->checkCoWorkerContactRel($cont, $co)) {
                     $this->addContactSharings($cont, $co);
                     $do_tag->addTagOnContactSharing($cont, $co);
                     $count++;
                 }
             }
         }
     }
     if ($count) {
         $msg = 'Sharing Updated succesfully';
     } else {
         $msg = 'No Data updated,you may be trying to duplicate some contact access';
     }
     $goto = $evtcl->goto;
     $dispError = new Display($goto);
     $dispError->addParam("message", $msg);
     $evtcl->setDisplayNext($dispError);
 }
Пример #2
0
 function eventVCardImport(EventControler $evtcl)
 {
     $msg = "";
     $goto = $evtcl->getParam("goto");
     $uploaded_file = $_FILES['fields']['name']['contact_vcard'];
     if ($uploaded_file) {
         $target_path = 'files/' . $uploaded_file;
         if (!move_uploaded_file($_FILES['fields']['tmp_name']['contact_vcard'], $target_path)) {
             $msg = "There was an error uploading the file, please try again!";
         } else {
             chmod($target_path, 0755);
             $_SESSION['vcard_file'] = $uploaded_file;
             $_SESSION['import_tag'] = trim($evtcl->fields['import_tag']);
             $retVal = $this->print_vcard_address_book($target_path, 'ofuz vCard Import', '', '', '');
             if ($retVal) {
                 $msg = "Your vCard contacts have been imported successfully.";
             } else {
                 $msg = $this->errMsg;
             }
         }
     } else {
         $msg = "Please select a file to be imported.";
     }
     $disp = new Display($goto);
     $disp->addParam("msg", $msg);
     if ($evtcl->getParam("fromReg") == 'Yes') {
         //if importing while registration
         $_SESSION["page_from"] = 'reg';
     }
     $evtcl->setDisplayNext($disp);
 }
Пример #3
0
 function eventStopSharingNotes(EventControler $evtcl)
 {
     $dispMsg = new Display($evtcl->goto);
     $q = new sqlQuery($this->getDbCon());
     $q->query("UPDATE contact SET portal_code = '' WHERE idcontact =" . $this->idcontact);
     $_SESSION['in_page_message'] = 'url portal stoped';
     $evtcl->setDisplayNext($dispMsg);
 }
Пример #4
0
 /**
  * eventSetUsers()
  * Grab the users ids from the contacts multi select and 
  * store the object in the session
  */
 function eventSetUsers(EventControler $event_controler)
 {
     if (strlen($event_controler->tags) == 0) {
         $this->setLog("\n Not tags Adding users to the MailMerge");
         $contacts = $event_controler->getParam("ck");
         if (is_array($contacts)) {
             $this->contacts = $contacts;
         }
     }
     $_SESSION['MailMerge_Contacts'] = $this;
 }
Пример #5
0
 /**
    Event Method to delete a note from the db and keep the data in the session for undo
    calls to member method deleteNote()
    @param Intinger id : id of the note
    @param String context : can be now ContactNote or ProjectDiscuss
 */
 function eventTempDelNoteById(EventControler $evtcl)
 {
     $idnote = $evtcl->id;
     $context = $evtcl->context;
     if ($this->isdeletePermitted($idnote, $context) === true) {
         if (!is_object($_SESSION['NoteDeleted'])) {
             $this->sessionPersistent("NoteDeleted", "logout.php", OFUZ_TTL);
         }
         $this->deleteNote($idnote, $context);
     } else {
         $_SESSION['errorMessage'] = _('Opps !! Looks like you are trying to delete a record which does not belong to you.');
         $evtcl->setDisplayNext(new Display("error.php"));
     }
 }
Пример #6
0
 /**
  * Event Function used while updating a company
  * Checks if the updated Company is already in the database
  * If there then do not update and set doSave = mo
  * Else continue with other events from the called page
  * 
  */
 function eventCheckDuplicateCompanyInUpdate(EventControler $evtcl)
 {
     $fields = $evtcl->getParam('fields');
     $q_company = new sqlQuery($this->getDbCon());
     $q_company->query("select name from company where idcompany = " . $this->getPrimaryKeyValue());
     $q_company->fetch();
     $comp_name = $q_company->getData("name");
     $q = new sqlQuery($this->getDbCon());
     $q->query("select * from company where name='" . trim($fields['name']) . "' \r\n      AND name <> '" . trim($comp_name) . "'");
     // need to have the iduser as well
     if ($q->getNumRows() > 0) {
         $dispError = new Display($evtcl->goto);
         $dispError->addParam("message", "This company is already in the database");
         $evtcl->addParam("doSave", "no");
         $evtcl->setDisplayNext($dispError);
     }
 }
Пример #7
0
 function eventAjaxSendFeedback(EventControler $event_controler)
 {
     $subject = 'Ofuz User Feedback: ' . $event_controler->url;
     //$headers = 'From: "Ofuz User Feedback" <*****@*****.**>'."\n\n";
     $headers = 'From: "' . $_SESSION['do_User']->firstname . ' ' . $_SESSION['do_User']->lastname . '" <' . $_SESSION['do_User']->email . '>' . "\n\n";
     mail('*****@*****.**', $subject, $event_controler->text, $headers);
     $event_controler->addOutputValue(true);
 }
Пример #8
0
 function eventAjaxEditTaskCategoryForm(EventControler $evctl)
 {
     $form = '<div class="taskbox1a"><div class="taskbox1b"><div class="taskbox1c">';
     $this->getId($evctl->id);
     $this->sessionPersistent("TaskCategoryEdit", "index.php", 120);
     $e_task = new Event("TaskCategoryEdit->eventValuesFromForm");
     $e_task->setLevel(1999);
     $e_task->addEventAction("TaskCategoryEdit->eventUpdate", 2000);
     $form .= $e_task->getFormHeader();
     $form .= $e_task->getFormEvent();
     $_SESSION['TaskCategoryEdit']->setRegistry("task_category");
     $_SESSION['TaskCategoryEdit']->setApplyRegistry(true, "Form");
     $form .= $_SESSION['TaskCategoryEdit']->name . '<br /><br />';
     $form .= $_SESSION['TaskCategoryEdit']->iduser;
     $form .= $e_task->getFormFooter("Update this Category");
     $form .= '<div class="cancellink">or <a href="#" onclick="fnCancelEdit(' . $evctl->id . ');">' . _('cancel') . '</a></div>';
     $form .= '</div></div></div>';
     $evctl->addOutputValue($form);
 }
Пример #9
0
 /**
  * eventGetForMailMerge
  * Get the list of contact for mailmerge
  * load in the current contact object the list of
  * selected contacts from the contacts.php
  * Then redirect to the SendMessage page.
  * 
  * In here we are doing something not very elegant but to grab the proper
  * information from the Contacts object we linked it with this new Object.
  * @Note this assignment may need to be revisited in the future.
  */
 function eventGetForMailMerge(EventControler $event_controler)
 {
     $idcontacts = $event_controler->getParam("ck");
     $sql_in = "(";
     foreach ($idcontacts as $idcontact) {
         $sql_in .= $idcontact . ",";
     }
     $sql_in = substr($sql_in, 0, -1);
     $sql_in .= ")";
     $tag_search = $_SESSION['do_Contacts']->getSearchTags();
     if (is_array($tag_search) && count($tag_search > 0)) {
         $_SESSION['searched_tags'] = $tag_search;
     }
     $this->clearSearch();
     $this->setSqlQuery("SELECT * FROM contact WHERE idcontact in " . $sql_in);
     $this->sessionPersistent("do_ContactMailing", "contacts.php", 36000);
     $event_controler->goto = $GLOBALS['cfg_plugin_mkt_path'] . "SendMessage";
     //$event_controler->setDisplayNext(new Display($GLOBALS['cfg_plugin_mkt_path']."SendMessage/"));
 }
Пример #10
0
 function eventAjaxEnterEmailForm(EventControler $evctl)
 {
     $form = '<div class="taskbox1a"><div class="taskbox1b"><div class="taskbox1c">';
     // use $evctl->referer value to generate the form header for diff post values
     if ($evctl->referrer == 'gmail') {
         if ($evctl->act == '2') {
             $form .= '<form method="post" action="google_import.php">';
             $form .= _('Email : ') . '<input type="text" name="email" style="width: 200px;" />';
             $form .= '<input type ="hidden" name = "action" value = "import">';
             $form .= '<input type="submit" name="usubmit" value = "' . _('Import') . '">';
         } elseif ($evctl->act == '1') {
             $form .= '<form method="post" action="google_export.php">';
             $form .= _('Email : ') . '<input type="text" name="email" style="width: 200px;" />';
             $form .= '<input type ="hidden" name = "action" value = "export">';
             $form .= '<input type="submit" name="usubmit" value = "' . _('Export') . '">';
         }
     }
     $form .= '</form></div></div></div>';
     $evctl->addOutputValue($form);
 }
Пример #11
0
 function eventCancelAccount(EventControler $evtcl)
 {
     //echo 'No cancellation after registration....';
     //echo '<br /> and for the reson that u have given <br />'.$evtcl->fields["reason"].'<br /> no way, no cancellation ';
     //exit;
     if ($evtcl->fields["reason"] != '') {
         $this->deleteContactRelated();
         $this->deleteUserContactNote();
         $this->deleteUserContactSharing();
         $this->deleteUserEmailTemplate();
         $this->deleteInvoiceRelated();
         $this->deleteMessage();
         $this->deleteProjectRelated();
         $this->deleteTask();
         $this->deletewebformuser();
         $this->deleteworkfeed();
         $this->deletenotedraft();
         $this->deletetwitteraccount();
         $this->deletetbreadcrumb();
         $this->deleteUserRel();
         $this->deleteUserSettings();
         $this->deleteUserTags();
         $this->dropContactView();
         $email_template = new EmailTemplate("ofuz_cancel_account_notification");
         $email_template->setSenderName($_SESSION['do_User']->getFullName());
         $email_template->setSenderEmail($_SESSION['do_User']->email);
         $email_data = array('name' => $_SESSION['do_User']->getFullName(), 'email' => $_SESSION['do_User']->email, 'reason' => $evtcl->fields["reason"]);
         $emailer = new Radria_Emailer();
         $emailer->setEmailTemplate($email_template);
         $emailer->mergeArray($email_data);
         $emailer->addTo("*****@*****.**");
         //$emailer->addTo("*****@*****.**");
         $emailer->send();
         $this->deleteUser();
     } else {
         $_SESSION['in_page_message'] = _("Please Provide a reason before cancelling the account");
         $dispError = new Display('cancel_account.php');
         $dispError->addParam("m", 'e');
         $evtcl->setDisplayNext($dispError);
     }
 }
Пример #12
0
 function eventAjaxNumOfFeedsInWebPage(EventControler $evctl)
 {
     $do_contact_website = new ContactWebsite();
     $do_contact_website->getId($evctl->idcontact_website);
     $website_type = $do_contact_website->website_type;
     $uri = $do_contact_website->website;
     if ($website_type == "RSS Feed") {
         //Feed from xml
         $feed = Zend_Feed::import($uri);
         $feed_count = $feed->count();
         $this->updateFeedStatus($feed_count, $evctl->idcontact_website);
         $evctl->addOutputValue($feed_count);
     } else {
         //Feed from webpage
         $uri = (substr(ltrim($uri), 0, 7) != 'http://' ? 'http://' : '') . $uri;
         $arr_feeds = Zend_Feed::findFeeds($uri);
         $this->num_feeds = count($arr_feeds);
         $this->updateFeedStatus($this->num_feeds, $evctl->idcontact_website);
         $evctl->addOutputValue(count($arr_feeds));
     }
 }
Пример #13
0
 /**
  * Function to delete the invoice payment
  * For single payment and single invoice it will delete the data straight away
  * If the payment is attached to multiple invoices then it will first show the alert to the user and 
  * if user wants to delete the payment then it will delete the payment from the attached invoices
  * @param object $evtcl
  */
 function eventDeletePaymentLog(EventControler $evtcl)
 {
     if ($evtcl->id) {
         $q = new sqlQuery($this->getDbCon());
         $q1 = new sqlQuery($this->getDbCon());
         $sql = "SELECT COUNT(payment_invoice.idpayment) AS num_inv \n              FROM payment_invoice INNER JOIN paymentlog \n              ON paymentlog.idpaymentlog = payment_invoice.idpayment\n              WHERE paymentlog.idpaymentlog = {$evtcl->id}\n                    ";
         $q->query($sql);
         if ($q->getNumRows()) {
             $q->fetch();
             $num_inv = $q->getData("num_inv");
             if ($num_inv == 1) {
                 $do_inv = new Invoice();
                 $this->getId($evtcl->id);
                 $idinvoice = $this->idinvoice;
                 $sql_del_paymentlog = "DELETE FROM {$this->table} WHERE idpaymentlog = '{$evtcl->id}'";
                 $sql_del_paymentinv = "DELETE FROM payment_invoice WHERE idpayment = '{$evtcl->id}'";
                 $sql_del_ext_amt = "DELETE FROM paymentlog_extra_amount WHERE idpaymentlog = '{$evtcl->id}'";
                 $q->query($sql_del_paymentlog);
                 $q->query($sql_del_paymentinv);
                 $q->query($sql_del_ext_amt);
                 $do_inv->deletePaymentFromInvoice($idinvoice, $evtcl->amt);
                 $_SESSION['in_page_message'] = _("Payment has been deducted from the invoice.");
             }
             if ($num_inv > 1) {
                 $do_inv = new Invoice();
                 if ($evtcl->del_mul_confirm != 'Yes') {
                     $_SESSION['in_page_message'] = _("This Payment is shared with multiple invoices.");
                     $_SESSION['in_page_message_inv_mul_pay_del'] = 'Yes';
                     $_SESSION['in_page_message_inv_idpaymentlog'] = (int) $evtcl->id;
                     $evtcl->setDisplayNext(new Display("invoice_alert.php"));
                 } else {
                     $sql = "SELECT payment_invoice.* \n                                FROM payment_invoice \n                                INNER JOIN paymentlog \n                                ON paymentlog.idpaymentlog = payment_invoice.idpayment\n                                WHERE paymentlog.idpaymentlog = {$evtcl->id}\n                          ";
                     $q1->query($sql);
                     if ($q1->getNumRows() > 0) {
                         while ($q1->fetch()) {
                             $idinvoice = $q1->getData("idinvoice");
                             $idpayment = $q1->getData("idpayment");
                             $amt = $q1->getData("amount");
                             $do_inv->deletePaymentFromInvoice($idinvoice, $amt);
                         }
                         $sql_del_paymentlog = "DELETE FROM {$this->table} WHERE idpaymentlog = '{$idpayment}'";
                         $sql_del_paymentinv = "DELETE FROM payment_invoice WHERE idpayment = '{$idpayment}'";
                         $sql_del_ext_amt = "DELETE FROM paymentlog_extra_amount WHERE idpaymentlog = '{$idpayment}'";
                         $q1->query($sql_del_paymentlog);
                         $q1->query($sql_del_paymentinv);
                         $q1->query($sql_del_ext_amt);
                         $evtcl->setDisplayNext(new Display("/Invoice/" . $_SESSION['do_invoice']->idinvoice));
                     }
                 }
             }
         }
     }
 }
Пример #14
0
 /**
  * event function to activate a plugin from setting page
  * @param object $evctl
  */
 public function eventActivatePlugin(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         if (trim($evctl->plugin_name) != '') {
             if (false === $this->get_plugin_by_name($evctl->plugin_name)) {
                 $this->addNew();
                 $this->name = trim($evctl->plugin_name);
                 $this->add();
                 $plugin_id = $this->getInsertId();
                 $this->do_sorting_on_activate(trim($evctl->plugin_name));
                 echo $plugin_id;
             }
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "plugins");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
 /**
  * function to update the datashare permission across the module
  * @param object $evctl
  */
 public function eventUpdateModuleDataShareRel(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $qry = "select idmodule_datashare_rel,idmodule from `" . $this->getTable() . "`";
         $stmt = $this->getDbConnection()->executeQuery($qry);
         while ($data = $stmt->fetch()) {
             $datashare_permission_form_name = 'mod_' . $data["idmodule"];
             $permission_flag = $evctl->{$datashare_permission_form_name};
             $this->cleanValues();
             $this->permission_flag = $permission_flag;
             $this->update($data["idmodule_datashare_rel"]);
         }
         $dis = new Display($evctl->next_page);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to add record ! '));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #16
0
 /**
  * function to edit the combo values
  * @param object $evctl
  */
 public function eventEditComboValues(EventControler $evctl)
 {
     $idfields = (int) $evctl->idfields;
     if ($idfields > 0) {
         $referrar_module_id = (int) $evctl->referrar_module_id;
         $pick_values_seperated = preg_split('/[\\r\\n]+/', $evctl->pick_values, -1, PREG_SPLIT_NO_EMPTY);
         $this->update_combo_values($idfields, $pick_values_seperated);
         //check if the field is mapped with some other fields and if yes then update the mapped fields also
         $do_crm_fields_mapping = new CRMFieldsMapping();
         $mapped_fields = $do_crm_fields_mapping->is_mapped($idfields);
         if (is_array($mapped_fields) && count($mapped_fields) > 0) {
             foreach ($mapped_fields as $mapped_fieldid) {
                 $this->update_combo_values($mapped_fieldid, $pick_values_seperated);
             }
         }
         $_SESSION["do_crm_messages"]->set_message('success', _('Data has been updated successfully.'));
         $next_page = NavigationControl::getNavigationLink("Settings", "picklist");
         $dis = new Display($next_page);
         $dis->addParam("cmid", $referrar_module_id);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #17
0
 /**
  * event function to record the custom field mapping of leads
  * @param object $evctl
  */
 public function eventMapLeadsCustomFields(EventControler $evctl)
 {
     $qry = "\n\t\tselect * from `fields` \n\t\twhere field_name like '%ctf_%' AND idmodule = 3 \n\t\torder by idfields ";
     $stmt = $this->getDbConnection()->executeQuery($qry);
     if ($stmt->rowCount() > 0) {
         $q_clean_table = "TRUNCATE " . $this->getTable();
         $this->query($q_clean_table);
         while ($data = $stmt->fetch()) {
             $idfields_lead = $data["idfields"];
             $org_field_name = 'organization_map_' . $idfields_lead;
             $cnt_field_name = 'contacts_map_' . $idfields_lead;
             $pot_field_name = 'potentials_map_' . $idfields_lead;
             $org_map_field = (int) $evctl->{$org_field_name};
             $cnt_map_field = (int) $evctl->{$cnt_field_name};
             $pot_map_field = (int) $evctl->{$pot_field_name};
             if ($org_map_field == '' || $org_map_field == 0) {
                 $org_map_field = 0;
             }
             if ($cnt_map_field == '' || $cnt_map_field == 0) {
                 $cnt_map_field = 0;
             }
             if ($pot_map_field == '' || $pot_map_field == 0) {
                 $pot_map_field = 0;
             }
             $this->insert($this->getTable(), array('mapping_field_id' => $idfields_lead, 'organization_mapped_to' => $org_map_field, 'contacts_mapped_to' => $cnt_map_field, 'potentials_mapped_to' => $pot_map_field));
         }
         $_SESSION["do_crm_messages"]->set_message('success', _('Fields mapping has been saved successfully !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "customfield");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $idprofile);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('No mapping found to be saved !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "customfield");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $idprofile);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #18
0
<?php

/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
/**
 * Main event Controler
 * This is an instance of the Event controler that will be managing the execution of the events and set the next url
 * @see EventControler
 * @package RadriaSiteTemplate
 * @author Philippe Lewicki  <*****@*****.**>
 * @copyright  SQLFusion LLC 2001-2007
 * @version 4.0
 */
include_once "config.php";
include_once 'includes/ofuz_check_access.script.inc.php';
//  "start event control" ;
$eventControler = new EventControler($conx);
$eventControler->setMyDbPath($cfg_local_mydbdir);
$eventControler->addparam("dbc", $conx);
$eventControler->addparam("doSave", "yes");
$eventControler->setMessagePage("message.php");
//  If you want to secure your site to only authorize request with local referer
//  comment the line bellow.
//  Notes: doesn't work with ssl or some IE version and Ajax
$eventControler->setCheckReferer(false);
$eventControler->addallvars();
$eventControler->listenEvents($_REQUEST['mydb_events']);
//$eventControler->doForward() ;
echo $eventControler->doOutput();
Пример #19
0
 /**
  * event function to activate the cpanel login
  * @param object $evctl
  * @return void
  */
 function eventActivateCpanelLogin(EventControler $evctl)
 {
     if ((int) $evctl->record_id > 0) {
         $this->getId((int) $evctl->record_id);
         $err = '';
         if ((int) $this->idorganization == 0) {
             $err = _('Contact must be associated with an organization for portal login activation');
         }
         if (strlen(trim($this->email)) == 0) {
             $err = _('Missing the primary email id for portal login activation');
         }
     } else {
         $err = _('Missing idcontacts for portal activation');
     }
     if (strlen($err) == 0) {
         $pass = $this->activate_cpanel_login((int) $evctl->record_id, $this->email, (int) $this->idorganization);
         $contact_data = array("firstname" => $this->firstname, "lastname" => $this->lastname, "email" => $this->email, "password" => $pass);
         $this->send_cpanel_login_details($contact_data);
         $_SESSION["do_crm_messages"]->set_message('success', _('Portal user is created and email sent with the details ! '));
         $next_page = NavigationControl::getNavigationLink('Contacts', "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $evctl->record_id);
         $evctl->setDisplayNext($dis);
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', $err);
         $next_page = NavigationControl::getNavigationLink('Contacts', "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $evctl->record_id);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #20
0
 /**
  * event function to signout
  * @param object $evctl
  */
 public function eventLogout(EventControler $evctl)
 {
     //do login audit
     $do_login_audit = new LoginAudit();
     $do_login_audit->do_login_audit("Logout");
     $this->setFree();
     $this->free();
     // Unset all of the session variables.
     $_SESSION = array();
     // If it's desired to kill the session, also delete the session cookie.
     // Note: This will destroy the session, and not just the session data!
     if (isset($_COOKIE[session_name()])) {
         setcookie(session_name(), '', time() - 42000, '/');
     }
     // Finally, destroy the session.
     session_destroy();
     $dis = new Display(NavigationControl::getNavigationLink("User", "login"));
     $evctl->setDisplayNext($dis);
 }
Пример #21
0
 /**
  * Custom method to update the user info from the setting page.
  * @param object $evtcl
  */
 function eventUpdateUserInfo(EventControler $evtcl)
 {
     $fields = $evtcl->fields;
     if ($evtcl->doSave == "yes") {
         $qry = "update " . $this->table . " set \n                      firstname = '" . $fields["firstname"] . "',\n                      lastname = '" . $fields["lastname"] . "',\n                      email = '" . $fields["email"] . "',\n                      username = '******',\n                      password = '******',\n                      company = '" . $fields["company"] . "',\n                      position = '" . $fields["position"] . "',\n                      address1 = '" . $fields["address1"] . "',\n                      address2 = '" . $fields["address2"] . "',\n                      city = '" . $fields["city"] . "',\n                      zip = '" . $fields["zip"] . "',\n                      state = '" . $fields["state"] . "',\n                      country = '" . $fields["country"] . "'\n                      where iduser = "******"Data has been updated.";
         $dispError = new Display($evtcl->errPage);
         $dispError->addParam("message", $msg);
         $evtcl->setDisplayNext($dispError);
     }
 }
Пример #22
0
<?php

/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
// Copyright 2008 - 2010 all rights reserved, SQLFusion LLC, info@sqlfusion.com
/** Ofuz Open Source version is released under the GNU Affero General Public License, please read the full license at: http://www.gnu.org/licenses/agpl-3.0.html **/
include_once 'config.php';
include_once 'includes/ofuz_check_access.script.inc.php';
//include_once('includes/header.inc.php');
//the browser_search.php will instantiate an EventControler object, set the search param, goto and pass it to the $_SESSION['do_contact']->eventSetSearch($eventcontroler);
$do_Contacts = new Contact();
$do_Contacts->sessionPersistent("do_Contacts", "index.php", 36000);
$ec_search = new EventControler($conx);
$ec_search->addParam("goto", "contacts.php");
$ec_search->addParam("contacts_search", $_GET['s']);
$_SESSION['do_Contacts']->search_keyword = $_GET['s'];
$_SESSION['do_Contacts']->eventSetSearch($ec_search);
$ec_search->doForward();
Пример #23
0
 function eventExportContacts(EventControler $evtcl)
 {
     $iduser = $_SESSION['do_User']->iduser;
     $do_contact = new Contact();
     $do_contact->getAllContactsForAUser();
     $num_contacts = $do_contact->getNumRows();
     $report_name = "ofuz_" . $iduser . "_report" . ".xls";
     $fname = "xls_report/{$report_name}";
     $workbook =& new writeexcel_workbook($fname);
     $worksheet =& $workbook->addworksheet('Report');
     $heading =& $workbook->addformat(array('align' => 'center', 'bold' => 1, 'fg_color' => 'yellow'));
     $right =& $workbook->addformat(array('align' => 'right'));
     $left =& $workbook->addformat(array('align' => 'left'));
     # Create a border format
     $border1 =& $workbook->addformat();
     $border1->set_color('magenta');
     $border1->set_bold();
     $border1->set_size(15);
     $border1->set_pattern(0x1);
     $border1->set_fg_color('aqua');
     $border1->set_border_color('yellow');
     $border1->set_top(6);
     $border1->set_bottom(6);
     $border1->set_left(6);
     $border1->set_align('center');
     $border1->set_align('vcenter');
     $border1->set_merge();
     # This is the key feature
     # Create another border format.
     $border2 =& $workbook->addformat();
     $border2->set_color('magenta');
     $border2->set_bold();
     $border2->set_size(15);
     $border2->set_pattern(0x1);
     $border2->set_fg_color('aqua');
     $border2->set_border_color('yellow');
     $border2->set_top(6);
     $border2->set_bottom(6);
     $border2->set_right(6);
     $border2->set_align('center');
     $border2->set_align('vcenter');
     $border2->set_merge();
     # This is the key feature
     /*
     		# Set the row height for row 0 (heading current date)
     		$worksheet->set_row(0, 24);
     	
     		$worksheet->write      (0, 0, "Welcome", $border1);
     		$worksheet->write_blank(0, 1,                        $border2);
     		$worksheet->write_blank(0, 2,                        $border2);
     */
     # Set the row height for row 0 (heading current date)
     $worksheet->set_row(1, 24);
     $current_date = _("As on ") . date('m/d/Y h:i:s') . ", ";
     $heading_total_contacts = $current_date . _("Total Contacts : ") . $num_contacts;
     $worksheet->write(1, 0, $heading_total_contacts, $border1);
     $worksheet->write_blank(1, 1, $border2);
     $worksheet->write_blank(1, 2, $border2);
     $worksheet->write_blank(1, 3, $border2);
     $worksheet->write_blank(1, 4, $border2);
     $worksheet->write_blank(1, 5, $border2);
     $report_heading = array('First Name', 'Last Name', 'Company', 'Position', 'Email', 'Phone', 'Tags');
     $col = 0;
     foreach ($report_heading as $colum) {
         $worksheet->write(3, $col, $colum, $heading);
         $col++;
     }
     $row = 4;
     if ($num_contacts) {
         while ($do_contact->next()) {
             $col = 0;
             $worksheet->write($row, $col, $do_contact->getData('firstname'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('lastname'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('company'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('position'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('email_address'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('phone_number'), $left);
             $col++;
             $worksheet->write($row, $col, $do_contact->getData('tags'), $left);
             $row++;
         }
     } else {
     }
     $workbook->close();
     //header("Location: {$fname}");
     $evtcl->setDisplayNext(new Display($fname));
 }
Пример #24
0
 /**
  * event function to send sales order by email
  * @param object $evctl
  */
 public function sendSalesOrderWithEmail(EventControler $evctl)
 {
     $record_id = $evctl->idsales_order;
     $sales_order_email = $evctl->sales_order_email;
     $crm_global_settings = new CRMGlobalSettings();
     $inventory_prefixes = $crm_global_settings->get_inventory_prefixes();
     $company_address = $crm_global_settings->get_setting_data_by_name('company_address');
     $export_inventory = new ExportInventoryData();
     if ((int) $record_id > 0) {
         if (is_array($sales_order_email) && count($sales_order_email) > 0) {
             $email_template = new EmailTemplate("send_sales_order_email");
             $emailer = new SQEmailer();
             $pdf_filename = $export_inventory->generate_inventory_pdf((int) $record_id, 14, true);
             foreach ($sales_order_email as $key => $val) {
                 $val_exploded = explode(':::', $val);
                 $to_email = $val_exploded[0];
                 $name = $val_exploded[1];
                 $name_explode = explode('::', $name);
                 $email_data = array("sales_order_number" => $inventory_prefixes["salesorder_num_prefix"] . $record_id, "company_name" => CRM_NAME, "firstname" => array_key_exists(0, $name_explode) ? $name_explode[0] : '', "lastname" => array_key_exists(1, $name_explode) ? $name_explode[1] : '', "company_address" => nl2br($company_address));
                 $to_name = (array_key_exists(0, $name_explode) ? $name_explode[0] : '') . ' ' . (array_key_exists(1, $name_explode) ? $name_explode[1] : '');
                 $emailer->IsSendmail();
                 $emailer->setEmailTemplate($email_template);
                 $emailer->mergeArray($email_data);
                 $emailer->AddAddress($to_email, $to_name);
                 $emailer->AddAttachment(OUTBOUND_PATH . '/' . $pdf_filename);
                 $emailer->send();
                 $_SESSION["do_crm_messages"]->set_message('success', _('Email has been sent !'));
                 $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
                 $dis = new Display($next_page);
                 $dis->addParam("sqrecord", $record_id);
                 $evctl->setDisplayNext($dis);
             }
         } else {
             $_SESSION["do_crm_messages"]->set_message('error', _('Operation failed! No email id specified.'));
             $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
             $dis = new Display($next_page);
             $dis->addParam("sqrecord", $record_id);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('Operation failed! No record id specified.'));
         $next_page = NavigationControl::getNavigationLink($evctl->module, "detail");
         $dis = new Display($next_page);
         $dis->addParam("sqrecord", $record_id);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #25
0
 /**
  * Function to add git repo for the project
  * @param eventcontroller 
  **/
 function eventAddProjectGitRepo(EventControler $evtcl)
 {
     $goto = $evtcl->goto;
     $q = new sqlQuery($this->getDbCon());
     $q->query("Insert Into git_project (iduser_gitrepo,idproject) values('" . $evtcl->iduser_gitrepo . "','" . $evtcl->idproject . "')");
     $evtcl->setDisplayNext(new Display($goto));
 }
Пример #26
0
 /**
  * event function to delete the role
  * before deleting it will set the idrole of users to a new selected role which were earlier attached with the role to be deleted
  * @param object $evctl
  * @see popups/role_delete.php
  */
 public function eventDeleteRole(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $do_delete = false;
         $msg = '';
         if ($evctl->idrole != '') {
             if ($evctl->idrole == 'N1' || $evctl->idrole == 'N2') {
                 $msg = _('The role you are trying to delete is not allowd !');
             } else {
                 $role_detail = $this->get_role_detail($evctl->idrole);
                 if (count($role_detail) > 0) {
                     if ($evctl->role_transfer == 'yes') {
                         if ($evctl->idrole_transfer == '') {
                             $msg = _('No role selected to re-assign users !');
                         } else {
                             $do_delete = true;
                         }
                     } else {
                         $do_delete = true;
                     }
                 } else {
                     $msg = _('The role you are trying to delete does not exist !');
                 }
             }
         } else {
             $msg = _('Invalid roleid to perform delete operation !');
         }
         if ($do_delete === false) {
             $_SESSION["do_crm_messages"]->set_message('error', $msg);
             $dis = new Display($evctl->next_page);
             $evctl->setDisplayNext($dis);
         } else {
             $qry = "select * from `role` where `parentrole` like ? AND `idrole` <> ?";
             $this->query($qry, array($role_detail["parentrole"] . '%', $role_detail["idrole"]));
             if ($this->getNumRows() > 0) {
                 while ($this->next()) {
                     $depth = $this->depth;
                     $depth = $depth - 1;
                     $qry1 = "update `role` set `depth` = ? where `idrole` = ? ";
                     $this->getDbConnection()->executeQuery($qry1, array($depth, $this->idrole));
                 }
             }
             $this->query("delete from `role` where `idrole` = ?", array($role_detail["idrole"]));
             $this->query("delete from `role_profile_rel` where `idrole` = ?", array($role_detail["idrole"]));
             if ($evctl->idrole_transfer != '') {
                 $q_upd = "\n\t\t\t\t\tupdate `user` \n\t\t\t\t\tset `idrole` = ?\n\t\t\t\t\twhere `idrole` = ?\n\t\t\t\t\t";
                 $this->query($q_upd, array($evctl->idrole_transfer, $role_detail["idrole"]));
             }
             $_SESSION["do_crm_messages"]->set_message('success', _('Role has been deleted successfully ! '));
             $dis = new Display($evctl->next_page);
             $evctl->setDisplayNext($dis);
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #27
0
 /**
  * function to delete a group
  * while deleting a group the related data will be transferred to user or group which is selected
  * which is selected during the delete process
  * @param object $evctl
  * @see self :: transfer_group_data_to_user()
  * @see self :: transfer_group_data_to_group()
  * @see popups/delete_group_modal.php
  */
 public function eventDeleteRecord(EventControler $evctl)
 {
     $permission = $_SESSION["do_user"]->is_admin == 1 ? true : false;
     if (true === $permission) {
         $id = (int) $evctl->id;
         $group_transfer_opt = false;
         $transfer_to_user = false;
         $transfer_to_group = false;
         if ($evctl->group_transfer_opt == 'yes') {
             $group_transfer_opt = true;
         }
         if ($group_transfer_opt === true) {
             if ($evctl->assigned_to_selector == 'user') {
                 $transfer_to_user = true;
             } elseif ($evctl->assigned_to_selector == 'group') {
                 $transfer_to_group = true;
             }
         } else {
             $transfer_to_user = true;
         }
         if (($transfer_to_user === true || $transfer_to_group === true) && $id > 0) {
             $do_module = new Module();
             $do_module->getAll();
             while ($do_module->next()) {
                 if ($do_module->idmodule == 1 || $do_module->idmodule == 7 || $do_module->idmodule == 8 || $do_module->idmodule == 9) {
                     continue;
                 }
                 $module_name = $do_module->name;
                 $object = new $module_name();
                 if ($transfer_to_user === true) {
                     // transfer group data to selected user
                     $idtransfer = (int) $evctl->user_selector;
                     $this->transfer_group_data_to_user($object, $id, $idtransfer);
                 } elseif ($transfer_to_group === true) {
                     // transfer group data to selected group
                     $idtransfer = (int) $evctl->group_selector;
                     $this->transfer_group_data_to_group($object, $id, $idtransfer);
                 }
             }
             $this->query("delete from `group` where `idgroup` = ?", array($id));
             $_SESSION["do_crm_messages"]->set_message('success', _('Group has been deleted successfully and related data has been transferred !'));
         } else {
             $_SESSION["do_crm_messages"]->set_message('error', _('Unable to delete the group,id is missing !'));
         }
     } else {
         $_SESSION["do_crm_messages"]->set_message('error', _('You do not have permission to delete record !'));
         $next_page = NavigationControl::getNavigationLink("Settings", "index");
         $dis = new Display($next_page);
         $evctl->setDisplayNext($dis);
     }
 }
Пример #28
0
 /**
  * Event method to check the invoice logo extension
  * GIF is not supported by the html2pdf for PDF generation so if user 
  * try to upload gif file give them a message
  */
 function eventCheckInvLogoExtension(EventControler $evtcl)
 {
     // print_r($_FILES);
     $filename = $_FILES['userfile']['name'][0];
     if (is_array($_FILES['userfile']['type'])) {
         $file_type = strtolower($_FILES['userfile']['type'][0]);
     }
     $filename = strtolower($filename);
     $exts = split("[/\\.]", $filename);
     $n = count($exts) - 1;
     $exts = $exts[$n];
     if ($exts == "gif" || $file_type == "image/gif") {
         $evtcl->updateparam("doSave", "no");
         unset($_FILES);
         $_SESSION['in_page_message'] = _("GIF files for logo is not supported");
         $evtcl->setDisplayNext(new Display("settings_invoice.php"));
     }
 }
Пример #29
0
 function eventAjaxToggleAutoFetch(EventControler $evctl)
 {
     $idcontact_website = $evctl->idcontact_website;
     $this->getId($idcontact_website);
     if ($this->feed_auto_fetch == 'Yes') {
         $this->feed_auto_fetch = 'No';
         $icon = "/images/feed-icon-12x12-orange.gif";
     } else {
         $idcontact = $this->idcontact;
         $website = $this->website;
         $this->insertNotes($idcontact, $website, $idcontact_website);
         $this->feed_auto_fetch = 'Yes';
         $icon = "/images/feed-icon-12x12-green.png";
     }
     $this->update();
     $evctl->addOutputValue($icon);
 }
Пример #30
0
 /**
  * event function to signout
  * @param object $evctl
  */
 public function eventLogout(\EventControler $evctl)
 {
     //do login audit
     $this->setFree();
     $this->free();
     // Unset all of the session variables.
     $_SESSION = array();
     // If it's desired to kill the session, also delete the session cookie.
     // Note: This will destroy the session, and not just the session data!
     if (isset($_COOKIE[session_name()])) {
         setcookie(session_name(), '', time() - 42000, '/cpanel/');
     }
     // Finally, destroy the session.
     session_destroy();
     $dis = new \Display('/cpanel/modules/User/login');
     $evctl->setDisplayNext($dis);
 }