Beispiel #1
0
 public function updateClient()
 {
     global $whmcs;
     $exinfo = getClientsDetails($this->getID());
     if (defined("ADMINAREA")) {
         $updatefieldsarray = array();
     } else {
         $updatefieldsarray = array("firstname" => "First Name", "lastname" => "Last Name", "companyname" => "Company Name", "email" => "Email Address", "address1" => "Address 1", "address2" => "Address 2", "city" => "City", "state" => "State", "postcode" => "Postcode", "country" => "Country", "phonenumber" => "Phone Number", "billingcid" => "Billing Contact");
         if ($whmcs->get_config("AllowClientsEmailOptOut")) {
             $updatefieldsarray['emailoptout'] = "Newsletter Email Opt Out";
         }
     }
     $changelist = array();
     $updateqry = array();
     foreach ($updatefieldsarray as $field => $displayname) {
         if ($this->isEditableField($field)) {
             $value = $whmcs->get_req_var($field);
             if ($field == "emailoptout" && !$value) {
                 $value = "0";
             }
             $updateqry[$field] = $value;
             if ($value != $exinfo[$field]) {
                 $changelist[] = "" . $displayname . ": '" . $exinfo[$field] . "' to '" . $value . "'";
                 continue;
             }
             continue;
         }
     }
     update_query("tblclients", $updateqry, array("id" => $this->getID()));
     $old_customfieldsarray = getCustomFields("client", "", $this->getID(), "", "");
     $customfields = getCustomFields("client", "", $this->getID(), "", "");
     foreach ($customfields as $v) {
         $k = $v['id'];
         $customfieldsarray[$k] = $_POST['customfield'][$k];
     }
     saveCustomFields($this->getID(), $customfieldsarray);
     $paymentmethod = $whmcs->get_req_var("paymentmethod");
     clientChangeDefaultGateway($this->getID(), $paymentmethod);
     if ($paymentmethod != $exinfo['defaultgateway']) {
         $changelist[] = "Default Payment Method: '" . getGatewayName($exinfo['defaultgateway']) . "' to '" . getGatewayName($paymentmethod) . "'<br>\n";
     }
     run_hook("ClientEdit", array_merge(array("userid" => $this->getID(), "olddata" => $exinfo), $updateqry));
     if (!defined("ADMINAREA") && $whmcs->get_config("SendEmailNotificationonUserDetailsChange")) {
         foreach ($old_customfieldsarray as $values) {
             if ($values['value'] != $_POST['customfield'][$values['id']]) {
                 $changelist[] = $values['name'] . ": '" . $values['value'] . "' to '" . $_POST['customfield'][$values['id']] . "'";
                 continue;
             }
         }
         if (0 < count($changelist)) {
             $adminurl = $whmcs->get_config("SystemSSLURL") ? $whmcs->get_config("SystemSSLURL") : $whmcs->get_config("SystemURL");
             $adminurl .= "/" . $whmcs->get_admin_folder_name() . "/clientssummary.php?userid=" . $this->getID();
             sendAdminNotification("account", "WHMCS User Details Change", "<p>Client ID: <a href=\"" . $adminurl . "\">" . $this->getID() . " - " . $exinfo['firstname'] . " " . $exinfo['lastname'] . "</a> has requested to change his/her details as indicated below:<br><br>" . implode("<br />\n", $changelist) . "<br>If you are unhappy with any of the changes, you need to login and revert them - this is the only record of the old details.</p>");
             logActivity("Client Profile Modified - " . implode(", ", $changelist) . " - User ID: " . $this->getID());
         }
     }
     return true;
 }
Beispiel #2
0
     $urgency = $data['urgency'];
     $lastreply = $data['lastreply'];
     $lastreply = fromMySQLDate($lastreply, 1, 1);
     $clientunread = $data['clientunread'];
     $tstatus = getStatusColour($tstatus);
     $dept = getDepartmentName($deptid);
     $urgency = $_LANG["supportticketsticketurgency" . strtolower($urgency)];
     $tickets[] = array("id" => $id, "tid" => $tid, "c" => $c, "date" => $date, "department" => $dept, "subject" => $subject, "status" => $tstatus, "urgency" => $urgency, "lastreply" => $lastreply, "unread" => $clientunread);
 }
 $ca->assign("tickets", $tickets);
 $invoice = new WHMCS_Invoice();
 $invoices = $invoice->getInvoices("Unpaid", $client->getID(), "id", "DESC");
 $ca->assign("invoices", $invoices);
 $ca->assign("totalbalance", $invoice->getTotalBalanceFormatted());
 $ca->assign("masspay", $CONFIG['EnableMassPay']);
 $ca->assign("defaultpaymentmethod", getGatewayName($clientsdetails['defaultgateway']));
 $files = $client->getFiles($client->getID());
 $ca->assign("files", $files);
 $ca->assign("addfundsenabled", $CONFIG['AddFundsEnabled']);
 $announcements = array();
 $result = select_query("tblannouncements", "", array("published" => "on"), "date", "DESC", "0,3");
 while ($data = mysql_fetch_array($result)) {
     $id = $data['id'];
     $date = $data['date'];
     $title = $data['title'];
     $announcement = $data['announcement'];
     $result2 = select_query("tblannouncements", "", array("parentid" => $id, "language" => $_SESSION['Language']));
     $data = mysql_fetch_array($result2);
     if ($data['title']) {
         $title = $data['title'];
     }