Jump to content


Popular Content

Showing content with the highest reputation on 04/06/2020 in all areas

  1. 3 points
    Your code can't work because interpolation for double quoted strings allows only variables or some variable expressions (like methods calls or object property access), see the documentation on string parsing. foreach loops are language constructs and can't be used inside strings. For this to work, move your foreach loop outside the echo statement and only echo the actual HTML code. Then it should work: foreach($item->repeater_logos_links as $logo) { echo "<img src='{$logo->single_image->url}' alt='{$logo->single_image->description}' width='400'>"; }
  2. 2 points
    Thx for finding this! v0.0.5 fixes that πŸ™‚ I was also not sure about rounding the tax... I changed it to be 5 digit precision always. Calculations now always depend on NET and TAX solely. Gross is calculated not via ( net * (1+(net*tax)) ) but simply ( net + vat ). This should eliminate any rounding issues as it will always be GROSS = NET + VAT Thx @tpr I added a test in v0.0.7 - really great module! Though I think it could be made a lot easier for module developers to use your module (which would hopefully increase the change of more modules adding tests to their repos!): At the moment there is a lot one has to do when one wants to add a test to thier module: Install your module (obviously), then create an admin page, set the process, set the filepath, create the test. IMHO this could (should!) be simplified to this: Install your module Add a hook in my module Add a test in my module The hook could look like this: $this->addHookAfter("ProcessNetteTester::getTestDirectories", function($event) { $dirs = $event->return; $dirs[] = $this->config->paths($this)."tests/"; $event->return = $dirs; }); So this would add the path "/var/www/foo/site/modules/FooModule/tests/" to the scanned directories. ProcessNetteTester would then know to scan this folder for tests and list it under a json dropdown just like the db backups module: So the entry "RockPriceTests" would be "Nette Tests" (which could be automatically created on install of ProcessNetteTester) and then list all tests as submenu (like RockPrice). Hope that makes sense! Would be great to get support for this and I'm quite sure many would use it (as it is really not difficult to get started with nette testing framework) πŸ™‚
  3. 1 point
  4. 1 point
    TrelloWire This is a module that allows you to automatically create Trello cards for ProcessWire pages and update them when the pages are updated. This allows you to setup connected workflows. Card properties and change handling behaviour can be customized through the extensive module configuration. Every action the module performs is hookable, so you can modify when and how cards are created as much as you need to. The module also contains an API-component that makes it easy to make requests to the Trello API and build your own connected ProcessWire-Trello workflows. Features All the things the module can do for you without any custom code: Create a new card on Trello whenever a page is added or published (you can select applicable templates). Configure the target board, target list, name and description for new cards. Add default labels and checklists to the card. Update the card whenever the page is updated (optional). When the status of the card changes (published / unpublished, hidden / unhidden, trashed / restored or deleted), move the card to a different list or archive or delete it (configurable). You can extend this through hooks in many ways: Modifiy when and how cards are created. Modify the card properties (Target board & list, title, description, et c.) before they are sent to Trello. Create your own workflows by utilizing an API helper class with many convenient utility methods to access the Trello API directly. Feedback & Future Plans Let me know what you think! In particular: If you find any bugs report them here or on Github, I'll try to fix them. This module was born out of a use-case for a client project where we manage new form submissions through Trello. I'm not sure how many use-cases there are for this module. If you do use it, tell me about it! The Trello API is pretty extensive, I'll try to add some more helper methods to the TrelloWireApi class (let me know if you need anything in particular). I'll think about how the module can support different workflows that include Twig – talk to me if you have a use-case! Next steps could be a dashboard to manage pages that are connected to a Trello card, or a new section in the settings tab to manage the Trello connection. But it depends on whether there is any interest in this πŸ™‚ Links Repository on Github Complete module documentation (getting started, configuration & API documentation) [Module directory pending approval] Module configuration
  5. 1 point
    @bernhard - does this work? I can parse and provide the info from the phpdoc however you want, so if this still isn't correct, just let me know. PS, if it helps, I can also return the values for @return and @throws
  6. 1 point
    Looking to create a membership based site using LoginRegisterPro. Seems it's missing a key piece which would be charging for a new user sign up and assigning them a new role or roles ideally based on what type of membership they choose. For example: Basic, Silver, Gold etc. How would you add this ability to LRP? Suggestions?
  7. 1 point
  8. 1 point
    This error is fixed in v0.0.3 πŸ™‚ The reason was simply that RockFinder2 is autoload=admin, so on the frontend you need to do $modules->get('RockFinder2') before any new RockFinder2() statements.
  9. 1 point
    Can we see the code of your module? This is an example I am using: class ProcessEARDashboard extends Process { public static function getModuleInfo() { return [ 'title' => 'EAR Dashboard', 'version' => '0.0.1', 'summary' => 'EAR Dashboard', 'icon' => 'gears', 'requires' => [], 'installs' => [ 'ProcessEARNew', 'ProcessEARImport', ], 'permission' => 'ear-dashboard', 'permissions' => ['ear-dashboard' => 'May see the EAR dashboard'], 'page' => [ 'name' => 'ear', 'title' => 'EAR Dashboard' ], ]; }
  10. 1 point
    I guess we have all been there... We need to store a price to a product. "Ok, easy, let's create a new field for that in the PW backend!" might be the first thought. But then the headache starts... What about TAX? What about NET and GROSS values? And what about rounding problems when not using the correct float or decimal values ( https://processwire.com/talk/topic/7542-development-fieldtypefloat-fieldtypedecimal/ )? Meet RockPrice - a brand new (and not well tested!) module to save you from those headaches and make the UI more compact and reactive (nobody wants to calc tax/net/gross manually!). If you discover any issues or have suggestions for improvement please let me know! πŸ™‚ --- Download: https://github.com/BernhardBaumrock/RockPrice --- RockPrice Price Fieldtype + Inputfield for ProcessWire CMS Settings Usage The field always returns a RockPriceMulti object. This object contains an array of items and the totals vor vat, net and gross (where tax stands for the tax rate in percent and vat for the actual tax value, eg. Euros or Dollars): d($page->price); d($page->price->items->first()); API Saving field value: $page->setAndSave('price', [1000, 20]); $page->setAndSave('price', [ [1000, 20], [3000, 10], ]); Comparisons $p1 = new RockPrice(1000, 20); $p2 = new RockPrice(1000, 10); d($p1->equals($p2)); // false $m1 = new RockPriceMulti([$p1, $p2]); $m2 = new RockPriceMulti([$p1, $p2]); $m3 = new RockPriceMulti([$p2, $p1]); // flipped! d($m1->equals($m2)); // true d($m1->equals($m3)); // false d($m1->equals($m3, true)); // true (ignoring sort order)
  11. 1 point
    Personally I don't feel UI necessarily needs automated tests, but business logic certainly does. E.g. currently this happens: > var_dump(new RockPrice(1000, 3.7, 0)); object(RockPrice)#1 (4) { ["tax"]=> float(4) ["vat"]=> float(40) ["net"]=> float(1000) ["gross"]=> float(1037) } This is because the tax is rounded to the number of decimals used for the net/gross value, but it's not consistantly applied in rounded form. This makes the invariant of net + vat = gross break. I'm not sure if it makes sense to round the tax to the same decimal places than net/gross. Generally I'd opt for https://github.com/moneyphp/money for representing money in php – especially given the fact I had code similar to yours in a codebase of mine. The library has been around for quite some time and includes everything to properly deal with money.
  12. 1 point
  13. 1 point
    Sorry for taking so long to reply β€” this is now the top item on my todo list. I'll try to get it included sometime soon!
  14. 1 point
    You would just need to add test files to your module, not the whole testing module. You or someone who is interested could install the tester module and run the tests. I can think of data saving and retrieval tests that could be tested on the backend. Frontend (e2e) testing us another thing, I used Cypress a few times but there are many other available. With Cypress it is easy to simulate user inputs and interactions. I can spend some time to set up a simple test if you wish, so you could use that as a base. But it is easy enough to just get started with the official docs.
  15. 1 point
    It works fine here: pageQueryJson() is not a core method. If that method is the cause of your issue best to ask in the module's support thread.
  16. 1 point
    Hi all, Apologies for the very loud silence! I hope to elaborate more on this a bit later. However, rather than keep people guessing, I'll write something short. I have been working my fingers to the bone to release a beta by spring 2020. I suppose it hasn't gone unnoticed that I rarely post in the forums at large these days. This is because I am dedicating nearly all my time to Padloper. The plan was to start early beta testing in mid-April 2020. This was largely on track. Like many of us, maybe most of us in the forums, we have all been affected in one way or another by the current situation in the world. This has thrown a monkey wrench in the works. I have had to readjust how I work, albeit my productivity taking a hit. I wish I could properly 'guesstimate' how much delay this is going to cause but it will just be futile. On the other hand, I appreciate that you have been waiting for a relatively long time for this release. I want to reassure you that I am not just kicking the can down the road. Maybe I should have been showing you more screenshots of progress but currently, that would just eat further into my limited time. Thanks for reading, and hopefully, your patience. Cheers.
  17. 1 point
    I've dabbled a bit and adapted my cache module to work with Redis (working mostly on Windows, this was a bit of an adventure, but Windows Subsystem For Linux saved the day). CacheRedis - a simple Redis cache interface for ProcessWire There should be enough documentation to get started in the README. In short, it has the following methods: $redis->fetch($key[, $expire, $func]) $redis->store($key, $expire, $value) $redis->delete($key) $redis->flush() $redis->renderFile($file[, $expire[, $options]])
  18. 1 point
    What I know has been pieced together from official docs and discovered through trial and error, so I can't provide a good link there. However, I've pushed a few pieces into a small module based on Memache that can be a (partial) stand in for WireCache as an example. You can find it on github as PwMemcache. It has just a few methods to set/get/delete cache entries and doesn't allow saving and restoring of full pages like WireCache does, but it does have a renderFile method similar to WireCache. Maybe that could be a starting point. Most of the magic in using memory caches is using well thought out cache keys to avoid conflicting names (you're likely to use them more intensively than database caching) using reasonable expiry values (same as with database caches) preventing outdated data (e.g. by deleting entries when pages are changed, there's little 'automatic magic' there) taking care of special considerations when data is serialized and later unserialized, since behavior differs between solutions How exactly that best goes depends on the features of the caching solution. Unlike WireCache, many in-memory solutions have no wildcard deletion operators, so you sometimes have to build workarounds. My module for example does this when you pass PwMemcache::expireSave to the renderFile method. The cache contains an extra array where all the entries are stored that have to be cleared when a page is saved. In a Pages::saved hook, this entry is read, all cache entries listed in the array are deleted and the entry is emptied.
  • Create New...