Jump to content

MarkE

Members
  • Posts

    921
  • Joined

  • Last visited

  • Days Won

    10

Posts posted by MarkE

  1. 7 hours ago, Vineet Sawant said:

    It'd be very kind of you can explain how you managed to customise the admin panel as per your requirements.

    Process modules as per @bernhard’s post are the main tool. If you don’t feel confident with that (and do have a try, it’s not that hard) then I suggest you avoid a custom solution. 

     

    7 hours ago, Vineet Sawant said:

    Also how did you manage to add Ajax to it? I'd love to know.

    I really like HTMX for that. There are quite a few forum posts about it. 

    • Like 1
  2. 2 minutes ago, dotnetic said:

    You can also build the whole application in the admin

    I’ve done several quite complex apps like that. Not quite the same as your requirements, though. Lots of complex calculations and relationships. A clear spec and entity model are absolute musts. 

    But as @dotneticsays

    5 minutes ago, dotnetic said:

    It depends, if the forms should be customer facing (to the public) or are they just for your client?

    If it’s just for the client then the admin is fine. However a key issue is whether there are likely to be concurrent users. If there are only a very small number of users then you can use ProDevTools to handle edit collisions. Otherwise it’s a whole lot more complex and you may be better buying an accounting package. 

    • Like 1
  3. On 5/27/2023 at 3:22 PM, ryan said:

    I'm not sure it's necessary to support these other than mapping expireNever to a future date, as I think very few actually use these features. 

    I've not been following this very closely, but this statement caught my eye and caused me to worry. Are you saying that (for example) the selector string option for $cache->save (as per https://processwire.com/api/ref/wire-cache/save/) will no longer be supported? That would be a big problem for me as one of my web apps uses it extensively. The app provides a spreadsheet-like user interface but only updates data if precedent data has been changed (otherwise every 'cell' gets recalculated on every page view which would be a huge delay). Maybe I misunderstand, but I would be grateful for clarification.

  4. 15 hours ago, ryan said:

    I imagine this has happened to others and perhaps they weren't so lucky as to recover the unsaved changes. So how can you avoid this issue?

    I’ve found that the most irritating situation is when the editor leaves a page open, then comes back to it some time later and makes a big edit only to find it won’t save because they’ve been signed out. The UserActivity module fixes this nicely, but it would be better if it was fixed in the core. Just a simple message to say you’ve been signed out would help. 

    • Like 3
  5. Just now, adrian said:

    I really do think migration to use imap_open as per my above post would be a better option given the status of the flourish library.

    You are almost certainly right. I needed a quick fix! I'm using POP3 at the moment. I'll try your suggestion when I have a bit more time. Ta.

  6. 1 hour ago, MarkE said:

    Meanwhile I will try and diagnose.

    The problem (or, at least, on of them) is line 505 of fMailbox.php. Since php 8.0.0, providing a non-string as a needle to strpos is no longer supported. $filter has a default value of null. 

    (strpos($header, $filter) !== FALSE) evaluates to true and should be replaced. The following works in my case, but further fixes may be required if the $filter is actually set.

    if ($filter && strpos($header, $filter) !== FALSE)

     

  7. On 10/18/2022 at 9:58 PM, MarkE said:

    I use it on one site and it is quite neat, but I have yet to move that site to php8

    I've now moved that site to php 8 and the module has stopped working. Any insights would be great. Meanwhile I will try and diagnose.

  8. 22 hours ago, bernhard said:

    Do you have some code to share with us?

    Simples:

    In init.php

    wire()->addHook('LazyCron::everyDay', null, 'batchRun');

    and then in your hook:

    wire()->log->prune('debug', $days);

    where $days is set however you want

    In my case I aded a cronjob to access the site at night so that the LazyCron fires then.

    • Like 4
  9. UPDATE:

    Web service now seems to be starting OK. The problem might be to do with the docroot. config.yaml is inside site-admin/.ddev/ but index.php is of course in the root directory above site-admin. This is why I tried docroot: ../ (I have also tried ../../ as I'm not sure where the root is supposed to be relative to - .ddev or site-admin). However, if I go into ddev with ddev ssh and ls, it lists the members of site-admin, not the root.

    ddev logs shows an error of directory index of "/var/" is forbidden

  10. I have a PW project with two sites - in site-admin and site-web respectively. I have moved the project from laragon to ddev, as I have done successfully with a number of (single-site) projects. However, this one won't run - I just get a nginx 403 error.

    I suspect it is something to do with the way I have set up ddev to deal with the multi-site. Because I wanted a separate url for site-admin and site-web, I did the ddev config within the site-admin directory, rather than the parent (root) directory. I then set the docroot to ../ so that it would pick up index.php. I have set index.config.php to point the url supplied by ddev to the site-admin directory.

    ddev start works OK, but I note that ddev describe does not show a web service even though it does show the urls.

    config.yaml is in site-admin/.ddev and contains

    name: BawdHall-admin
    type: php
    docroot: ../
    php_version: "8.0"
    webserver_type: nginx-fpm
    router_http_port: "80"
    router_https_port: "443"
    xdebug_enabled: false
    additional_hostnames: []
    additional_fqdns: []
    database:
        type: mariadb
        version: "10.4"
    nfs_mount_enabled: false
    mutagen_enabled: false
    use_dns_when_possible: true
    composer_version: "2"
    web_environment: []
    nodejs_version: "16"

    ddev describe shows

    ┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │ Project: BawdHall-admin ~/projects/BawdHall/site-admin https://bawdhall-admin.ddev.site                                               │
    │ Docker provider: docker 23.0.2                                                                                                        │
    │ Router: traditional                                                                                                                   │
    ├────────────┬──────┬──────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────┤
    │ SERVICE    │ STAT │ URL/PORT                                                                                     │ INFO               │
    │            │      │                                                                                              │ NodeJS:16          │
    ├────────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────┤
    │ db         │ OK   │ InDocker: db:3306                                                                            │ mariadb:10.4       │
    │            │      │ Host: 127.0.0.1:32796                                                                        │ User/Pass: 'db/db' │
    │            │      │                                                                                              │ or 'root/root'     │
    ├────────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────┤
    │ PHPMyAdmin │ OK   │ https://bawdhall-admin.ddev.site:8037                                                        │                    │
    │            │      │ InDocker: dba:80,80                                                                          │                    │
    │            │      │ `ddev launch -p`                                                                             │                    │
    ├────────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────┤
    │ Mailhog    │      │ MailHog: https://bawdhall-admin.ddev.site:8026                                               │                    │
    │            │      │ `ddev launch -m`                                                                             │                    │
    ├────────────┼──────┼──────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────┤
    │ All URLs   │      │ https://bawdhall-admin.ddev.site, https://127.0.0.1:32797, http://bawdhall-admin.ddev.site,  │                    │
    │            │      │ http://127.0.0.1:32798                                                                       │                    │
    

    Any ideas?

  11. On 4/2/2023 at 2:13 AM, wbmnfktr said:

    It's perfectly fine within a running setup but once in a while it's not working as expected.

    Added a fix for the on-demand mirroring at the beginning of the hook:

    		//Don't execute for backups!!
    		$backtrace = DEBUG::backtrace();
    		foreach($backtrace as $item) {
    			if(strpos($item['file'], 'ProcessDatabaseBackups')) return;
    		}

     

    • Like 1
  12. Just posting this here as I raised an issue some time ago about TextformatterHannaCode module, which has not been responded to or addressed (see https://processwire.com/talk/topic/3745-hanna-code/page/18/?tab=comments#comment-217245  and https://github.com/ryancramerdesign/ProcessHannaCode/issues/26). I have also recently raised a PR (https://github.com/ryancramerdesign/ProcessHannaCode/pull/27) to fix it.

    Essentially the problem is that, if you have a PHP Hanna Code which is namespaced (ProcessWire), then the module will remove the namespace (irritating in itself), but also (and maybe more seriously) it will omit the line

    if(!defined("PROCESSWIRE")) die("no direct access");

    which is potentially a security weakness.

    The PR is a simple one-word fix.

    • Like 2
  13. A slightly odd case this:

    I have a WSL/Docker/ddev setup that has been working very well. Then, for no apparent reason, Docker Desktop failed to start the docker engine. I tried all the suggested fixes without success so decided to uninstall it and run Docker from within WSL instead. After successfully doing that, I found that the db was empty so PW would not run. I imported a recent backup database from the production site into the empty db using phpMyAdmin and it appeared to be OK. However, on running the PW site, I got a 500 error. I tried importing an old dev backup and that worked OK.

    So, now I had PW running in dev, but not with the latest database. I then tried to use the PW backup tools to download the latest version from the live site and upload it into the dev site and got the following message after clicking 'upload':

    ProcessDatabaseBackups: File could not be downloaded (https://[Database path].sql) 403 Forbidden: (tried: curl)

    Any idea what might be causing this and how to fix it? At the moment I am stuck without being able to work on a current database version and can't get it successfully imported via either phpMyAdmin or PW.

    One thing that looks rather odd is that the message says it can't be downloaded (not uploaded) and that the database path given is a path to site/assets/files on the LIVE site.

    EDIT: Also, I see that the uploaded backup IS listed on the backups page. However, restoring it results in errors*. All a bit random and confusing!

    * The error appear to be because not all modules are loaded. Commenting out the calls and refreshing the modules seems to fix this.

  14. @ryan - this still seems to be open. I assume the intention is not to add the namespace if it isn't in the hanna PHP code, otherwise it should be added and so should the 'die'.
    I think, in that case, the fix is simple - replace the line
    `$code = str_replace($openPHP, "$openPHP\n$firstLine\n", $code);`
    by
    `$code = str_replace($php, "$openPHP\n$firstLine\n", $code);`

    The existing line does not work because, if namespace was in the code it has been removed, but $opnPHP includes it, so the str_replace does not operate.
    I have created a PR for this

    -----------------

    If you do not have namespace declarations in your hanna code php and need them, then the following executed in Tracy console seems to do the trick:

    $h = $modules->get('TextformatterHannaCode');
    $codes = $h->hannaCodes();
    $codesAll = $codes->getAll();
    foreach($codesAll as $code) {
        $codeString = $code->code;
        if(!strpos($codeString, 'namespace')) {
            $codeString = str_replace('?php', '?php namespace ProcessWire;', $codeString);
        }
        $code->code = $codeString;
        $codes->save($code);
    }

     

  15. 10 hours ago, Ivan Gretsky said:

    You can delete orders without deleting connected payments and fulfillments records if you need,

    Another reason for doing some deep thinking about the entity model before choosing. If payments can only ever belong to an order (and only one order) then they should be children of the order otherwise they risk being orphans.

    If payments can cover more than one order, then they should stand alone, but you need to do serious thinking about how they are allocated to each order if the amounts don’t match exactly. This might be achieved via an “allocation” field (float or decimal) in the order and the payment. And/or you might need to split orders down into order lines. 
    An accurate understanding of the business model is required. Plus how it might evolve. Then do the entity modelling. Lastly decide how to implement in PW. And don’t forget that @Robin S‘s excellent ConnectFields module is just the biz for maintaining many-many relationships (e.g. between the two allocation fields referred to above). 

    • Like 2
×
×
  • Create New...