Example #1
0
 /**
  * @return bool
  */
 public function purge()
 {
     $update = $this->client->createUpdate();
     $update->addDeleteQuery($this->deleteQuery);
     $update->addCommit();
     $result = $this->client->update($update);
     return 0 == $result->getStatus();
 }
Example #2
0
 function test_update()
 {
     $name = "Megan";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client_name = "Shawnee";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($id, $client_name, $stylist_id);
     $test_client->save();
     $new_client_name = "Katie Saccomanno";
     $test_client->update($new_client_name);
     $this->assertEquals("Katie Saccomanno", $test_client->getClientName());
 }
Example #3
0
 function testUpdate()
 {
     //Arrange
     $name = "Bob";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client_name = "Gertrude";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id, $id);
     $test_client->save();
     $new_client_name = "Billy";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Billy", $test_client->getName());
 }
Example #4
0
 function testUpdate()
 {
     //Arrange
     $name = "Jackie";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name = "Sandra Jane";
     $phone = "542-334-0984";
     $style_choice = "The Rachel";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $phone, $style_choice, $stylist_id);
     $test_client->save();
     $column_to_update = "style_choice";
     $new_information = "buffont";
     //Act
     $test_client->update($column_to_update, $new_information);
     //Assert
     $result = Client::getAll();
     $this->assertEquals("buffont", $result[0]->getStyleChoice());
 }
Example #5
0
 function test_update()
 {
     //Arrange
     $name = "Erin";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $name = "George";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $stylist_id, $id);
     $test_client->save();
     $new_name = "Jim";
     $new_test_client = new Client($new_name, $stylist_id, $test_client->getId());
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals($test_client, $new_test_client);
 }
Example #6
0
 public function save_order()
 {
     $client_array = $_POST['client_id'];
     $order_array = $_POST['order'];
     $client = new Client();
     foreach ($client_array as $key => $value) {
         $client_id = $value;
         $client_order = $order_array[$key];
         $client->update('Client', array('sequence' => $client_order), 'id=' . $client_id);
     }
     Flash::set('success', __('This client sequence has been saved.'));
     if ($_POST['album_id'] > 0) {
         redirect(get_url('client/view_album/' . $_POST['album_id']));
     } else {
         redirect(get_url('client'));
     }
 }
Example #7
0
 function testUpdate()
 {
     $name = "Bob";
     $phone = "555-555-5555";
     $stylist_id = 1;
     $test_client = new Client($name, $phone, $stylist_id);
     $new_name = "Stuart";
     $new_phone = "444-444-4444";
     $new_stylist_id = 2;
     $new_client = new Client($new_name, $new_phone, $new_stylist_id);
     $test_client->update($new_name, $new_phone, $new_stylist_id);
     $this->assertEquals($new_client, $test_client);
 }
