phpBMS

Ticket #66: tracking.patch

File tracking.patch, 5.2 KB (added by Andreas Tangemann <a.tangemann@…>, 3 years ago)

Add button in sales order to start tracking a shipment.

  • modules/bms/include/invoices.php

     
    272272 
    273273                function showShippingSelect($uuid,$shippingMethods){ 
    274274 
    275                         ?><select name="shippingmethodid" id="shippingmethodid" onchange="changeShipping()"> 
     275                        ?><select name="shippingmethodid" id="shippingmethodid" onchange="changeShipping();changeTracking();"> 
    276276                                <option value="" <?php if($uuid=="") echo "selected=\"selected\""?>>&lt;none&gt;</option> 
    277277                        <?php foreach($shippingMethods as $method){?> 
    278278                                <option value="<?php echo $method["uuid"]?>" <?php if($uuid==$method["uuid"]) echo "selected=\"selected\""?>><?php echo $method["name"]?></option> 
     
    293293                                        `uuid`, 
    294294                                        `name`, 
    295295                                        `canestimate`, 
    296                                         `estimationscript` 
     296                                        `estimationscript`, 
     297                                        `trackingscript` 
    297298                                FROM 
    298299                                        `shippingmethods` 
    299300                                WHERE 
     
    322323                                $phpbms->topJS[] = 'shippingMethods["'.$uuid.'"]["name"]="'.htmlQuotes($therecord["name"]).'";'; 
    323324                                $phpbms->topJS[] = 'shippingMethods["'.$uuid.'"]["canestimate"]='.((int) $therecord["canestimate"]).';'; 
    324325                                $phpbms->topJS[] = 'shippingMethods["'.$uuid.'"]["estimationscript"]="'.htmlQuotes($therecord["estimationscript"]).'";'; 
     326                                $phpbms->topJS[] = 'shippingMethods["'.$uuid.'"]["trackingscript"]="'.htmlQuotes($therecord["trackingscript"]).'";'; 
    325327                        } 
    326328 
    327329                        return $thereturn; 
  • modules/bms/install/createtables.sql

     
    321321  `creationdate` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', 
    322322  `modifiedby` INTEGER UNSIGNED, 
    323323  `modifieddate` TIMESTAMP, 
     324  `trackingscript` VARCHAR(128), 
    324325  `custom1` DOUBLE, 
    325326  `custom2` DOUBLE, 
    326327  `custom3` DATETIME, 
  • modules/bms/invoices_addedit.php

     
    542542 
    543543                                        <p> 
    544544                                                <label for="trackingno">tracking number</label><br /> 
    545                                                 <input id="trackingno" name="trackingno" type="text" value="<?php echo htmlQuotes($therecord["trackingno"]) ?>" size="50" maxlength="64" /> 
     545                                                <?php  $trackingButtonDisable=""; 
     546                                                        if($therecord["trackingno"]=="") $trackingButtonDisable="Disabled"; 
     547                                                ?> 
     548                                                <input id="trackingno" name="trackingno" type="text" value="<?php echo htmlQuotes($therecord["trackingno"]) ?>" size="50" maxlength="64" onchange="changeTracking()" /> 
     549                                                <button id="trackingButton" type="button" onclick="startTracking()" class="graphicButtons buttonShip<?php echo $trackingButtonDisable?>" title="Tracking"><span>Tracking</span></button> 
    546550                                        </p> 
    547551                                </fieldset> 
    548552                        </div> 
  • modules/bms/javascript/invoice.js

     
    11931193        estimateShippingButton.className = newClass; 
    11941194} 
    11951195 
     1196function changeTracking(){ 
     1197        var trackingno = getObjectFromID("trackingno"); 
     1198        var TrackingButton=getObjectFromID("trackingButton"); 
     1199        var newClass="graphicButtons buttonShipDisabled"; 
     1200        var currentShipping = getObjectFromID("shippingmethodid").value; 
    11961201 
     1202        if(trackingno.value!='' && shippingMethods[currentShipping]["trackingscript"]!='') 
     1203                newClass="graphicButtons buttonShip"; 
     1204 
     1205        TrackingButton.className = newClass; 
     1206} 
     1207 
    11971208shippingNotice=""; 
    11981209function startEstimateShipping(){ 
    11991210 
     
    12161227 
    12171228}//end function 
    12181229 
     1230function startTracking(){ 
    12191231 
     1232        var thebutton = getObjectFromID("trackingButton"); 
     1233        var currentShipping = getObjectFromID("shippingmethodid").value; 
     1234        var trackingno = getObjectFromID("trackingno").value; 
     1235        var theURL = shippingMethods[currentShipping]["trackingscript"]; 
     1236 
     1237        if(thebutton.className.indexOf("Disabled") == -1 && shippingMethods[currentShipping]["trackingscript"]!=''){ 
     1238                position = theURL.indexOf('%s'); 
     1239                theURL = theURL.substring(0,position)+trackingno+theURL.substring(position+2); 
     1240                window.open(theURL,'phpBMS'); 
     1241        }//end if 
     1242 
     1243}//end function 
     1244 
    12201245function performShippingEstimate(base){ 
    12211246 
    12221247        var resultsArea = getObjectFromID("shippingNoticeResults"); 
  • modules/bms/shippingmethods_addedit.php

     
    102102                                <input id="estimationscript" name="estimationscript" type="text" value="<?php echo htmlQuotes($therecord["estimationscript"])?>" size="64" maxlength="128"/> 
    103103                        </p> 
    104104                </fieldset> 
     105                <fieldset> 
     106                        <legend>track shipment</legend> 
     107                        <p><br /> 
     108                                <label for="trackingscript">tracking script</label><br /> 
     109                                <input id="trackingscript" name="trackingscript" type="text" value="<?php echo htmlQuotes($therecord["trackingscript"])?>" size="64" maxlength="128"/> 
     110                        </p> 
     111                </fieldset> 
    105112 
    106113                <?php $theform->showCustomFields($db, $thetable->customFieldsQueryResult) ?> 
    107114 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.