Jump to content

DisposableHero

Members
  • Posts

    624
  • Joined

  • Last visited

  • Days Won

    97

Posts posted by DisposableHero

  1. 4 hours ago, TheDoctor75 said:

    Hi, first of all congratulations for your "Tools" are very useful,

    visiting the folders (.. \ modules \ DisposableTools \ Resources \ lang \) for example,

    you can find the various languages ...

    I was wondering how I can set up such example the it? 

    Thanks 
    Mirko75


    Hi,

     

    To use a different language you need to change the locale setting from env.php because this is not a module setting and effects your phpvms v7 installation.

     

    APP_LOCALE=en

     

    is the default, you can change that to;

     

    APP_LOCALE=it

     

    for Italian and save your env.php , then go to admin -> maintenance , clean ALL CACHE or APP CACHE for this change to be recognized.

  2. 2 hours ago, miniarma said:

    Thanks bud, I'll just do a manual import of the schedules and flights. Pilots will have to re register to avoid the bug issue.

     

    Thanks for your help

     

    My pleasure, hope manual import trick helps you out ;)

     

    By the way, even after a successful import, pilots need to reset their passwords to be able to login to v7. So it will take almost the same time (maybe less) for them to re-register :)

    • Like 1
  3.  

    You need to provide some more info for our "suggestions" :(

     

    6 hours ago, miniarma said:

    So on install all is fine and dashboard works. 

    I run the importer and import phpVMS 5.5.2 data and then the dashboard displays error 500.

     

    Dev: 7.0.0-dev+211001.87886f

    https://phpvms.creationweb.uk/dashboard

     

    All other pages work fine apart from dashboard. I've tried removed .htaccess with no luck

     

    Any suggestions ?

     

     

    Unfortunately, this really means nothing. Yes, there is an error you are facing but what it is ? This gives no idea at all.

     

    https://docs.phpvms.net/help#information-required

     

    https://docs.phpvms.net/help#logs

     

    https://docs.phpvms.net/help#enable-debug-and-debugging

     

    Without proper error details, we really can't help you much...

  4. 5 hours ago, Nabeel said:

    Have you shut the engines down? There is a new setting to not require the engines being shut down to end the flight

     

    The problem is with starting the flight :( Acars stucks at "Pushback" 'cause engine state does not get recognized with MsFs + FBW Airbus A320 NEO (maybe with others too). So for acars flight never leaves "Pushback" and end flight is not possible, nothing being recorded/recognized during that state. As expected, it never detects the landing in the first place to offer "End Flight".

     

    Had to manually change pirep states/fuel values etc from db for tonight's flights and then told my pilots to manually send/file their pireps via web.

     

    Just for your info.

  5. Great to see it working :)

     

    You can remove the name from the select 'cause you do not need to send it to SimBrief.

     

    <select id="dropdown" onChange="ChangeFormValues()">

     

    When you submit a form, everything you gave a name will be passed with its value (if it is enabled of course). We can not disable the dropdown here 'cause we need it, but we can avoid sending it to SimBrief by removing the name="" tag ;)

     

    Just a little trick for you.

    • Thanks 1
  6. I think you can filter the json in your second dropdown, so a second call to database would not be needed / required at all. Once you create the json object from mysql results, what you need to to is ;

     

    1. Show only the ICAO values of that json object in your first dropdown (group them by icao, so there will be only one B738)

     

    2. And when user selects an ICAO type, use onChange() with JavaScript to show/display your second dropdown while passing the user's ICAO Type selection, here you need to show Registrations only which have the selected ICAO type by using the same json object.

     

    At this point you will have two values in your hand; ICAO, from the first dropdown and REGISTRATION from second one. Then you can pass those values to your SimBrief form.

     

    Hope you can manage to finish this and have a working solution.

     

    Since you are not using live database calls, you may not need Ajax at all and all this can be done with plain JavaScript. (even you do not need JQuery to do all the above)

  7. 4 hours ago, Jbaltazar67 said:

    Thank you very much Disposablehero for all your explanations and for taking your free time.
    It's a pity that we are not neighbors, it would be worth a drink or a coffee.😉

     

    My pleasure :)  and thanks for kind thoughts, considered as if I had that drink ;)

     

  8. Imagine a scenario, in which pilot lands with -673 feet/minute. ( absolute value is 673 , using abs() makes it easier to handle things logically )

     

    It will pass the first "if" check we put in 'cause we are checking anything above -500 feet/minute.

     

    Then it will reach the multiplier part, here our new $amount will be calculated like this $amount = 250 * (673 / 500) , means simply $amount = 250 * 1.346 , result will be rounded so it will be 337 ($ or Eur, your selected currency)

     

    The next step will prepare the proper Expense array to pass back, charge_to_user is true, this means that the amount will be taken from pilot's pocket :)

     

    In another flight, another pilot lands with -499 feet/minute, then nothing will happen and no expense will be charged to pilot 'cause it will be captured by the "if" check and it can not proceed further.

     

    Now, after the example above and basic explanation here, it is up to you and your imagination + skills ;)

    • Thanks 1
  9. There is no such expense type called Hard Landing and the transaction group you defined is wrong, also the Hard Landing([...]); will mean nothing for the code etc etc. The images you added in above message is not visible, even when I click I see a thumbnail of them, nothing readable :(

     

    <?php
    
    namespace App\Listeners;
    
    use App\Contracts\Listener;
    use App\Events\Expenses;
    
    class HardLanding_ChargePilot extends Listener
    {
        public function handle(Expenses $event)
        {
            $expenses = [];
            $amount = 250;
          
            // Do your check here, return an empty array if it is ok/below your check limit (no expense needed)
            if (abs($event->pirep->landing_rate) < 500) { 
              return $expenses;
            }
            
            // You can even increase the punishment here by getting a ratio
            // So the harder they land, the higher the punishment
            $amount = round($amount * (abs($event->pirep->landing_rate) / 500));
    
            // Prepare a New Expense here
            $expenses[] = new Expense([
                'type'              => ExpenseType::FLIGHT, // This must be FLIGHT for a pirep related pilot charged expense
                'amount'            => $amount, // No need to add two more digitis, 150 is 150$ or 150Eur etc.
                'transaction_group' => 'Hard Landing', // This is the group name, visible at financial report
                'name'              => 'Hard Landing Fee For Pirep='.$event->pirep->id, // Name is visible like a memo
                'multiplier'        => false, // or true (to use Subfleet GH Multiplier)
                'charge_to_user'    => true, // true to charge pilot, false to charge company
            ]);
          
            // If you wish you can create another expense here like the one above...
    
            // And finally return all new expenses you prepared
            return $expenses;
        }
    }

     

    As the example above, you need to follow some basic logic and do checks. If you do not follow standards it will either not work at all (errors out and causes problems) or at best it will not be applied by phpvms v7.

     

    Anyway, if you want to code your expenses or have modules/widgets etc you need to study phpvms first, to learn how it works, what it needs/expects.

  10. Sounds like the Hard Landing expense you wrote is not checking the landing rate and charging the pilot always.

     

    Which is not good of course :) I do not know how you coded it or did found an example and used it as it is without modifications. So without seeing the expense you are using I can not help much.

     

    For the first question, I kindly do not advise messing up with core code so I will not point you to some core files/filenames :( You can however, try the second/third alternatives by using the same expense logic you used for the hard landing with some enhancements to achieve what you want ;) 

  11. Not much :) The basics of server side / client side limitations still apply but we are much flexible there at server side (with php + laravel)

     

    I do not know if it is possible with php 5.x series but you may consider using JSON objects in that page too. Build the resultset once with php, convert it to a json object, then use it with javascript so show a dropdown for ICAO Types and then another one for Registrations ;)

  12. In basic terms, for php this is happening ;

     

    $resultSet = "SELECT icao, registration FROM phpvms_aircraft"; > Returns a nice result :)

     

    $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='<input type="hidden" id="typo" readonly>'"; > Returns nothing :(

     

    Because $avion = '<input type="hidden" id="typo" readonly>'

     

  13. 6 hours ago, ARV187 said:

    So I see two issues:
    1º Form isn't sending the value from:

     

    
    
    echo '<option value="'.$reg.'">'.$reg.'</option>';

     

    but this value is showed rightly in form page (<form id="sbapiform"> in \lib\skins\bs4\schedule_briefing.tpl).

    2º I'm not sure if WHERE variable is working because when I use icao='".$avion."' not is showing nothing in the web page echo '<option value="'.$reg.'">'.$reg.'</option>'; However if I use WHERE icao='A20N' is showed in form web page.

     

    
    
    $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='".$avion."'";

     

     

    This is happening because you are mixing up two different languages here and expecting them to work together always.

     

    PHP is a server side language, means that anything you write with it runs *BEFORE* you see the actual result/page. While on the other hand, JavaScript runs at client side, meaning that you will see it working *AFTER* the page is rendered/loaded.

     

    So what is happening in your code;

     

    1. When you want to use that page, php code runs *before* you see it and generates the $resultset. At this moment, also the second php code block runs for $resultset2 but returns nothing because $avion has no value yet, simply it is null.

    2. Page loads, you see the dropdown menu filled with $resultset data. You select one of them, and at that moment your JavaScript upIcao() start working and assigns a value to typo (which is also the $avion)

     

    Here at this exact moment, you expect for php code to pick/see that change and run again. But this can not happen, it is against the design logic of it. So for php $avion is still empty and will remain empty, no matter how many times you change your selection it will have no effect for php 'cause it worked and stopped before you even see the that dropdown items.

     

    What you can do;

     

    1. Alter your code to select all aircraft registrations you have with php, make it ready to be used when the page loads. Then filter those results with your Javascript upIcao() and show a filtered second dropdown according to the selection of first dropdown.

     

    2. Or you can make use of JavaScript/AJAX calls, which basically enables the use of php along with JavaScript (simple terms: it will run a php/mysql code when you change the first dropdown and then display you the results). You can find some nice examples for that and implement your own code.

     

    Hope this helps ;)

  14. Something like this (a little bit cleaner of yours and tried to correct the form elements

     

    <?php
      require_once ("/Connections/db.php");
      mysqli_select_db($db, $database_db);
      $resultSet = "SELECT icao, registration FROM phpvms_aircraft";
    ?>
    
    <select name="type" id="typo" onChange="upicao()">
      <?php
        $resultSet = mysqli_query($db, $resultSet) or die(mysqli_error($db));
        while ($rows = $resultSet->fetch_assoc()) {
          $icao = $rows['icao'];
          $reg = $rows['registration'];
          echo '<option value="'.$icao.'">'.$icao.' '.$reg.'</option>';
        }
      ?>
    </select>
    
    <?php $avion = '<input type="hidden" id="typo" readonly>'; ?>
    
    <script type="text/javascript">
      function upicao() {
        var select = document.getElementById('typo');
        var option = select.options[select.selectedIndex];
        document.getElementById('typo').value = option.value;
      }
    </script>
    
    <?php
      if (isset($avion)) {
        require_once ("/Connections/db.php");
        mysqli_select_db($db, $database_db);
        $resultSet2 = "SELECT registration FROM phpvms_aircraft WHERE icao='".$avion."'";
    ?>
      <b>Registro</b> (opcional):&nbsp;
      <input name="reg" id="regist">
    <?php
        $resultSet2 = mysqli_query($db, $resultSet2) or die(mysqli_error($db));
        while ($rows = $resultSet2->fetch_assoc()) {
          $reg = $rows['registration'];
          echo '<option value="'.$reg.'">'.$reg.'</option>';
        }
      }
    ?>

     

  15. Does the above code works ? I mean did you somehow tried to dump the form values at some point to see if it is working properly (assigning values to names etc).

     

    echo '<option value="'.$reg.'">'.$reg.'</option>';

     

    I think the html form tags should be like <option value="E-ABCD">E-ABCD</option>, I did not tried to use them like you did with <option value=E-ABCD>E-ABCD</option>

     

    Same applies to your ICAO Type selection code too (if this is the case of course)

  16. And of course, for both alternative and third solution there should be some checks and corrections (to handle rejected pirep situations, like taking the same amount back from the pilot if the pirep gets rejected after being accepted once).

     

    So the first solution is the safest way to do it 'cause phpVMS v7 will handle all the transactions (and accept/reject/accept cases). Second and third solutions may look nicer but both needs extra attention to detail.

  17. 9 hours ago, Jbaltazar67 said:

    Hello ,
    We offer cargo contracts to our pilots, they are paid by the KG transported, I am looking for how to create the tariff.
    Ex: 1kg loaded = 1.00 € if a sympathetic enough person could help me that would be great.
    Thanks in advance

     

    It is not possible without writing your own code.

     

    Currently phpVMS v7 offers two ways to pay pilots;

     

    1. By flight time
    2. By each flight (fixed amount)

     

    What you need is a your own code, which basically will have two separate parts/actions;

     

    1. Listen pirep events to get the amount of cargo they carried (pirep->fares and fare->count). Calculate the "pilot pay" for that amount/flight.

    2. Send back that amount to phpVMS v7 as "pilot pay" for that pirep.

     

    For the first, you do not need to alter core code, you can do that without problems by event listeners. But for the second part, you need to alter core code to get and process your calculated pilot pay (which makes tracking updates hard).

     

    Alternatively, you can do the first part but skip the second part by paying the amount directly to pilot account after the calculation. This does not need altering core code, but no one will see the calculated pilot pay in pirep transactions, it may be only visible in admin / finances. Pilots will see increase in their current balance of course, but no details will be there.

     

    Or as a third solution, you can do the first part and change the second part a little bit. By sending that pilot pay "pilot bonus" as an "expense" (which is already built in to v7 core code so no need to alter it). While sending in the expense to v7, you need to credit the pilot account at the same time, so everyone will see it clearly when looking through pirep transactions. This probably be the nicest solution without altering the core code;

     

    1a. Listen pirep events to get the amount of cargo they carried (pirep->fares and fare->count). Calculate the "pilot bonus" for that amount/flight.

    1b. Send back that amount to phpVMS v7 as an additional "expense" for that pirep, credit pilot with the same amount.

     

    (This solution can be done in a single custom expense code)

     

    Hope this helps

  18. 5 hours ago, DominZo said:

    Is it possible to somehow remove the fact that the pilot cannot fly if the pirep is not accepted?

     

    No.

     

    How can he/she/it fix a mistake if you do not let a pilot to fly again when a pirep gets rejected ?

     

    It will be totally strange to forbid them to fly when a flight report gets rejected.

     

    You can manually change their state to Suspended from admin panel if you really want them to stop flying for you until you somehow resolve the rejected pirep problem. (Or you can just fire them, this will forbid them flying too)

  19. 1 hour ago, atrdriver said:

    As you were probably typing that I did a search for the old domain name inside all the website's files, and found it a LOT in the file

    \phpvms\bootstrap\cache\config.php

    I changed all of them and it appears to be working now, at least I can log in and all the data seems to be there.  Yes, it is the same hosting company, and both sited were inside my account there.  There were a bunch of other files that had the shootingstarfan domain name in them, but they were all long file names that made no sense, such as

    \phpvms\storage\framework\sessions\BaxV6zu49204SbJNn91VxnIsc9ZNnhjZhNV0jVzI

     

    Hopefully the config.php file got it working :)  And someday I hope to be smart enough to edit the blade files, but I'm not there yet.

    Thanks a TON!!!!

     

     

    My pleasure 😇

     

    Oh, we forgot to clear the cache :D Poor laravel was trying to act on the old domains cache at the new domain. Sorry I forgot that step, technically you need to clean the cache (delete some files) when you swap domains/subdomains. No need to edit files under cache folders, phpvms generates them on the first run when not found (and this manual cache cleaning process is sometimes becomes a key factor for updates)

     

    When you need a blade change, just let me know (either via forum or discord), I may not be able to do the change for you but at least I can give you some basic info about it ;) 

     

    Safe flights,

  20. 1 hour ago, atrdriver said:

    Thanks Hero.  I guess for now I will just leave it at transferred hours as is.  That was the only complaint that I had from the couple of pilots that I had testing things.

     

    On a different topic.  I had phpvms running on another website to get it all set up.  Today I tried to make it live by changing the domain names around.  It was originally running on a site called www.shootingstarfan.com, and I changed it's domain to our live site, which is www.flycoa.com.  I changed the domain name in env.php, which was the only place where I could find a reference to the website domain.  But when I try to go to it I get a server error.  I looked for a log from today, and there isn't one.  Is there someplace else I have to change the domain names, or am I going to have to re-install and then import the databases?  Thanks.

     

    What were they complained about... Two values being separated logically or visually ? If it is visuals only (which the pilots see) it can be fixed though (we can make them happily fly ever after), but if they are against the logic behind it then I think they need to focus on their flights rather than administrative issues :)

     

    Are those domains on same server and under same hosting account ?

     

    If yes, then after copying over all files to the new domain (or subdomain) changing the APP_URL value at env.php should be enough (considering the database server remains same). That was what I did when switching from test to live (same server different subdomains, same database).

     

    No laravel log from today seems like the problem is somewhere in the server (apache/nginx or php) config, it fails before even loading laravel core. So for more comments, we need to see logs.

     

    And double check that new server's capabilities against phpvms requirements, if they are not under the same hosting account.

     

  21. 31 minutes ago, atrdriver said:

    I am getting ready to take my phpVMS website live to replace my older VAM powered one.  Question is, is there a way for me to enter my pilots transferred hours so they show as flight time and not transferred hours?  Like manually editing the total in the database?  Or possibly filing a manual PIREP with all the transferred hours?  I'm just looking for a way for them to show up in a pilots hours, and not have it be listed under transferred hours. 

     

    Thanks in advance,

    john croft

     

     

    "not have it be listed under transferred hours"

     

    • Manually editing database : Will not work 'cause user stats get re-calculated every night
    • Filing a manual pirep for each user, then editing its "flight time" directly from database : Is the only solution according to your above mentioned wish. (which may have small side effects but will not be harmful I think)

    Why do you want that hours to be listed as normal hours, in fact there are actually transferred hours from your old system ? I see nothing wrong there 'cause those transfer hours are used in ranks / rewards etc (if you enable that setting too). So if you define same ranks (matching or improving your old system), all will be auto selected by their vms7 hours + transferred hours etc. (same applies to awards too)

     

    Also as the admin of the va, you will have full control over your theme(s). In those you can simply show the total hours without any separation if you need so (like in roster and user profile). This of course needs some blade editing but nothing hard there.

     

    Hope you find the best solution for your new system ;)

     

    Just a side note :

    • Pirep / flight_time is in minutes, so when editing the pireps one by one for each user, you need to enter their VAM hours as minutes
    • User / transfer_hours is in hours, no conversion needed.

     

     

    • Thanks 1
×
×
  • Create New...