Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/BillComApi/BillCom.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,39 @@ public function delete($obj_url, $obj_id)
return $this->crud('Delete', $obj_url, array('id' => $obj_id));
}

public function set_approvers($data)
{
if ($data['entity'] != "Bill" && $data['entity'] != "VendorCredit") {
throw new BillcomException("Invalid entity type. Only Bill or VendorCredit is supported.");
}

if (count($data['approvers']) < 1) {
throw new BillcomException("Approvers are required.");
}

if (empty($this->session_id)) {
$this->login();
}

$result = $this->do_request(
$this->host . "SetApprovers.json",
array(
'devKey' => $this->dev_key,
'sessionId' => $this->session_id,
'data' => json_encode($data),
)
);
if ($result->succeeded()) {
return $result->get_data();
} else {
throw new BillComException(sprintf(
"Error during SetApprovers. data:\n%s\nresponse details:\n%s",
var_export($data, true),
var_export($result, true)
));
}
}

/**
* Approve an object, can only be Bill or VendorCredit
* @param
Expand Down