Skip to content

Commit

Permalink
Merge pull request smarty-php#7 from think-ahead/ticket-#5001-kirei-a…
Browse files Browse the repository at this point in the history
…dd-facility-master

Ticket #5001 kirei add facility master (Implement the Save Facility function)
  • Loading branch information
think-katou authored Sep 12, 2020
2 parents 78fe05c + 0bec5ca commit bbc68cd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
define('DEFAULT_STARTPAGE', 1);
define('DEFAULT_ROWS', 2); //予約 Column
define('DEFAULT_PHONEROWS', 1); //来店 Column
define('DEFAULT_FACILITY_ROWS', 1); //予約 Column
define('DEFAULT_FACILITY_ACCEPTABLECOUNT', 1); //予約 Column
define('MIN_SERVICE_TIME', 15);
define('OVER_MAXTIME', '03:00');
define('MAXTIME', '23:59');
Expand Down
17 changes: 9 additions & 8 deletions app/controllers/components/misc_function.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,14 +1845,14 @@ function GetAvailableFacilities(&$controller, $dbname, $storecode)
{
return array(
array(
"FACILITYID" => 1,
"FACILITYNAME" => "Facility 1",
"ROWS" => DEFAULT_FACILITY_ROWS
"Id" => 1,
"Name" => "Facility 1",
"AcceptableCount" => DEFAULT_FACILITY_ACCEPTABLECOUNT
),
array(
"FACILITYID" => 2,
"FACILITYNAME" => "Facility 2",
"ROWS" => DEFAULT_FACILITY_ROWS
"Id" => 1,
"Name" => "Facility 1",
"AcceptableCount" => DEFAULT_FACILITY_ACCEPTABLECOUNT
),
);
}
Expand All @@ -1869,8 +1869,9 @@ public function GetKanzashiSalons(&$controller, $companyid, $storecode)
{
$sql = "
SELECT
pos_id as PosId,
kanzashi_id As SalonId,
pos_id As SalonId,
kanzashi_id As KanzashiId,
pos_name as Name,
kanzashi_type As KanzashiType,
status As Status,
sync_kanzashi_enabled_staff_reservation_only As SyncKanzashiEnabledStaffReservationOnly,
Expand Down
65 changes: 59 additions & 6 deletions app/controllers/servers_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -1090,6 +1090,15 @@ class ServersController extends WebServicesController
'kanzashisalonid' => 'xsd:int'
),
'output' => array('return' => 'xsd:string')
),

'wsSaveFacility' => array(
'doc' => '設備を保存する',
'input' => array(
'sessionid' => 'xsd:string',
'facility' => 'tns:facilityInformation'
),
'output' => array('return' => 'xsd:boolean')
)

//- ############################################################
Expand Down Expand Up @@ -1146,8 +1155,8 @@ class ServersController extends WebServicesController
),

'KanzashiSalon' => array('struct' => array(
'PosId' => 'xsd:int',
'SalonId' => 'xsd:int',
'KanzashiId' => 'xsd:int',
'Name' => 'xsd:string',
'KanzashiType' => 'xsd:string',
'Status' => 'xsd:int',
Expand All @@ -1160,7 +1169,7 @@ class ServersController extends WebServicesController

'KanzashiInfo' => array(
'struct' => array(
'SalonId' => 'xsd:int',
'KanzashiId' => 'xsd:int',
'Status' => 'xsd:int',
'SyncKanzashiEnabledStaffReservationOnly' => 'xsd:boolean',
'FreeStaffcode' => 'xsd:int',
Expand Down Expand Up @@ -1326,9 +1335,10 @@ class ServersController extends WebServicesController
)),

'facilityInformation' => array('struct' => array(
'FACILITYID' => 'xsd:int',
'FACILITYNAME' => 'xsd:string',
'ROWS' => 'xsd:int'
'Id' => 'xsd:int',
'Name' => 'xsd:string',
'SalonId' => 'xsd:int',
'AcceptableCount' => 'xsd:int'
)),

'_facilityInformation' => array(
Expand Down Expand Up @@ -3330,7 +3340,7 @@ function wsLogin($param)
//In the future, when multiple kanzashi account is supported,
//the property for Salons should be remove from KanzashiInfo object
$arrReturn['KanzashiInfo'] = array(
'SalonId' => $salons[0]['SalonId'],
'KanzashiId' => $salons[0]['KanzashiId'],
'Status' => $salons[0]['Status'],
'SyncKanzashiEnabledStaffReservationOnly' => (bool)$salons[0]['SyncKanzashiEnabledStaffReservationOnly'],
'FreeStaffcode' => $salons[0]['FreeStaffcode'],
Expand Down Expand Up @@ -11218,4 +11228,47 @@ function wsGetServerDateTime($sessionid)

return date('Y-m-d H:i:s');
}

/**
* Summary of wsSaveFacility
* @param string $sessionid
* @param facilityInformation
* @return boolean
*/
public function wsSaveFacility($sessionid, $facility)
{
$storeinfo = $this->YoyakuSession->Check($this);

if ($storeinfo == false) {
$this->_soap_server->fault(1, '', INVALID_SESSION);
return;
}

$this->Store->set_company_database($storeinfo['dbname'], $this->Store);

$params = array(
'pos_id' => $facility['FACILITYID'] >= 0 ? $facility['FACILITYID'] : null,
'name' => $facility['FACILITYNAME'],
'salon_pos_id' => $facility['SALONID'],
'acceptable_count' => $facility['ACCEPTABLECOUNT'],
);

$query = "
INSERT INTO kanzashi_facility
(pos_id, name, salon_pos_id, acceptable_count)
VALUES
(:pos_id, :name, :salon_pos_id, :acceptable_count)
ON DUPLICATE KEY UPDATE
name = :name,
salon_pos_id = :salon_pos_id,
acceptable_count = :acceptable_count,
updatedate = CURRENT_TIMESTAMP;
";
//Note that in order to confirm wether record is updated during update,
//the UPDATEDATE is set to CURRENT_TIMESTAMP, because if the new values are the same
//from the old values during update the getAffectedRows will return 0

$this->Store->query($query, $params, false);
return $this->Store->getAffectedRows() > 0;
}
}//end class ServersController

0 comments on commit bbc68cd

Please sign in to comment.