Example #8
0
 function testUpdateName()
 {
     //Arrange
     $id = null;
     $name = "Martha Stewart";
     $phone = "(888) 888-8888";
     $next_visit = "2015-09-06";
     $stylist_id = 1;
     $test_client = new Client($id, $name, $phone, $next_visit, $stylist_id);
     $test_client->save();
     $new_name = "Katie Curic";
     $name = 'client_name';
     //Act
     $test_client->update($name, $new_name);
     //Assert
     $clients = Client::getAll();
     $result = $clients[0]->getClientName();
     $this->assertEquals($new_name, $result);
 }
 function testUpdateName()
 {
     //Arrange
     $id = null;
     $client_name = "Nico";
     $stylist_id = 1;
     $test_client = new Client($id, $client_name, $stylist_id);
     $test_client->save();
     $new_client_name = "Nico Underground";
     $client_name = 'client_name';
     //Act
     $test_client->update($client_name, $new_client_name);
     //Assert
     $clients = Client::getAll();
     $result = $clients[0]->getClientName();
     $this->assertEquals($new_client_name, $result);
 }
 public function create()
 {
     if (isset($_POST['name']) && !empty($_POST['name'])) {
         $obj = new Client();
         $error = array();
         $obj->name = strip_tags($_POST['name']);
         $obj->addy = strip_tags($_POST['addy']);
         $obj->visible = $_POST['visible'];
         $obj->phone = $_POST['phone'];
         $obj->email = $_POST['email'];
         $obj->descr = $_POST['desc'];
         $obj->username = $_POST['username'];
         $phpFileUploadErrors = array(0 => 'There is no error, the file uploaded with success', 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 3 => 'The uploaded file was only partially uploaded', 4 => 'No file was uploaded', 6 => 'Missing a temporary folder', 7 => 'Failed to write file to disk.', 8 => 'A PHP extension stopped the file upload.');
         if (isset($_FILES['fupload']) && $_FILES['fupload']['error'] == 0) {
             //if file upload is set
             move_uploaded_file($_FILES['fupload']['tmp_name'], "../public/uploads/" . basename($_FILES['fupload']['name']));
             $image = new Imageresize();
             // an instance of image resize object
             $image->load("../public/uploads/" . basename($_FILES['fupload']['name']));
             //$image->image =;
             $image->resize(400, 400);
             $image->save("../public/uploads/" . basename($_FILES['fupload']['name']));
             //this section is needed to get the extension for image type in renaming the image
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/png") {
                 $ext = ".png";
             }
             if ($_FILES['fupload']['type'] == "image/jpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/pjpeg") {
                 $ext = ".jpeg";
             }
             if ($_FILES['fupload']['type'] == "image/gif") {
                 $ext = ".gif";
             }
             if ($_FILES['fupload']['type'] == "image/jpg") {
                 $ext = ".jpg";
             }
             $new_name = uniqid() . "_" . time() . $ext;
             //new name for the image
             rename("../public/uploads/" . basename($_FILES['fupload']['name']), "../public/uploads/" . $new_name);
             $photo = $new_name;
             $obj->image = $photo;
         } else {
             //$applicant->img_url = $_REQUEST['imgvalue'];
             echo $phpFileUploadErrors[$_FILES['fupload']['error']];
             exit;
         }
         if ($_POST['password'] == $_POST['r_password']) {
             $obj->password = $_POST['password'];
         } else {
             array_push($error, "Password do not match");
         }
         if (empty($error)) {
             if ($obj->create()) {
                 $obj->main_id = Client::getID("CLT", $obj->id);
                 $obj->update();
                 return 1;
             } else {
                 return 2;
             }
         }
     }
 }
Example #11
0
 function test_update()
 {
     $name = "Sally";
     $phone = "555-555-5555";
     $id = null;
     $test_stylist = new Stylist($name, $phone, $id);
     $test_stylist->save();
     $name = "Maggie";
     $phone = "123-321-1234";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $phone, $id, $stylist_id);
     $test_client->save();
     $new_name = "George";
     $new_phone = "123-456-7890";
     $test_client->update($new_name, $new_phone);
     $this->assertEquals("George", $test_client->getName());
     $this->assertEquals("123-456-7890", $test_client->getPhone());
 }
Example #12
0
 function testUpdate()
 {
     //Arrange
     $name = "jerry";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name = "bob ";
     $phone = "123-456-7890";
     $style_choice = "long cut";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name, $phone, $style_choice, $stylist_id);
     $test_client->save();
     $column_to_update = "style_choice";
     $new_information = "long cut";
     //Act
     $test_client->update($column_to_update, $new_information);
     //Assert
     $result = Client::getAll();
     $this->assertEquals("long cut", $result[0]->getStyleChoice());
 }
Example #13
0
 function test_update()
 {
     //Arrange
     $client_name = "Paco";
     $id = null;
     $stylist_id = 2;
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_client_name = "Pablo";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Pablo", $test_client->getClientName());
 }
Example #14
0
 function test_update()
 {
     //Arrange
     $name = "Becky";
     $id = null;
     $test_stylist = new Stylist($name, $id);
     $test_stylist->save();
     $client = "Mark";
     $phone = "123-456-7890";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client, $phone, $stylist_id, $id);
     $test_client->save();
     $new_client_name = "Peter";
     //Act
     $test_client->update($new_client_name);
     //Assert
     $this->assertEquals("Peter", $test_client->getName());
 }
Example #15
0
 function test_update()
 {
     //Arrange
     $stylist_name = "Ed Scissorhands";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Bed Head";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_name = "Hairy Carey";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("Hairy Carey", $test_client->getClientName());
 }
