Exemplo n.º 1
0
 /**
  * When performing various scripted tasks such as polling interface statistics and generating
  * filenames, we use `monitorindex` as a label. These should be unique across a customer's
  * physical interfaces (but not unique across all customers).
  *
  * @param \Entities\Customer $customer The customer to find the next sequential monitor index
  * @return int The next sequential monitor index
  */
 public function getNextMonitorIndex($customer)
 {
     $maxMonIndex = 0;
     foreach ($customer->getVirtualInterfaces() as $vi) {
         foreach ($vi->getPhysicalInterfaces() as $pi) {
             if ($pi->getMonitorIndex() > $maxMonIndex) {
                 $maxMonIndex = $pi->getMonitorIndex();
             }
         }
     }
     return $maxMonIndex + 1;
 }
Exemplo n.º 2
0
 /**
  *
  * @param IXP_Form_Customer $form The Send form object
  * @param \Entities\Customer $object The Doctrine2 entity (being edited or blank for add)
  * @param bool $isEdit True if we are editing, otherwise false
  * @return bool If false, the form is not processed
  */
 protected function addPreFlush($form, $object, $isEdit)
 {
     if (!$object->getDatejoin() instanceof DateTime) {
         $object->setDatejoin(new DateTime($form->getValue('datejoin')));
     }
     if (!$object->getDateleave() instanceof DateTime) {
         if (!$form->getValue('dateleave')) {
             $object->setDateleave(null);
         } else {
             $object->setDateleave(new DateTime($form->getValue('dateleave')));
         }
     }
     return true;
 }
 public function isUniqueMonitorIndex($i)
 {
     $this->__load();
     return parent::isUniqueMonitorIndex($i);
 }
Exemplo n.º 4
0
 /**
  * Creates a unique Stripe payer reference ID which will be replaced after adding it to Stripe system
  *
  * All payers that we create must be identifiable by us with a unique ID. For this we
  * use the integer primary key from the \Etnities\Customer object.
  *
  * Later this ID can be used in RealEFT transactions for recurring payments, etc.
  *
  * @param \Entities\Customer $customer The instance of the payer's \Entities\Customer object
  * @return string The unique payer ID
  */
 public static function createPayerRef($customer)
 {
     if (!$customer instanceof \Entities\Customer) {
         throw new OSS_PaymentProcessor_Realex_Exception(OSS_PaymentProcessor_Realex_Exception::ERR_BAD_OBJECT_FOR_REF);
     }
     // maximum 50 characters
     return 'P_' . $customer->getId();
 }
Exemplo n.º 5
0
/**
 * Creates or updates customer notes from given member array by type.
 *
 * @param string             $title   Note title
 * @param string             $contemt Note content
 * @param \Entities\Customer $cust    Customer to update or create notes
 * @param object             $em      Doctrine entity manager.
 * @return void
 */
function createUpdateNote($title, $content, $cust, $em)
{
    $cnote = false;
    if ($cust->getNotes()) {
        foreach ($cust->getNotes() as $tnote) {
            if ($tnote->getTitle() == $title) {
                $cnote = $tnote;
                break;
            }
        }
    }
    if (!$cnote) {
        $cnote = new \Entities\CustomerNote();
        $em->persist($cnote);
        $cnote->setCustomer($cust);
        $cust->addNote($cnote);
        $cnote->setTitle($title);
        $cnote->setPrivate(1);
        $cnote->setCreated(new \DateTime());
    }
    $cnote->setUpdated(new \DateTime());
    $cnote->setNote($content);
}