46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
class Preorder_Statustrigger_140 {
|
|
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;
|
|
}
|
|
} |