Code Duplication    Length = 11-14 lines in 3 locations

src/dbo/records.php 3 locations

@@ 2759-2769 (lines=11) @@
2756
 * @param int $permissions User permissions (see also {@link record_get_permissions}).
2757
 * @return bool TRUE if record can be postponed, FALSE otherwise.
2758
 */
2759
function can_record_be_postponed ($record, $permissions)
2760
{
2761
    debug_write_log(DEBUG_TRACE, '[can_record_be_postponed]');
2762
2763
    return (get_user_level() != USER_LEVEL_GUEST &&
2764
            !$record['is_suspended']             &&
2765
            !$record['is_locked']                &&
2766
            !is_record_postponed($record)        &&
2767
            is_null($record['closure_time'])     &&
2768
            ($permissions & PERMIT_POSTPONE_RECORD));
2769
}
2770
2771
/**
2772
 * Checks whether specified permissions allow to resume specified record.
@@ 2797-2808 (lines=12) @@
2794
 * @param int $permissions User permissions (see also {@link record_get_permissions}).
2795
 * @return bool TRUE if record can be reassigned, FALSE otherwise.
2796
 */
2797
function can_record_be_reassigned ($record, $permissions)
2798
{
2799
    debug_write_log(DEBUG_TRACE, '[can_record_be_reassigned]');
2800
2801
    return (get_user_level() != USER_LEVEL_GUEST &&
2802
            !$record['is_suspended']             &&
2803
            !$record['is_locked']                &&
2804
            !is_record_postponed($record)        &&
2805
            is_null($record['closure_time'])     &&
2806
            !is_null($record['responsible_id'])  &&
2807
            ($permissions & PERMIT_REASSIGN_RECORD));
2808
}
2809
2810
/**
2811
 * Checks whether specified permissions allow to reopen specified record.
@@ 2934-2947 (lines=14) @@
2931
 * @param int $permissions User permissions (see also {@link record_get_permissions}).
2932
 * @return bool TRUE if subrecord can be removed, FALSE otherwise.
2933
 */
2934
function can_subrecord_be_removed ($record, $permissions)
2935
{
2936
    debug_write_log(DEBUG_TRACE, '[can_subrecord_be_removed]');
2937
2938
    $rs = dal_query('depends/list.sql', $record['record_id']);
2939
2940
    return (get_user_level() != USER_LEVEL_GUEST      &&
2941
            !$record['is_suspended']                  &&
2942
            !$record['is_locked']                     &&
2943
            !is_record_postponed($record)             &&
2944
            !is_record_frozen($record)                &&
2945
            ($permissions & PERMIT_REMOVE_SUBRECORDS) &&
2946
            ($rs->rows != 0));
2947
}
2948
2949
/**
2950
 * Update specified {@link FIELD_TYPE_STRING string} or {@link FIELD_TYPE_MULTILINED multilined} value.