Jump to content

Greywacke

Members
  • Posts

    510
  • Joined

  • Last visited

Everything posted by Greywacke

  1. hi there,i'm sitting with a problem parsing all the xml subelements of the prospectmessages tags. the xml that needs to parse is being retrieved, but only the last element.here is the xml: // get prospect messagesvar pctmsgs = xmldoc.getElementsByTagName("prospectmessages"); // load possible prospect messages for selected servicefor (var m = 0; m < pctmsgs.length; m++) { // begin for possible prospect messages var pctmsg = pctmsgs[m].getElementsByTagName("prospectmsg"); // load possible prospect message array for (var c = 0; c < pctmsg.length; c++) { // begin for possible prospect message var p = 0; var parr = new Array(); if (pctmsg[c].attributes) { // begin if prospect message parr[p] = pctmsg[c].getAttribute("number") + // add prospect message number "&&" + pctmsg[c].getAttribute("text"); // && prospect message text p++; } // end if prospect message } // end for possible prospect message} // end for possible prospect messagesif (parr) addprospectmessages(parr); // populate prospect messages list here is the addprospectmessages function: function addprospectmessages(arr) { alert(arr.join("\n")); var sel = document.getElementById("list_msg"); sel.options.length = 0; for (var i = 0; i < arr.length; i++) { var oarr = arr[i].split("&&"); // split array element (represents an option) var opt = document.createElement("option"); // create an option and set text to number and message opt.text = oarr[0] + "). " + oarr[1]; opt.value = oarr[0] + "&&" + oarr[1]; // set value to number and full message try { sel.add(opt, null); // standards compliant; doesn't work in IE } catch (ex) { sel.add(opt); // IE only } }} when alert is enabled, to display each array item on a different line, it only displays the last item. how is it possible the first two items are not alerted or displayed in the list box?i am completely stumped. please help! i get absolutely no browser errors.
  2. well i cannot use the date_add or date_sub functions, as the production environment uses PHP 5.2.9 which does not have these functions yet... its supposed to subtract a month from the time to go one month back. the listing is in reverse order, and meant to be that way unfortunately. as i said i am not that confident when working with date/time objects.this is however of secondary importance at the moment, repairing that function to write the months in reverse order from the current month.
  3. hi, i need to output the last 3 months including the current month, and it has worked till march.here is the code that does this: // get the current time$now = time();// function to list the monthsfunction last3months($name) { $now = $GLOBALS["now"]; //echo "\$m = ".$GLOBALS["m"].";\n"; //echo "date(\"Y-m\", \$now) = ".date("Y-m", $now).";\n"; echo " <statmonths name=\"".$name."\">\n"; for($i = 0; $i < 3; $i++){ echo " <month text=\"".date("F Y", $now)."\" value=\"".date("Y-m", $now)."\"".(($GLOBALS["m"] == date("Y-m", $now))?" selected=\"selected\"":"")." />\n"; $now = (intval(date("t",$now)) * 24 * 60 * 60); } echo " </statmonths>\n";} how could i improve on this to get months < 30 days listed after that month? basically i need to print the monthname and year (format "F Y") as the text and a numeric representation in the format "Y-m" as value attributes.could someone please assist? dates and times are not exactly my forte...
  4. lol well wether i get help or not, these issues i post need resolving.i have to make a living
  5. this issue has been resolved, it turned out the population of the $append variable happened before a lead was selected - thus the parameters passed to the function were empty...ISSUE RESOLVED
  6. okay, this problem is still around :)here is the current function, it's supposed to insert the variable into the mails along with the others now, but the function keeps returning blank. function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too? $sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($row = mysql_fetch_array($result)) { $dd = $row["smallint_DuplicateDays"]; } $ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),$dd." days ago")); $sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer LIKE \"%".$mail."%\" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > \"".$ddate."\" ORDER BY timestamp_LeadCreated DESC;"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($result) { $leadids = array(); while ($row = mysql_fetch_array($result)) { array_push($leadids,"#".($row["bigint_LeadID"]+11001000)); } return " (".join(", ",$leadids).")"; } else { return ""; }} the criteria for this functions purpose is the following now: $append is set within this loop with the following code.$append = duplicatedays($consumeremail,$service,$recipient[6]); // check duplicate days $consumeremail is requested from the form and used in the email and to add leads successfully.$service is set to 1, this is the only service this form is for.$recipient[6] is part of the recipient array, it contains the id of the supplier that was matched. $body = str_replace("%DUPLICATEDAYS%",$append,$body); // insert duplicate days notification the previous line of code replaces a %DUPLICATEDAYS% marker in the template file loaded as $body to mail, with $append. it still refuses to acknowledge duplicate leads.i check wether the attribute value is "" (an empty string) if ($append=="") { and then don't charge and add transactions.$append is used nowhere else in the handler, incase the value was being deprecated.according to the above criteria... why could this be??? someone PLEASE help! i'm afraid i do not see the pile of oranges for the apples hidden in between...
  7. okay :)here is the problem: the sql string selecting the duplicate leads returns the following: SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = 1 AND text_Consumer LIKE "%pierre@greywacke.co.za%" AND bigint_SupplierID = 13 AND timestamp_LeadCreated > 2010-02-25 06:08:28 ORDER BY timestamp_LeadCreated DESC; issue almost resolved i believe
  8. hi there,it's me again. i've been through the following PHP function i don't know how many times, but i don't seem to get why it's not trapping duplicate leads. it is supposed to get $dd as 30, $ddate should = $dd days ago from any time and serviceid is 1. the supplier matched has duplicate leads when a client submits the form twice, usually due to a choppy connection. i can always prevent the form from submitting twice, but what if the client refreshes and submits the same data? function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too? $sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($row = mysql_fetch_array($result)) { $dd = $row["smallint_DuplicateDays"]; } $ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),$dd." days ago")); $sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer LIKE \"%".$mail."%\" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > ".$ddate." ORDER BY timestamp_LeadCreated DESC;"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($result) { $leadids = array(); while ($row = mysql_fetch_array($result)) { array_push($leadids,"#".($row["bigint_LeadID"]+11001000)); } return " (".join(", ",$leadids).")"; } else { return ""; }} now this function is called as follows further down to set the appendage to the subject line of the lead being sent. $append = duplicatedays($consumeremail,$service,$recipient[6]); // check duplicate days then this variable is later used again where the subject is set, however i don't receive notification of duplicate leads in the subject this way... $mail->Subject = getSubText($body,"<title>","</title>").$append; // set subject to template page title and append text the leads are sent with this page.what could possibly be wrong with the function that it's not trapping the duplicate leads within the days specified on the service level?the server is using php 5.2.9 so there is not a date_sub functionality available.how could i discover wat the problem is? could it be in the date_sub substitution?
  9. yes it does, the problem was with duplicate fields by that name in the form.excuse the delay, this issue was resolved
  10. the javascript function that inserts this, with the alert commented - is as follows: // onselect event handlerdocument.form_suppliers.list_suppliers.onchange = function () { supplier = this.selectedIndex; if (supplier > -1) { var val = this.options[supplier].value.split(";,;"); //alert(val); document.form_suppliers.text_suppliername.value = trim(this.options[this.selectedIndex].text,""); document.form_suppliers.text_supplierw3address.value = val[1]; document.form_suppliers.textbox_supplieraddress.value = val[2]; document.form_suppliers.text_contactfirstname.value = val[3]; document.form_suppliers.text_contactsurname.value = val[4]; document.form_suppliers.text_contactposition.value = val[5]; document.form_suppliers.text_contactemail.value = val[6]; document.form_suppliers.text_contacttelephonenumber.value = val[7]; document.form_suppliers.text_creditbalance.value = val[8]; document.form_suppliers.text_creditupperminimum.value = val[9]; document.form_suppliers.textbox_credituppermessage.value = val[10]; document.form_suppliers.text_creditlowerminimum.value = val[11]; document.form_suppliers.textbox_creditlowermessage.value = val[12]; var vtdata = val[13].split(";"); document.form_suppliers.text_vturl.value = vtdata[0]; document.form_suppliers.text_vtusr.value = vtdata[1]; document.form_suppliers.text_vtkey.value = vtdata[2]; document.form_suppliers.text_accmgr.value = val[14]; document.form_suppliers.text_accmgremail.value = val[15]; document.form_suppliers.text_googlemapsurl.value = val[16]; for (var i = 0; i < document.form_suppliers.menu_status.options.length; i++) { if (document.form_suppliers.menu_status.options[i].value == val[17]) { document.form_suppliers.menu_status.options[i].selected = true; } else { document.form_suppliers.menu_status.options[i].selected = false; } } document.form_suppliers.menu_attributes.options.length = 1; document.form_suppliers.list_supplierattributes.options.length = 0; if (val[18]) { var val1 = val[18].split(";.;"); for (var e = 0; e < val1.length; e++) { var opt1 = document.createElement("option"); var arr = val1[e].split(";:;"); //(arr); opt1.text = arr[0]; // service name (region) opt1.value = 0; // zero value opt1.disabled = true; // prevent title from being selected var sel1 = document.getElementById("menu_attributes"); try { sel1.add(opt1, null); // standards compliant; doesn't work in IE } catch(ex) { sel1.add(opt1); // IE only } for (var i = 1; i < arr.length; i++) { var opt2 = document.createElement("option"); opt2.text = "\u00a0\u00a0\u00a0\u00a0\u00a0" + // attribute description = attribute value arr[i].split(";")[3] + " = " + arr[i].split(";")[4]; opt2.value = arr[i].split(";")[0] + "," + // attribute, service & region id array arr[i].split(";")[1] + "," + arr[i].split(";")[2]; try { sel1.add(opt2, null); // standards compliant; doesn't work in IE } catch(ex) { sel1.add(opt2); // IE only } } } } if (val[19]) { var val2 = val[19].split(";.;"); for (var e = 0; e < val2.length; e++) { var opt1 = document.createElement("option"); var arr = val2[e].split(";:;"); //alert(arr); opt1.text = arr[0]; // service name (region) opt1.value = 0; // zero value opt1.disabled = true; // prevent title from being selected var sel1 = document.getElementById("list_supplierattributes"); try { sel1.add(opt1, null); // standards compliant; doesn't work in IE } catch(ex) { sel1.add(opt1); // IE only } for (var i = 1; i < arr.length; i++) { var opt2 = document.createElement("option"); opt2.text = "\u00a0\u00a0\u00a0\u00a0\u00a0" + // attribute description = attribute value arr[i].split(";")[3] + " = " + arr[i].split(";")[4]; opt2.value = arr[i].split(";")[0] + "," + // supplier, service, attribute, & region id array arr[i].split(";")[1] + "," + arr[i].split(";")[2]; try { sel1.add(opt2, null); // standards compliant; doesn't work in IE } catch(ex) { sel1.add(opt2); // IE only } } } } }}
  11. hi there,i hope someone can help, i don't see the wall for the doors to the solution.i have a form named form_suppliers <input type="text" name="text_creditlowerminimum" id="text_creditlowerminimum" accesskey="l" tabindex="24" /> .the script inserts the following array, with element 11 having a value, it is alerted before attempting to insert the code with document.form_suppliers.text_creditlowerminimum.value = val[11]; .the array alerts as the following: note that element 11 contains the credit lower minimum. however, this will not insert into the field, val elements 9 10 and 12 insert however, as well as the rest of the elements. the reason these are retrieved from a string, is because they are stored in a list box as values. this value is split by ;,; initially from the value (the alert contents shows this to be working correctly), the substrings are delimited by ;:;.my question is, why will this array element not insert into the value of the text field? any possible reasons why?
  12. well the following code inserts a default value of 0000-00-00 00:00:00 ALTER TABLE `8_transactions` CHANGE `timestamp_TransactionEvent` `timestamp_TransactionEvent` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NULL DEFAULT 'CONVERT_TZ(CURRENT_TIMESTAMP, "SYSTEM", "+2:00")' COMMENT 'TimeStamp Transaction Event, Current TimeStamp No Keys'; i'd preferrably have this done in the database rather than the code (about 500 insert statements!)how could i go about getting the default value in the field to be SAST instead of the US timezone?
  13. unless of course my syntax is just wrong in overall for updating the default value on a field. *checks mysql documentation*
  14. hi, i've been struggling with this for a while now, accidentally posted on the PHP forums but intended for here. ALTER TABLE `8_transactions` UPDATE `timestamp_TransactionEvent` DEFAULT 'CONVERT_TZ(NOW(), "SYSTEM", "+2:00")'; i keep getting the following mysql error, i've tried finding out what the problem is but to no avail.
  15. lets see if this works: ALTER TABLE '8_transactions' CHANGE 'timestamp_TransactionEvent' 'timestamp_TransactionEvent' TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NULL DEFAULT 'CONVERT_TZ(CURRENT_TIMESTAMP, "SYSTEM", "+2:00")' COMMENT 'TimeStamp Transaction Event,Current TimeStamp No Keys' same error... mysql keeps removing the space after the name and before the variable type.edited it again and this is the error i get: is it at all possible to set a default value such as this? if it is, how should i be escaping the characters, and which ones in the default value?
  16. well, trying to input the sequel query manually i get the following problem:
  17. this SQL string sets the default value to be 0000-00-00 00:00:00.is there anyway to modify the following query to add a function as a mysql default? ALTER TABLE `8_transactions` CHANGE `timestamp_TransactionEvent` `timestamp_TransactionEvent` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NULL DEFAULT 'CONVERT_TZ(CURRENT_TIMESTAMP, ''SYSTEM'', ''+2:00'')' COMMENT 'TimeStamp Transaction Event, Current TimeStamp No Keys;
  18. hi,i've been reading up on fixing a timestamp problem i have in that it's in the host's US timezone.i was wondering if i could set a default value on a timestamp column to the following: CONVERT_TZ(CURRENT_TIMESTAMP, 'SYSTEM', '+2:00') but phpmysql will not seem to accept it.will i be able to do this if i ask the host to change this on console level perhaps?
  19. yeah, just fixed it, read through the sql string to notice that the wildcards where being read as mod's. :/just had to escape the quotes :)so it was not a displaced error ^^ function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too? $sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($row = mysql_fetch_array($result)) { $dd = $row["smallint_DuplicateDays"]; } $ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),$dd." days ago")); $sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer LIKE \"%".$mail."%\" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > ".$ddate." ORDER BY timestamp_LeadCreated DESC;"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($result) { $leadids = array(); while ($row = mysql_fetch_array($result)) { array_push($leadids,"#".($row["bigint_LeadID"]+11001000)); } return " (".join(", ",$leadids).")"; } else { return ""; }}
  20. hi,i am currently struggling to see the worms in the apple. could i perhaps please ask outside assistance, i've tried googling on this error but have found only unrelated examples of this error. i don't see any divisions in these few lines of code.here is the error i receive: and here is the function that contains line 144, the line is made bold:function duplicatedays($mail,$serviceid,$supplierid) { // check supplierid too? $sql = "SELECT smallint_DuplicateDays FROM 2_servicescatalogue WHERE bigint_ServiceID = ".$serviceid.";"; $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($row = mysql_fetch_array($result)) { $dd = $row["smallint_DuplicateDays"]; } [i]$ddate = date('Y-m-d H:i:s', strtotime(date("Y-m-d H:i:s"),"-".$dd." days"));[/i] [b]$sql = "SELECT bigint_LeadID FROM 6_serviceleads WHERE bigint_ServiceID = ".$serviceid." AND text_Consumer LIKE "%".$mail."%" AND bigint_SupplierID = ".$supplierid." AND timestamp_LeadCreated > ".$ddate." ORDER BY timestamp_LeadCreated DESC;";[/b] $GLOBALS["sql"] .= $sql; $result = mysql_query($sql); $err = mysql_error(); $GLOBALS["sql"] .= strtoupper($err)."\n"; if ($result) { $leadids = array(); while ($row = mysql_fetch_array($result)) { array_push($leadids,"#".($row["bigint_LeadID"]+11001000)); } return " (".join(", ",$leadids).")"; } else { return ""; }} this function is to get a string to append to the subject of the mailed leads IF it is a duplicate lead within the amount of days specified in the database.smallint_DuplicateDays is equal to 30 for bigint_ServiceID 1.i suspect the problem might be elsewhere, possibly in the line that i made italic, which would mean this is quite possibly a displaced error.
  21. okay, issue resolved. i used virtual references to the files rather than relative :)THIS ISSUE HAS BEEN RESOLVED ^^
  22. this is php script, and i'm sure you meant dollar signs ($)
  23. hi, my account for the forge.vtiger forums is still not resolved, so i am posting this issue here.i am trying to use VTiger Web Service Client Library version 1.4this is the error i get: simple enough, so i repaired it in WSClient.php with the following adjustments.<?phprequire_once('Net/HTTP_Client.php');require_once('WSVersion.php'); after repairing this, i found the following error: these errors were found with the same default targets as in the downloaded archive (attached to my thread on the vtiger forums).now i've gone and adjusted these include paths to the following:<?phprequire_once('../../third-party/curl_http_client.php');require_once('../../third-party/Zend/Json.php'); uploaded and updated these changes.yet the errors remain... could somebody please help me out here?
  24. thanks justsomeguy,that actually helps me ALOT!!! (kinda feel like doh, almost pasting the second statement onto the first...)
×
×
  • Create New...