Example #16
0
 public function saveClient($id, $coffees, $freeCups, $name, $middlename, $lastname, $telephone, $email, $comment)
 {
     $db = $this->db;
     $newClient = new Client();
     $newClient->name = $name;
     $newClient->middlename = $middlename;
     $newClient->lastname = $lastname;
     $newClient->coffees = $coffees;
     $newClient->freeCups = $freeCups;
     $newClient->telephone = $telephone;
     $newClient->email = $email;
     $newClient->registred = date('Y-m-d');
     $newClient->comment = $comment;
     if (0 != $id) {
         $newClient->id = $id;
         $newClient->update($db);
     } else {
         $newClient->save($db);
     }
 }
Example #17
0
 function test_update()
 {
     //Arrange
     $stylist_name = "gary";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "jerry";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $id, $stylist_id);
     $test_client->save();
     $new_name = "larry";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("larry", $test_client->getClientName());
 }
Example #18
0
function doEdit()
{
    if (isset($_POST['submit'])) {
        $CLIENT_ID = $_POST['client_id'];
        $CLIENTNAME = $_POST['name'];
        $SHORTNAME = $_POST['shortname'];
        $ADDRESS = $_POST['address'];
        $EMAIL = $_POST['email'];
        $TELEPHONE = $_POST['telephone'];
        $WEBSITE = $_POST['website'];
        $SECTOR = $_POST['sector'];
        $client = new Client();
        $client->client_id = $CLIENT_ID;
        $client->client_name = $CLIENTNAME;
        $client->client_short_name = $SHORTNAME;
        $client->client_address = $ADDRESS;
        $client->client_email = $EMAIL;
        $client->client_Telephone = $TELEPHONE;
        $client->client_website = $WEBSITE;
        $client->client_sector = $SECTOR;
    }
    if ($CLIENT_ID == "") {
        message('Client ID is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($CLIENTNAME == "") {
        message('Name is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($SHORTNAME == "") {
        message('Short Name is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($ADDRESS == "") {
        message('Address is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($EMAIL == "") {
        message('Email is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($TELEPHONE == "") {
        message('Display name is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($WEBSITE == "") {
        message('Qualification is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    } elseif ($SECTOR == "") {
        message('Title is required!', "error");
        redirect('index.php?view=edit&id=' . $client_id);
    }
    $client->update($_GET['id']);
    message('Client information updated successfully!', "info");
    redirect('index.php');
}
 function test_client_update()
 {
     //Arrange
     $name = "Vidal Sassoon";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $name1 = "Mr. T";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($name1, $stylist_id, null);
     $test_client->save();
     $new_name = "Clubber Lang";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals($new_name, $test_client->getName());
 }
Example #20
0
 function test_update()
 {
     $name = "Jane Doe";
     $test_stylist = new Stylist($name);
     $test_stylist->save();
     $client_name = "Jimmy";
     $client_stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $client_stylist_id);
     $test_client->save();
     $client_name2 = "Coco";
     $test_client->update($client_name2, $client_stylist_id);
     $result = Client::getAll();
     $this->assertEquals($client_name2, $result[0]->getName());
 }
Example #21
0
                 } else {
                     $errors['err'] = _('Uknown command!');
                 }
             } else {
                 $errors['err'] = _('No roles selected.');
             }
     }
     break;
 case 'client':
     include_once INCLUDE_DIR . 'class.client.php';
     $do = strtolower($_POST['do']);
     switch ($do) {
         case 'update':
             $client = new Client($_POST['client_id']);
             if ($client && $client->getId()) {
                 if ($client->update($_POST, $errors)) {
                     $msg = _('Client profile updated successfully');
                 } elseif (!$errors['err']) {
                     $errors['err'] = _('Error updating the user');
                 }
             } else {
                 $errors['err'] = _('Internal error');
             }
             break;
         case 'create':
             if ($uID = Client::create($_POST, $errors)) {
                 $msg = sprintf(_('%s added successfully'), Format::htmlchars($_POST['client_firstname'] . ' ' . $_POST['client_lastname']));
             } elseif (!$errors['err']) {
                 $errors['err'] = _('Unable to add the user. Internal error');
             }
             break;
Example #22
0
 function test_update()
 {
     //Arrange
     $stylist_name = "Big Bird";
     $id = null;
     $test_stylist = new Stylist($stylist_name, $id);
     $test_stylist->save();
     $client_name = "Harry Potter";
     $stylist_id = $test_stylist->getId();
     $test_client = new Client($client_name, $stylist_id);
     $test_client->save();
     $new_name = "Spock";
     //Act
     $test_client->update($new_name);
     //Assert
     $this->assertEquals("Spock", $test_client->getClientName());
 }