Skip to content

Commit 2fd75a4

Browse files
author
Shaun Kutch
committed
Added description back with checking
1 parent 58326e0 commit 2fd75a4

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

application/controllers/sales.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function edit_item($line)
146146
$this->form_validation->set_rules('price', 'lang:items_price', 'required|numeric');
147147
$this->form_validation->set_rules('quantity', 'lang:items_quantity', 'required|numeric');
148148

149+
$description = $this->input->post("description");
149150
$serialnumber = $this->input->post("serialnumber");
150151
$price = $this->input->post("price");
151152
$quantity = $this->input->post("quantity");
@@ -154,7 +155,7 @@ function edit_item($line)
154155

155156
if ($this->form_validation->run() != FALSE)
156157
{
157-
$this->sale_lib->edit_item($line,$serialnumber,$quantity,$discount,$price);
158+
$this->sale_lib->edit_item($line,$description,$serialnumber,$quantity,$discount,$price);
158159
}
159160
else
160161
{

application/libraries/Sale_lib.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,31 @@ function get_item_id($line_to_get)
271271
return -1;
272272
}
273273

274-
function edit_item($line,$serialnumber,$quantity,$discount,$price)
274+
function edit_item($line,$description,$serialnumber,$quantity,$discount,$price)
275275
{
276276
$items = $this->get_cart();
277277
if(isset($items[$line]))
278278
{
279-
$items[$line]['serialnumber'] = $serialnumber;
280-
$items[$line]['quantity'] = $quantity;
281-
$items[$line]['discount'] = $discount;
282-
$items[$line]['price'] = $price;
279+
if(isset($description))
280+
{
281+
$items[$line]['description'] = $description;
282+
}
283+
if(isset($serialnumber))
284+
{
285+
$items[$line]['serialnumber'] = $serialnumber;
286+
}
287+
if(isset($quantity))
288+
{
289+
$items[$line]['quantity'] = $quantity;
290+
}
291+
if(isset($discount))
292+
{
293+
$items[$line]['discount'] = $discount;
294+
}
295+
if(isset($price))
296+
{
297+
$items[$line]['price'] = $price;
298+
}
283299
$this->set_cart($items);
284300
}
285301

0 commit comments

Comments
 (0)