Limiting the date selection

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • esforim
    commented on 's reply
    Tried to Like my own post to like you but it won't let me.

  • eymen-elkum
    commented on 's reply
    I think yes they are the fields names,
    belgeTarihi = Document Date
    Kayittarihi = Record Date
    Translated from Turkish, hope I translated correctly

  • esforim
    replied
    belgeTarihi and kayittarihi is the field name right?

    Leave a comment:


  • esforim
    commented on 's reply
    Not simple at all! I wouldn't figure this without your post. Thank you.

  • telecastg
    commented on 's reply
    Thanks for sharing !

  • serqet
    replied
    Hi,
    I used a pretty simple method

    I first created the application / Espo / Hooks / Volvox / datecontrol.php file.

    Then I simply used the code below. and worked

    PHP Code:
    <?php
    
    namespace Espo\Hooks\Volvox;
    
    use Espo\ORM\Entity;
    use \Espo\Core\Exceptions\Error;
    
    class datecontrol extends \Espo\Core\Hooks\Base
    {
    public function beforeSave(Entity $entity, array $options = array())
    {
    
    if ($entity->isNew()) {
    $belgetarihi=$entity->get('belgeTarihi');
    $kayittarihi=$entity->get('kayittarihi');
    $monthb = date("m",strtotime($belgetarihi));
    $monthk = date("m",strtotime($kayittarihi));
    
    if($monthb!=$monthk) {
    throw new \Exception("wrong month!");
    
    
    }
    }
    }
    }

    Leave a comment:


  • esforim
    replied
    Please share the solution if it possible. Thank you.

    Leave a comment:


  • serqet
    replied
    I solved this problem using Hooks myself.

    Leave a comment:


  • serqet
    started a topic Limiting the date selection

    Limiting the date selection

    Hello there,
    I want to choose a day for the date field only in the month we are in. Is this possible? It will give an error when choosing next or past month ...
Working...