Esempio n. 1
0
 public function setDatePiece()
 {
     static $date = null;
     //_ If day(now) >= 1 and < 25 .... Date Pièce = 01/ Month(Now) / Year(Now)
     //_ If day(now) >= 25   Date Pièce = 01/Month(Now) + 1 / Year(Now) ( If Month(Now + 1 = 13 ... Put Month = 1 and Year = Year + 1
     if (!$this->_object->getDatePiece()) {
         if (date('d') >= 1 && date('d') < 25) {
             $ts = date('Y-m') . '-01';
         } else {
             if (date('d') >= 25) {
                 $ts = 'now +1 month';
             }
         }
         if (is_null($date)) {
             $date = new \DateTime($ts);
         }
         $this->_object->setDatePiece($date);
     }
     return $this;
 }