add account on product move
This commit is contained in:
parent
41215c1bfb
commit
b2bd7975db
@ -271,6 +271,12 @@ class Products extends BaseController {
|
|||||||
$results = $query->getResultArray();
|
$results = $query->getResultArray();
|
||||||
$data['sites'] = $results;
|
$data['sites'] = $results;
|
||||||
|
|
||||||
|
|
||||||
|
$sql = "select * from accounts";
|
||||||
|
$query = $db->query($sql);
|
||||||
|
$results = $query->getResultArray();
|
||||||
|
$data['accounts'] = $results;
|
||||||
|
|
||||||
$data['productowners'] = $this->data['productowners'];
|
$data['productowners'] = $this->data['productowners'];
|
||||||
|
|
||||||
if ($this->request->getMethod() === 'POST') {
|
if ($this->request->getMethod() === 'POST') {
|
||||||
@ -289,7 +295,8 @@ class Products extends BaseController {
|
|||||||
'siteid' => $this->request->getVar('siteid'),
|
'siteid' => $this->request->getVar('siteid'),
|
||||||
'oldlocationenddate' => $this->request->getVar('oldlocationenddate'),
|
'oldlocationenddate' => $this->request->getVar('oldlocationenddate'),
|
||||||
'newlocationstartdate' => $this->request->getVar('newlocationstartdate'),
|
'newlocationstartdate' => $this->request->getVar('newlocationstartdate'),
|
||||||
'productowner' => $this->request->getVar('productowner')
|
'productowner' => $this->request->getVar('productowner'),
|
||||||
|
'accountid_productowner' => $this->request->getVar('accountid_productowner'),
|
||||||
];
|
];
|
||||||
|
|
||||||
if($this->validate($rules)){
|
if($this->validate($rules)){
|
||||||
@ -299,16 +306,16 @@ class Products extends BaseController {
|
|||||||
$oldlocationenddate = $data['new_value']['oldlocationenddate'];
|
$oldlocationenddate = $data['new_value']['oldlocationenddate'];
|
||||||
$newlocationstartdate = $data['new_value']['newlocationstartdate'];
|
$newlocationstartdate = $data['new_value']['newlocationstartdate'];
|
||||||
$productowner = $data['new_value']['productowner'];
|
$productowner = $data['new_value']['productowner'];
|
||||||
|
$accountid_productowner = $data['new_value']['accountid_productowner'];
|
||||||
// products_log
|
// products_log
|
||||||
$sql = "INSERT INTO products_log
|
$sql = "INSERT INTO products_log
|
||||||
(productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, logdate )
|
(productid, siteid, catalogid, locationstartdate, locationenddate, installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, accountid_productowner, logdate )
|
||||||
SELECT productid, siteid,catalogid, locationstartdate, '$oldlocationenddate', installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, NOW()
|
SELECT productid, siteid,catalogid, locationstartdate, '$oldlocationenddate', installationdate, warrantystartdate, warrantyenddate, productowner, productserviceid, statuspart, accountid_productowner, NOW()
|
||||||
FROM products WHERE productid='$productid'";
|
FROM products WHERE productid='$productid'";
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
|
|
||||||
// products
|
// products
|
||||||
$sql = "update products set siteid='$siteid', locationstartdate='$newlocationstartdate', productowner='$productowner' where productid='$productid'";
|
$sql = "update products set siteid='$siteid', locationstartdate='$newlocationstartdate', productowner='$productowner', accountid_productowner='$accountid_productowner' where productid='$productid'";
|
||||||
$query = $db->query($sql);
|
$query = $db->query($sql);
|
||||||
return view('form_success');
|
return view('form_success');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -8,6 +8,7 @@ $siteid = '';
|
|||||||
$newlocationstartdate = '';
|
$newlocationstartdate = '';
|
||||||
$oldlocationenddate = '';
|
$oldlocationenddate = '';
|
||||||
// $installationdate = '';
|
// $installationdate = '';
|
||||||
|
$accountid_productowner = '';
|
||||||
$productowner = '';
|
$productowner = '';
|
||||||
if(isset($products)) { $data = $products[0]; }
|
if(isset($products)) { $data = $products[0]; }
|
||||||
if(isset($new_value)) { $data = $new_value; }
|
if(isset($new_value)) { $data = $new_value; }
|
||||||
@ -16,6 +17,7 @@ if(isset($data)) {
|
|||||||
$siteid = $data['siteid'];
|
$siteid = $data['siteid'];
|
||||||
if(isset($data['newlocationstartdate'])) { $newlocationstartdate = $data['newlocationstartdate']; }
|
if(isset($data['newlocationstartdate'])) { $newlocationstartdate = $data['newlocationstartdate']; }
|
||||||
if(isset($data['oldlocationenddate'])) { $oldlocationenddate = $data['oldlocationenddate']; }
|
if(isset($data['oldlocationenddate'])) { $oldlocationenddate = $data['oldlocationenddate']; }
|
||||||
|
if(isset($data['accountid_productowner'])) { $accountid_productowner = $data['accountid_productowner']; }
|
||||||
|
|
||||||
// if (isset($data['installationdate'])) {
|
// if (isset($data['installationdate'])) {
|
||||||
// $installationdate = $data['installationdate'];
|
// $installationdate = $data['installationdate'];
|
||||||
@ -114,6 +116,23 @@ if(isset($data)) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-3 col-form-label">Account Product Owner</label>
|
||||||
|
<div class="col-9">
|
||||||
|
<select class="form-control select2" name='accountid_productowner' >
|
||||||
|
<option value=''>-</option>
|
||||||
|
<?php
|
||||||
|
foreach ($accounts as $data) {
|
||||||
|
$qaccountid = $data['accountid'];
|
||||||
|
$qaccountname = $data['accountname'];
|
||||||
|
if ($qaccountid == $accountid_productowner) { echo "<option value='$qaccountid' selected>$qaccountname</option>"; }
|
||||||
|
else { echo "<option value='$qaccountid'>$qaccountname</option>"; }
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<button type="button" class="btn btn-dark float-start" onclick="window.close()">Cancel</button>
|
<button type="button" class="btn btn-dark float-start" onclick="window.close()">Cancel</button>
|
||||||
<button type="submit" class="btn btn-success text-white float-end"> <i class="fa fa-check"></i> Submit</button>
|
<button type="submit" class="btn btn-success text-white float-end"> <i class="fa fa-check"></i> Submit</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user