Forum Replies Created

  • Danko
    Participant
      # 1 year, 9 months ago

      Hi,

      I solved the issue.
      I find in Entities, regarding the field I have the issue on, this code:

      /**
      * Required to proper parse date provided in user date format
      * @param $value
      */
      public function setclosingDateAttribute($value)
      {
      $parsed = Carbon::parse($value);

      $this->attributes[‘closing_date’] = $parsed;
      }

      I got rid of the Carbon thing, setting $parsed to $value and I got what I wanted πŸ™‚

      Do you think this would be correct ?

      Thank you for your help

      Daniele.

      Danko
      Participant
        # 1 year, 9 months ago

        Hi,

        I am reopening this issue because I have not solved it so far.
        the mechanism I wrote about, in Platform/Core directory, was correct. In that way I can modify a form field during the save phase.

        But, this issue was originally different.

        What I mean exactly is that when I click a dateType field in a form, a calendar open (and it’s correct) and the current date appear into the field.
        I don’t want the current date to appear into the field.

        How can I prevent that ?

        Thank you and have a nice new year πŸ™‚

        Daniele.

        Danko
        Participant
          # 2 years, 3 months ago

          Thank you, that’s perfect πŸ™‚

          in reply to: Deleted Users
          Danko
          Participant
            # 2 years, 3 months ago

            Hi,

            actually I found that in this file
            Modules/Platform/Core/Repositories/PlatformRepository.php,
            in both update and create Entity, there were this mechanism.

            I think this was the instruction:
            $entity->setAttribute($field, $value);
            This is within a foreach, working all the entity attributes.

            Since I cannot find setAttributes function I UNSET the attributes I don’t want to be forcibly set (only if they are null in the first instance):

            I also add this code:

            I needed to have created_at and updated_at in the user timezone.

            Thank you.

            Danko
            Participant
              # 2 years, 5 months ago

              I just found where you do manage to increase notifications number in the UI. In the modulecrudontroller.php .

              I did some modifications, included my function to send notifications along with emails πŸ™‚

              Thanks for your help.

              Daniele

              Danko
              Participant
                # 2 years, 5 months ago

                Thank you very much πŸ™‚

                I did it.

                Daniele

                Danko
                Participant
                  # 2 years, 5 months ago

                  I’m using multicrm.
                  I will check with the last release. Thank you very much.

                  D.

                  Danko
                  Participant
                    # 2 years, 5 months ago

                    Hi,

                    yes that’s exactly that. Thanks a lot πŸ™‚

                    Daniele.

                    in reply to: Multiple select2
                    Danko
                    Participant
                      # 2 years, 5 months ago

                      Hi,

                      I just shared the code via email. I hope it will help.

                      I have another question:
                      When I assign a document to a user, I can see a notification number increase in that user dashboard interface. Where you managed to do this?

                      Danko
                      Participant
                        # 2 years, 5 months ago

                        Thank you very much,

                        I managed to integrate mail notification with a separate function in the notification module and it’s working like a charm πŸ™‚

                        Danko
                        Participant
                          # 2 years, 5 months ago

                          Unfortunately there is a secrecy obligation on this project, I’m not free to expose it but I will ask for it. Thank you very much.

                          In the mean time I’ll ask you this:
                          in BAP where exactly is the source code that do the savings when I submit a form?
                          In a simple, common module like contacts: I create a new contact and a form appear to me.
                          What I need to know right now, is the flow. Who call what and when when I open a form to save a new contact; who call what and when when I open the page that make me see the list of the contact I saved earlier.

                          Thanks for your help.

                          in reply to: Multiple select2
                          Danko
                          Participant
                            # 2 years, 5 months ago

                            Ok, I’m going crazy.. πŸ˜€

                            Serializing the array is indeed correct, actually I don’t know where to put the function to convert the array.
                            But:
                            What I basically need is an input in my form, to select multiple choices and save those choices – the view has to be capable of interpreting the saved data and convert ‘user-2’ to ‘John Smith’.

                            So far I managed to select multiple choices taking the data from users and groups table:
                            ‘choices’ => FormHelper::downByChoises()
                            ___
                            public static function downByChoises()
                            {

                            if(!empty(Landlord::getTenants()->first())){
                            $users = User::where(‘company_id’,’=’,Landlord::getTenants()->first())->get();
                            $groups = Group::where(‘company_id’,’=’,Landlord::getTenants()->first())->get();
                            }else{
                            $users = User::all();
                            $groups = Group::all();
                            }

                            $options = [
                            trans(‘core::core.form.optgroup.users’) => $users->mapWithKeys(function ($item) {
                            return [‘user-‘ . $item[‘id’] => $item[‘name’]];
                            })->toArray(),
                            trans(‘core::core.form.optgroup.groups’) => $groups->mapWithKeys(function ($item) {
                            return [‘group-‘ . $item[‘id’] => $item[‘name’]];
                            })->toArray(),
                            ];

                            return $options;
                            }

                            I’m not sure in the controller how to configure this:
                            protected $showFields = [
                            ‘down_by’ => [‘type’ => ‘manyToMany’, ‘column’ => ‘name’, ‘relation’ => [‘users’,’groups’], ‘col-class’ => ‘col-lg-4’],
                            ‘notify_by’ => [‘type’ => ‘manyToMany’, ‘column’ => ‘name’, ‘relation’ => [‘users’,’groups’], ‘col-class’ => ‘col-lg-4’]
                            ]

                            I’m not sure what type to use.
                            oneToMany, manyToMany, manyToOne are giving me errors related to relations.

                            The thing is: these two fields have to save users name and group name.
                            Do I need a specific relation? Or it is sufficient a text type? With a json saved into ?

                            Thanks,

                            have a nice day.

                            in reply to: Multiple select2
                            Danko
                            Participant
                              # 2 years, 5 months ago

                              Hi again,

                              I managed to replace my text input with a multiple choice and it’s working:

                              Now I have this issue:
                              Illuminate \ Database \ QueryException
                              Array to string conversion (SQL: update secdocuments set updated_at = 2019-04-30 13:54:50, down_by = user-2, notify_by = user-2, closing_date = 2019-04-25 00:00:00 where id = 2)

                              The fields I’m trying to update are: down_by and notify_by .
                              But it isn’t saving the entire array into the database field. I was expecting that it would work as the database field is a varchar.

                              Thanks for your help.

                              in reply to: Multiple select2
                              Danko
                              Participant
                                # 2 years, 6 months ago

                                Thank you. It works properly

                                Danko
                                Participant
                                  # 2 years, 6 months ago

                                  Hi, thanks …
                                  I have tried and works in the form (selectbox value) but in the view it does not translate. Also how do I add the translation of other modules and not just the translation there ‘Contacts’?
                                  Below the file Modules/Platform/Core/Resources/views/components/types/manyToOne.blade.php
                                  Did I have something here?

                                  @if($entity->$fieldName != null )
                                  @if(isset($options[‘dont_translate’]))
                                  {{
                                  $entity->{$options[‘relation’]}->{$options[‘column’]}
                                  }}
                                  @else
                                  {{
                                  $entity->{$options[‘relation’]}->{$options[‘column’]}
                                  }}
                                  @endif
                                  @endif
                                  trans(‘contacts::contacts.dict.’.$item);

                                Viewing 15 posts - 1 through 15 (of 18 total)