0

I have a variable 'min_rent' having type textfield. Now I am using rules. now when I use simple show a message and use PHP evaluation and wrote echo variable_get ('min_rent'); and is working fine. Now when I use add a variable having to integer and under PHP evaluation you used return variable_get ('min_rent'); and gives a variable. now when I use this variable under show a message and under data selector I give variable name. it doesn't show. I need this variable for comparison. Does anybody have an idea how doing this?

This is my rule export

{ "rules_rent_payment_and_refund" : {
    "LABEL" : "Rent Payment and Refund",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "php", "rules", "rules_conditional" ],
    "ON" : { "node_insert--rent_payment" : { "bundle" : "rent_payment" } },
    "DO" : [
      { "variable_add" : {
          "USING" : {
            "type" : "integer",
            "value" : {
              "select" : "",
              "php" : { "code" : "return variable_get(\u0027min_rentby_tenant\u0027);" }
            }
          },
          "PROVIDE" : { "variable_added" : { "variable_added_new" : "Added variable new" } }
        }
      },
      { "drupal_message" : { "message" : [ "variable-added-new" ] } },
      { "drupal_message" : { "message" : "\u003C?php $value=variable_get(\u0027max_rentby_tenant\u0027);\r\necho \u0022hello \u0022. variable_get(\u0027max_rentby_tenant\u0027);\r\n\r\n?\u003E\r\n" } },
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : {
              "select" : "",
              "php" : { "code" : "$value=variable_get(\u0027max_rentby_tenant\u0027);\r\nreturn $value;" }
            }
          },
          "PROVIDE" : { "variable_added" : { "variable_added" : "Added variable" } }
        }
      },
      { "drupal_message" : { "message" : [ "variable-added" ] } },
      { "entity_fetch" : {
          "USING" : {
            "type" : "node",
            "id" : [ "node:field-rental-property-display-na:nid" ]
          },
          "PROVIDE" : { "entity_fetched" : { "entity_fetched" : "Fetched entity" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : [ "entity-fetched:author:mail" ] },
          "PROVIDE" : { "variable_added" : { "author_mail_id" : "author_mail_id" } }
        }
      },
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : "[entity-fetched:field_email_id_of_the_payee]"
          },
          "PROVIDE" : { "variable_added" : { "email_id_of_payee" : "email_id_of_payee" } }
        }
      },
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : "\u003C?php return $entity_fetched-\u003Efield_property_enter_by[\u0027und\u0027][0][\u0027value\u0027];?\u003E"
          },
          "PROVIDE" : { "variable_added" : { "enter_by" : "enter_by" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : "[node:field-is-verified-transaction-ru]" },
          "PROVIDE" : { "variable_added" : { "transaction_rules" : "transaction_rules" } }
        }
      },
      { "variable_add" : {
          "USING" : {
            "type" : "text",
            "value" : "\u003C?php \r\n\r\nreturn \u0027on\u0027; \r\n?\u003E"
          },
          "PROVIDE" : { "variable_added" : { "interceptor_on_off" : "Interceptor on\/off" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "integer", "value" : [ "node:field-rent-amounts" ] },
          "PROVIDE" : { "variable_added" : { "rent_amount" : "rent_amount" } }
        }
      },
      { "variable_add" : {
          "USING" : { "type" : "text", "value" : [ "node:field-selected-payment-cylce-" ] },
          "PROVIDE" : { "variable_added" : { "payment_cycle" : "payment_cycle" } }
        }
      },
      { "CONDITIONAL" : [
          {
            "IF" : { "data_is" : { "data" : [ "interceptor-on-off" ], "value" : "on" } },
            "DO" : [
              { "drupal_message" : { "message" : "Rule 1" } },
              { "CONDITIONAL" : [
                  {
                    "IF" : { "data_is" : { "data" : [ "node:field-is-verified-transaction-ru" ], "value" : "1" } },
                    "DO" : [
                      { "drupal_message" : { "message" : "Rule2" } },
                      { "CONDITIONAL" : [
                          {
                            "IF" : { "data_is" : { "data" : [ "payment-cycle" ], "value" : "monthly" } },
                            "DO" : [
                              { "drupal_message" : { "message" : "Rule 3 " } },
                              { "variable_add" : {
                                  "USING" : {
                                    "type" : "text",
                                    "value" : "\u003C?php echo variable_get(\u0027max_rentby_tenant\u0027);"
                                  },
                                  "PROVIDE" : { "variable_added" : { "monthly_limit" : "monthly_limit" } }
                                }
                              },
                              { "variable_add" : {
                                  "USING" : {
                                    "type" : "integer",
                                    "value" : {
                                      "select" : "",
                                      "php" : { "code" : "return \u0027hiii\u0027;\r\nreturn variable_get(\u0027max_rentby_tenant\u0027);" }
                                    }
                                  },
                                  "PROVIDE" : { "variable_added" : { "monthly_limit_int" : "monthly_limit_int" } }
                                }
                              },
                              { "drupal_message" : { "message" : [ "monthly-limit-int" ] } },
                              { "CONDITIONAL" : [
                                  {
                                    "IF" : { "data_is" : {
                                        "data" : [ "rent-amount" ],
                                        "op" : "\u003C",
                                        "value" : [ "monthly-limit" ]
                                      }
                                    },
                                    "DO" : [
                                      { "drupal_message" : { "message" : "enter in rules" } },
                                      { "CONDITIONAL" : [
                                          {
                                            "IF" : { "data_is" : { "data" : [ "enter-by" ], "value" : "landlord" } },
                                            "DO" : [
                                              { "mail" : {
                                                  "to" : [ "author-mail-id" ],
                                                  "subject" : "new payment request",
                                                  "message" : "Hi\r\n\r\nPlease accept the link to receive payment.",
                                                  "language" : [ "" ]
                                                }
                                              }
                                            ]
                                          },
                                          {
                                            "ELSE IF" : { "data_is" : { "data" : [ "enter-by" ], "value" : "tenant" } },
                                            "DO" : [
                                              { "mail" : {
                                                  "to" : [ "email-id-of-payee" ],
                                                  "subject" : "new payment request",
                                                  "message" : "Hi\r\nPlease click on the link to accept the payment. ",
                                                  "language" : [ "" ]
                                                }
                                              }
                                            ]
                                          }
                                        ]
                                      }
                                    ]
                                  },
                                  { "ELSE" : [
                                      { "data_set" : {
                                          "data" : [ "node:field-rental-payment-status" ],
                                          "value" : "pending_approval"
                                        }
                                      },
                                      { "mail" : {
                                          "to" : "amandeepkaur@indivar.com",
                                          "subject" : "Payment transaction limit approval",
                                          "message" : "Hi\r\nNew request has been generated for approval to increase the transaction limit.",
                                          "language" : [ "" ]
                                        }
                                      }
                                    ]
                                  }
                                ]
                              }
                            ]
                          },
                          {
                            "ELSE IF" : { "data_is" : { "data" : [ "payment-cycle" ], "value" : "daily" } },
                            "DO" : [
                              { "variable_add" : {
                                  "USING" : {
                                    "type" : "integer",
                                    "value" : {
                                      "select" : "",
                                      "php" : { "code" : "$daily = \u00271000\u0027;\r\nreturn $daily;" }
                                    }
                                  },
                                  "PROVIDE" : { "variable_added" : { "daily_limit" : "daily_limit" } }
                                }
                              },
                              { "CONDITIONAL" : [
                                  {
                                    "IF" : { "data_is" : {
                                        "data" : [ "rent-amount" ],
                                        "op" : "\u003C",
                                        "value" : [ "daily-limit" ]
                                      }
                                    },
                                    "DO" : [
                                      { "CONDITIONAL" : [
                                          {
                                            "IF" : { "data_is" : { "data" : [ "enter-by" ], "value" : "landlord" } },
                                            "DO" : [
                                              { "mail" : {
                                                  "to" : [ "author-mail-id" ],
                                                  "subject" : "please collect the payment.",
                                                  "message" : "Hi \r\n\r\nNew link for payment is generated.",
                                                  "language" : [ "" ]
                                                }
                                              }
                                            ]
                                          },
                                          {
                                            "ELSE IF" : { "data_is" : { "data" : [ "enter-by" ], "value" : "tenant" } },
                                            "DO" : [
                                              { "mail" : {
                                                  "to" : [ "email-id-of-payee" ],
                                                  "subject" : "Please accept payment",
                                                  "message" : "Hi\r\nNew link for payment has been generated.",
                                                  "language" : [ "" ]
                                                }
                                              }
                                            ]
                                          }
                                        ]
                                      }
                                    ]
                                  },
                                  { "ELSE" : [
                                      { "data_set" : {
                                          "data" : [ "node:field-rental-payment-status" ],
                                          "value" : "pending_approval"
                                        }
                                      },
                                      { "mail" : {
                                          "to" : "amandeepkaur@indivar.com",
                                          "subject" : "Payment transaction limit approval",
                                          "message" : "Hi\r\nNew request has been generated for approval to increase the transaction limit.",
                                          "language" : [ "" ]
                                        }
                                      }
                                    ]
                                  }
                                ]
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  }
}

Thanks

  • 1
    Can you include an export of your Rule? – David Thomas Nov 12 '13 at 10:20
  • i added the code – user23324 Nov 13 '13 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.