Giter VIP home page Giter VIP logo

yii2-audittrail's People

Contributors

alaevka avatar astepanov avatar circulon avatar fernandezekiel avatar p-geri avatar reuhtte avatar sammaye avatar sokollondon avatar tsanchev avatar uldisn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-audittrail's Issues

How can we fetch value of a audit trailed attribute on a given date

How can we get the value of an audit trailed attribute on particular date? For example say there is a attribute Status in a model which undergone below changes

01/01/2015 - Open
05/02/2015 - In Progress
07/04/2015 - Waiting
04/07/2015 - Closed

Similary status on other records also got changed on different dates.

Now say I want to generate a report of all the records of this model with status as on 01/04/2015. How can I achieve that?

I propose to add another column in audit trail which stores the end time stamp of that audit trail record (say endTimeStamp). So on any update we have to first search if any previous audit trail record exists for same attribute and same model and model id. If yes we have to stamp the endTimeStamp with the time stamp of new audit trail record. Now we can identify the value of status attribute of model on any date by checking timestamp <= '01/04/2015' and (endTimeStamp > '01/04/2015' or endTimeStamp is null).

Class does not exist

I have added the requierd line to composer.json. run composer update. In my class i have placed

public function behaviors() { return [ 'sammaye\audittrail\LoggableBehaviour' /_'LoggableBehavior'=> array( 'class' => 'sammaye\audittrail\LoggableBehaviour'//'site.vendor.sammaye.audittrail.LoggableBehavior', )_/ ]; }

I get the following error

Class sammaye\audittrail\LoggableBehaviour does not exist

implement with RBAC

Hi how to implement this extension on RBAC ? i want log each change like auth_item, auth_assigment, auth_item_child, but i confuse where i put sammaye\audittrail\LoggableBehavior. FYI i use Yii::$app->authManager for CRUD. Thanks

how to roll back

hi whether this extension possible to rollback old value?.. thanks

Migrations do not work on Postgresql

Migrations do not work on Postgresql. Migration class m161004_132206_change_action_field

*** applying m161004_132206_change_action_field
    > alter column action in table tbl_audit_trail to ENUM('CHANGE', 'CREATE', 'DELETE', 'SET') NOT NULL ...Exception 'yii\db\Exception' with message 'SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "NOT"
LINE 1: ...ion" TYPE ENUM('CHANGE', 'CREATE', 'DELETE', 'SET') NOT NULL
                                                               ^
The SQL being executed was: ALTER TABLE "tbl_audit_trail" ALTER COLUMN "action" TYPE ENUM('CHANGE', 'CREATE', 'DELETE', 'SET') NOT NULL'

Handling related data

What is the best way to use this plugin when some of the changed fields are related data. Currently the values are the id's of the related fields and when I display them, it of course displays the id's. What would be the best way to store what the related field's data is?

Array to String Conversion Error on array_diff() of new and old attributes

Upon saving an active record, I get a yii\base\ErrorException of Array to string conversion

Stack trace
in /var/www/html/leadworks/protected/vendor/sammaye/yii2-audittrail/LoggableBehavior.php line 101

            foreach ($oldattributes as $f => $v) {
                if (array_search($f, $ignoredFields) !== false)
                    unset($oldattributes[$f]);
            }
        }
 
        // If no difference then WHY?
        // There is some kind of problem here that means "0" and 1 do not diff for array_diff so beware: stackoverflow.com/questions/12004231/php-array-diff-weirdness :S
        if (count(array_diff_assoc($newattributes, $oldattributes)) <= 0)
            return;
 
        // If this is a new record lets add a CREATE notification
        if ($insert) {
            $this->leaveTrail(self::ACTION_CREATE);
        }
 
        // Now lets actually write the attributes
        $this->auditAttributes($insert, $newattributes, $oldattributes);

In Yii2, JSON fields are converted to arrays:
image

This needs to be accounted for in some way.

transaction support for audittrail

How it will work with transaction process where multiple model will be responsible for changes.

Now if i wanted to log this in one entity then how can i do it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.