Changeset 2556 for trunk


Ignore:
Timestamp:
01/31/10 01:24:59 (2 years ago)
Author:
nuxwin
Message:
  • GUI:
    • Fixed #2152: Wrong limited count in reseller gui
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/CHANGELOG

    r2553 r2556  
    11ispCP ω 1.0.4 Changelog 
    22~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     3 
     42010-01-31 Sascha Bay 
     5        - GUI: 
     6                * Fixed #2152: Wrong limited count in reseller gui 
    37 
    482010-01-27 Marc Pujol 
  • trunk/gui/admin/reseller_edit.php

    r2533 r2556  
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    66 * @copyright   2006-2010 by ispCP | http://isp-control.net 
    7  * @version     SVN: $ID$ 
     7 * @version     SVN: $Id$ 
    88 * @link                http://isp-control.net 
    99 * @author              ispCP Team 
     
    348348        if ($unlimited == '_off_') { 
    349349                // We have something like that: $u <= ($umax = $r) <= $rmax 
    350                 if ($r != $u && $r > 0) { // ... && $u != unlimited 
     350                //if ($r != $u && $r > 0) { // ... && $u != unlimited 
     351                if ($r != $umax && $r > 0) { // We have to check the res current against the sum of all users max - TheCry 
    351352                        $err    = tr('Reseller data inconsistency!').' '.$service; //really? 
    352353                        $err    .= tr("! Trying to correct!"); 
  • trunk/gui/include/admin-functions.php

    r2520 r2556  
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    66 * @copyright   2006-2010 by ispCP | http://isp-control.net 
    7  * @version     SVN: $ID$ 
     7 * @version     SVN: $Id$ 
    88 * @link                http://isp-control.net 
    99 * @author              ispCP Team 
     
    10081008                AND `mail_acc` != 'postmaster' 
    10091009                AND `mail_acc` != 'webmaster' 
    1010                 AND `domain_id` 
    1011                 AND `mail_type` NOT RLIKE '_catchall'"; 
     1010                AND `mail_type` NOT RLIKE '_catchall' 
     1011                AND `domain_id`"; 
    10121012                $mail_current = records_count( 'mail_users', $where, $user_id); 
    10131013        } 
  • trunk/gui/include/reseller-functions.php

    r2530 r2556  
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    66 * @copyright   2006-2010 by ispCP | http://isp-control.net 
    7  * @version     SVN: $ID$ 
     7 * @version     SVN: $Id$ 
    88 * @link                http://isp-control.net 
    99 * @author              ispCP Team 
     
    568568                AND `mail_acc` != 'postmaster' 
    569569                AND `mail_acc` != 'webmaster' 
    570                 AND `domain_id` 
    571                 AND `mail_type` NOT RLIKE '_catchall'"; 
     570                AND `mail_type` NOT RLIKE '_catchall' 
     571                AND `domain_id`"; 
    572572                $mail_current = records_count('mail_users', $where, $user_id); 
    573573        } 
     
    17271727/** 
    17281728 * Get count from table by given domain_id's 
     1729 *  
    17291730 * @param $tablename string database table name 
    17301731 * @param $ua array domain_ids 
    1731  * @return integer count 
     1732 * @return int count 
    17321733 */ 
    17331734function get_reseller_detail_count($tablename, $ua) { 
     
    17611762/** 
    17621763 * Recalculate current_ properties of reseller 
    1763  * @param $reseller_id integer ID of the reseller 
     1764 * 
     1765 * @param int $reseller_id unique reseller identifiant 
    17641766 * @return array list of properties 
    17651767 */ 
    17661768function recalc_reseller_c_props($reseller_id) { 
     1769 
    17671770        global $sql; 
    1768  
     1771  
    17691772        // current_dmn_cnt = domain 
    17701773        // current_sub_cnt = subdomain 
     
    17741777        // current_sql_db_cnt = sql_database 
    17751778        // current_sql_user_cnt = sql_user 
    1776  
     1779        // current_disk_amnt = disk_space 
     1780        // current_traff_amnt = traffic 
     1781  
    17771782        $delstatus = Config::get('ITEM_DELETE_STATUS'); 
    1778  
     1783  
    17791784        // Get all users of reseller: 
    17801785        $query = " 
    17811786                SELECT 
    1782                         `domain_id`, 
    1783                         `domain_uid` 
     1787                        COUNT(`domain_id`) AS crn_domains, 
     1788                        IFNULL(SUM(`domain_subd_limit`), 0) AS current_sub_cnt, 
     1789                        IFNULL(SUM(`domain_alias_limit`), 0) AS current_als_cnt, 
     1790                        IFNULL(SUM(`domain_mailacc_limit`), 0) AS current_mail_cnt, 
     1791                        IFNULL(SUM(`domain_ftpacc_limit`), 0) AS current_ftp_cnt, 
     1792                        IFNULL(SUM(`domain_sqld_limit`), 0) AS current_sql_db_cnt, 
     1793                        IFNULL(SUM(`domain_sqlu_limit`), 0) AS current_sql_user_cnt, 
     1794                        IFNULL(SUM(`domain_disk_limit`), 0) AS current_disk_amnt, 
     1795                        IFNULL(SUM(`domain_traffic_limit`), 0) AS current_traff_amnt 
    17841796                FROM 
    17851797                        `domain` 
     
    17901802        "; 
    17911803        $res = exec_query($sql, $query, array($reseller_id, $delstatus)); 
    1792         $user_array = $systemuser_array = array(); 
    1793         while ($data = $res->FetchRow()) { 
    1794                 $user_array[] = $data['domain_id']; 
    1795                 $systemuser_array[] = $data['domain_uid']; 
    1796         } 
    1797         $current_dmn_cnt = count($user_array); 
     1804  
     1805        $current_dmn_cnt = $res -> fields['crn_domains']; 
     1806 
    17981807        if ($current_dmn_cnt > 0) { 
    1799                 $current_sub_cnt = get_reseller_detail_count('subdomain', $user_array); 
    1800                 $current_als_cnt = get_reseller_detail_count('domain_aliasses', $user_array); 
    1801                 $current_mail_cnt = get_reseller_detail_count('mail_users', $user_array); 
    1802                 $current_ftp_cnt = get_reseller_detail_count('ftp_users', $systemuser_array); 
    1803                 $current_sql_db_cnt = get_reseller_detail_count('sql_database', $user_array); 
    1804  
    1805                 $query = "SELECT COUNT(*) AS cnt FROM `sql_user`"; 
    1806                 $query .= " WHERE `sqld_id` IN ("; 
    1807                 $query .= "SELECT sqld_id FROM sql_database"; 
    1808                 $query .= " WHERE `domain_id` IN (".implode(',', $user_array)."))"; 
    1809                 $res = exec_query($sql, $query); 
    1810                 $current_sql_user_cnt = $res->fields['cnt']; 
     1808                $current_sub_cnt = $res -> fields['current_sub_cnt']; 
     1809                $current_als_cnt = $res -> fields['current_als_cnt']; 
     1810                $current_mail_cnt = $res -> fields['current_mail_cnt']; 
     1811                $current_ftp_cnt = $res -> fields['current_ftp_cnt']; 
     1812                $current_sql_db_cnt = $res->fields['current_sql_db_cnt']; 
     1813                $current_sql_user_cnt = $res->fields['current_sql_user_cnt']; 
     1814                $current_disk_amnt  = $res->fields['current_disk_amnt']; 
     1815                $current_traff_amnt = $res->fields['current_traff_amnt']; 
    18111816        } else { 
    1812                 $current_sub_cnt = 
    1813                 $current_als_cnt = 
    1814                 $current_mail_cnt = 
    1815                 $current_ftp_cnt = 
    1816                 $current_sql_db_cnt = 
     1817                $current_sub_cnt = 0; 
     1818                $current_als_cnt = 0; 
     1819                $current_mail_cnt = 0; 
     1820                $current_ftp_cnt = 0; 
     1821                $current_sql_db_cnt = 0; 
    18171822                $current_sql_user_cnt = 0; 
    1818         } 
    1819  
    1820         return array($current_dmn_cnt, $current_sub_cnt, $current_als_cnt, 
    1821                                 $current_mail_cnt, $current_ftp_cnt, $current_sql_db_cnt, 
    1822                                 $current_sql_user_cnt); 
     1823                $current_disk_amnt  = 0; 
     1824                $current_traff_amnt = 0; 
     1825        } 
     1826  
     1827        return array( 
     1828                $current_dmn_cnt, 
     1829                $current_sub_cnt, 
     1830                $current_als_cnt, 
     1831                $current_mail_cnt, 
     1832                $current_ftp_cnt, 
     1833                $current_sql_db_cnt, 
     1834                $current_sql_user_cnt, 
     1835                $current_disk_amnt, 
     1836                $current_traff_amnt 
     1837        ); 
    18231838} 
    18241839 
    18251840/** 
    18261841 * Recalculate current_ properties of reseller 
    1827  * @param $reseller_id integer ID of the reseller 
     1842 *  
     1843 * @param int $reseller_id unique reseller identifiant 
     1844 * @return void 
    18281845 */ 
    18291846function update_reseller_c_props($reseller_id) { 
    18301847        global $sql; 
    1831  
     1848  
    18321849        $query = " 
    18331850                UPDATE 
     
    18401857                        `current_ftp_cnt` = ?, 
    18411858                        `current_sql_db_cnt` = ?, 
    1842                         `current_sql_user_cnt` = ? 
     1859                        `current_sql_user_cnt` = ?, 
     1860                        `current_disk_amnt` = ?, 
     1861                        `current_traff_amnt` = ? 
    18431862                WHERE 
    18441863                        `reseller_id` = ? 
    18451864        "; 
    1846  
     1865  
    18471866 
    18481867        $props = recalc_reseller_c_props($reseller_id); 
    18491868        $props[] = $reseller_id; 
    1850  
     1869  
    18511870        exec_query($sql, $query, $props); 
    18521871} 
     
    18551874 * Get the reseller id of a domain 
    18561875 * moved from admin/domain_edit.php to reseller-functions.php 
    1857  * @param $domain_id integer ID of domain 
    1858  * @return integer ID of reseller or 0 in case of error 
     1876 *  
     1877 * @param int $domain_id unique domain identifiant 
     1878 * @return int unique reseller identifiant or 0 in on error 
    18591879 */ 
    18601880function get_reseller_id($domain_id) { 
     1881 
    18611882        $sql = Database::getInstance(); 
    18621883 
     
    18851906 * Checks if a reseller has the right to add domain aliases 
    18861907 *  
    1887  * @param int $reseller_id 
     1908 * @param int $reseller_id unique reseller identifiant 
    18881909 * @return boolean domain alias permissions   
    18891910 */ 
    18901911function check_reseller_domainalias_permissions($reseller_id) { 
     1912 
    18911913        $sql = Database::getInstance(); 
    18921914         
  • trunk/gui/reseller/domain_edit.php

    r2536 r2556  
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    66 * @copyright   2006-2010 by ispCP | http://isp-control.net 
    7  * @version     SVN: $ID$ 
     7 * @version     SVN: $Id$ 
    88 * @link                http://isp-control.net 
    99 * @author              ispCP Team 
     
    555555 
    556556function calculate_user_dvals($data, $u, &$umax, &$r, $rmax, &$err, $obj) { 
    557         if ($rmax == 0 && $umax == -1) { 
     557        if ($rmax == -1 && $umax >= 0) { 
     558                if ($u > 0) { 
     559                        $err .= tr('The <em>%s</em> service cannot be disabled!', $obj) . tr('There are <em>%s</em> records on system!', $obj); 
     560                        return; 
     561                } else if ($data != -1){ 
     562                        $err .= tr('The <em>%s</em> have to be disabled!', $obj) . tr('The admin has <em>%s</em> disabled on this system!', $obj); 
     563                        return; 
     564                } else { 
     565                        $umax = $data; 
     566                } 
     567                return; 
     568        } else if ($rmax == 0 && $umax == -1) { 
    558569                if ($data == -1) { 
    559570                        return; 
  • trunk/gui/reseller/orders_update.php

    r2505 r2556  
    55 * @copyright   2001-2006 by moleSoftware GmbH 
    66 * @copyright   2006-2010 by ispCP | http://isp-control.net 
    7  * @version     SVN: $ID$ 
     7 * @version     SVN: $Id$ 
    88 * @link                http://isp-control.net 
    99 * @author              ispCP Team 
     
    256256 
    257257function calculate_user_dvals($data, $u, &$umax, &$r, $rmax, &$err, $obj) { 
    258         if ($rmax == 0 && $umax == -1) { 
     258        if ($rmax == -1 && $umax >= 0) { 
     259                if ($u > 0) { 
     260                        $err .= tr('The <em>%s</em> service cannot be disabled!', $obj) . tr('There are <em>%s</em> records on system!', $obj); 
     261                        return; 
     262                } else if ($data != -1){ 
     263                        $err .= tr('The <em>%s</em> have to be disabled!', $obj) . tr('The admin has <em>%s</em> disabled on this system!', $obj); 
     264                        return; 
     265                } else { 
     266                        $umax = $data; 
     267                } 
     268                return; 
     269        } else if ($rmax == 0 && $umax == -1) { 
    259270                if ($data == -1) { 
    260271                        return; 
Note: See TracChangeset for help on using the changeset viewer.