"Fossies" - the Fresh Open Source Software Archive

Member "tine20-2019.12.4/tine20/Phone/Setup/Update/12.php" (16 Jan 2020, 2765 Bytes) of package /linux/www/tine20-2019.12.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "12.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 /**
    4  * Tine 2.0
    5  *
    6  * @package     Phone
    7  * @subpackage  Setup
    8  * @license     http://www.gnu.org/licenses/agpl.html AGPL3
    9  * @copyright   Copyright (c) 2019 Metaways Infosystems GmbH (http://www.metaways.de)
   10  * @author      Paul Mehrer <p.mehrer@metaways.de>
   11  */
   12 class Phone_Setup_Update_12 extends Setup_Update_Abstract
   13 {
   14     const RELEASE012_UPDATE001 = __CLASS__ . '::update001';
   15     const RELEASE012_UPDATE002 = __CLASS__ . '::update002';
   16     const RELEASE012_UPDATE003 = __CLASS__ . '::update003';
   17 
   18     static protected $_allUpdates = [
   19         self::PRIO_NORMAL_APP_STRUCTURE     => [
   20             self::RELEASE012_UPDATE001          => [
   21                 self::CLASS_CONST                   => self::class,
   22                 self::FUNCTION_CONST                => 'update001',
   23             ],
   24         ],
   25 
   26         self::PRIO_NORMAL_APP_UPDATE        => [
   27             self::RELEASE012_UPDATE002          => [
   28                 self::CLASS_CONST                   => self::class,
   29                 self::FUNCTION_CONST                => 'update002',
   30             ],
   31             self::RELEASE012_UPDATE003          => [
   32                 self::CLASS_CONST                   => self::class,
   33                 self::FUNCTION_CONST                => 'update003',
   34             ],
   35         ],
   36     ];
   37 
   38     public function update001()
   39     {
   40         if (!$this->_backend->columnExists('resolved_destination', 'phone_callhistory')) {
   41             $this->_backend->addCol('phone_callhistory', new Setup_Backend_Schema_Field_Xml('<field>
   42                     <name>resolved_destination</name>
   43                     <type>text</type>
   44                     <length>64</length>
   45                 </field>'));
   46         }
   47         if ($this->getTableVersion('phone_callhistory') < 4) {
   48             $this->setTableVersion('phone_callhistory', 4);
   49         }
   50         $this->addApplicationUpdate('Phone', '12.1', self::RELEASE012_UPDATE001);
   51     }
   52 
   53     public function update002()
   54     {
   55         // needs to be reexecuted, so moved to update003
   56         $this->addApplicationUpdate('Phone', '12.2', self::RELEASE012_UPDATE002);
   57     }
   58 
   59     public function update003()
   60     {
   61         $call = Phone_Controller_Call::getInstance();
   62         $result = $this->_db->select()->from(SQL_TABLE_PREFIX . 'phone_callhistory', ['id', 'destination'])
   63             ->query(Zend_Db::FETCH_NUM);
   64         foreach ($result->fetchAll() as $row) {
   65             $this->_db->update(SQL_TABLE_PREFIX . 'phone_callhistory', [
   66                 'resolved_destination' =>
   67                     Addressbook_Model_Contact::normalizeTelephoneNum($call->resolveInternalNumber($row[1]))
   68             ], 'id = ' . $this->_db->quote($row[0]));
   69         }
   70 
   71         $this->addApplicationUpdate('Phone', '12.3', self::RELEASE012_UPDATE003);
   72     }
   73 }