Added preorderTrigger / added cif api docs
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
class Preorder_Statustrigger_145 {
|
||||
private $log;
|
||||
|
||||
private $preorder;
|
||||
private $new_status;
|
||||
|
||||
public function __construct(Preorder $preorder, Preorderstatus $new_status) {
|
||||
$this->log = mfLoghandler::singleton();
|
||||
|
||||
$this->preorder = $preorder;
|
||||
$this->new_status = $new_status;
|
||||
}
|
||||
|
||||
public function run() {
|
||||
$this->log->debug(__METHOD__.": running trigger");
|
||||
|
||||
$changes = false;
|
||||
|
||||
if(!$this->preorder->ciftoken) {
|
||||
$this->preorder->ciftoken = $this->preorder->createCiftoken();
|
||||
$changes = true;
|
||||
}
|
||||
|
||||
/*if(!$this->preorder->ciftoken) {
|
||||
$this->log->warning("Error creating ciftoken for preorder ".$this->preorder->id);
|
||||
return true;
|
||||
}*/
|
||||
if(!$this->preorder->cifurl) {
|
||||
$this->preorder->cifurl = $this->preorder->generateCifUrl();
|
||||
$changes = true;
|
||||
}
|
||||
|
||||
if(!$this->preorder->cifcableurl) {
|
||||
$this->preorder->cifcableurl = $this->preorder->generateCifCableUrl();
|
||||
$changes = true;
|
||||
}
|
||||
|
||||
if($changes) {
|
||||
$this->preorder->save();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user